Tuesday, June 25, 2013

More Win32 fun

Managed to set a timer to update the text on the screen every second, however, the window does not wipe itself clean after every update.

Code

After much research, came upon this solution: http://msdn.microsoft.com/en-us/library/ms632599(VS.85).aspx#layered

Instead of

hWnd = CreateWindow(szWindowClass, 0, 0,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
view raw gistfile1.txt hosted with ❤ by GitHub
I used
hWnd = CreateWindowEx(WS_EX_LAYERED, szWindowClass, 0, 0,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
SetLayeredWindowAttributes(hWnd,RGB(255,255,255), 0, LWA_COLORKEY);
view raw gistfile1.txt hosted with ❤ by GitHub
That solved it. Code

No comments:

Post a Comment