Getting Focus Handle after lost

Hello,

i need help related to getting focus. when it loss focus through any reason (i.e any phone) because i loss the focus my application is still running it draw white images inside of actuall images. i want some event or API that will remind my application that focus is back to the application so i will redraw the content (photo).

any code sample or resourses is highly appreciated.

Thanks in advance

Regards

Salman

[526 byte] By [SalmanMaredia] at [2007-12-24]
# 1

Try SetForegroundWindow and ShowWindow then do UpdateWindow.

SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));

ShowWindow(hWnd, SW_NORMAL);

UpdateWindow(hWnd);

kuntushi at 2007-10-8 > top of Msdn Tech,Smart Device Development,Smart Devices Native C++ Development...
# 2

Hello,

thanks kuntushi, but i want help related to getting focus when it loss how my application knows that handle (focus) is again given to me. because it draw white spot on the screen. My application need handle or event that will let my application to know that handle or focus is back so redraw or perform the desire task.

Thanks

-Salman

SalmanMaredia at 2007-10-8 > top of Msdn Tech,Smart Device Development,Smart Devices Native C++ Development...
# 3

So it wants to know when it is the window that is currently being shown?

I've never done anything like this, but a quick look at the Window API shows that WM_ACTIVATEAPP is send as a message when the window is about to be activated by another process. So in your WndProc, you can just have a case for that message and deal with it appropriately.

Check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows.asp to see what I am talking about. WM_ACTIVATEAPP might not be for you, but there are tonnes of messages there. I'm sure you'll find one.

kuntushi at 2007-10-8 > top of Msdn Tech,Smart Device Development,Smart Devices Native C++ Development...
# 4
WM_ACTIVATEAPP is a desktop message. For CE applications watch for WM_ACTIVATE and WM_SETFOCUS/WM_KILLFOCUS and process them appropriately. Keep in mind that while WM_ACTIVATE us sent to the top-level window, the WM_SETFOCUS is sent to the window that gets focus - such as edit control
AlexFeinman at 2007-10-8 > top of Msdn Tech,Smart Device Development,Smart Devices Native C++ Development...