Jump to content
  • Advertisement
Sign in to follow this  
greeklegend

OpenGL Drawing over fullscreen app

This topic is 3535 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, Appologies for bringing this up again (I've seen it lurking around here in my googling today) but I've yet to find a solution that does what I want. Basically I want to be notified in-game when I recieve msn messages (perhaps from certain people only). I was planning to use a trayed program that periodically enumerated windows (as a new message opens a new window), and upon detecting a new msn window, used a DirectDraw overlay to notify me in-game. I know a bit of C/C++ (preferably C) but I've never used DirectX (or OpenGL for that matter) before (most of my programming has been on linux) and the few code samples for this i've been able to dig up went way over my head. Can anybody explain step-by-step what my program would have to do to display this message? Thanks in advance PS: This is on Vista, apparently there's been some problems with overlays. PPS: I need to build it with visual studio express edition; one of the code samples I found needed a header not included with the free version

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by greeklegend
most of my programming has been on linux


It's a shame your target platform isn't linux, this would be so easy. The likes of Kopete use the DBus system to send and receive messages, and you could catch these with just a few lines of code.

See if you can find a program that monitors for WM_USER events, and see if MSN sends any of these when a message is received.

Share this post


Link to post
Share on other sites
Well, the msn background window appears to send a WM_GETTEXT message whenever a new window is opened...but I don't fully understand that
I'm happy with the following code for detecting when an msn chat is started. I only need to poll every few seconds so resource usage should be next to zero.
A potential problem seems to be that it won't work very well when two messages from two contacts are sent (FindWindowEx keeps returning the same hWnd). For now, i'll work around it by closing the window once we find it's title and work on a less hacky solution (possibly with EnumWindows()) tomorrow.

The windows are conveniently titled as "Friendly name <email address>" which should make obtaining the email address trivial.


#include <windows.h>
#include <string.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
HWND hwnd;
LPSTR wndtxt;
LPSTR msgtxt;
HANDLE heap;
heap = GetProcessHeap();
wndtxt = NULL;
msgtxt = NULL;
while (true){
Sleep(1000);
hwnd = FindWindowEx(NULL, NULL, "IMWindowClass", NULL);
if (hwnd != NULL){
wndtxt = (LPSTR)HeapAlloc(heap, HEAP_ZERO_MEMORY, 1024);
msgtxt = (LPSTR)HeapAlloc(heap, HEAP_ZERO_MEMORY, 1024);
GetWindowText(hwnd, wndtxt, 1023);
strcat(msgtxt, "The window title is \"");
strcat(msgtxt, wndtxt);
strcat(msgtxt, "\"");
MessageBox(NULL, msgtxt, "Finding MSN window", MB_OK);
SendMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
}
}
return 0;
}


Anyway...the more difficult problem is how to do the DirectDraw overlays...does anybody have a good tutorial/know the steps required to display one on the screen?

Share this post


Link to post
Share on other sites
I played around with Microsoft Detours a while back, you can intercept various function calls using a trampoline. However DirectX9 uses COM, it gets a little trickier then simple Win32 hooking.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!