Hello I'm a newbie:grin:

I am currently working on a locking program for my own computer when I am asleep(my brother might access it and mess up my projects). I need to make the parent window unaccessible but visible (grayed out). Does anyone have any idea on how this can be done?

My program disables all system keys, maximizes itself, and makes itself the HWND_TOPMOST window. The user must press the right sequence of left and right mouse button to spawn a dialog box. Then you need to enter the password for the program to unlock the computer and exit. The problem is I need to disable the parent once I have the dialog box present or if I accidentally click on the parent it will hide the dialog box and since ALT+TAB is disabled, you have to start the whole process again.

I am temporarily fixing this problem by SetForegroundWindow my dialog box but that is messy.
Posted on 2002-02-12 16:59:48 by neetocin
Try creating the Dialog box with the "DialogBoxParam" API.

This creates a "modal" dialog box, with has the properties you seek...

When creating the modal dialog box, Windows makes it the active window. The dialog box remains active until the dialog box procedure calls the EndDialog function or Windows activates a window in another application. Neither the user nor the application can make the owner window active until the modal dialog box is destroyed.

Posted on 2002-02-12 21:30:35 by NaN
As well, handling this message should help your "focus" issue:


hwndGetFocus = (HWND) wParam; // handle of window receiving focus

The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.



Value of wParam. Identifies the window that receives the keyboard focus (may be NULL).

Return Value

An application should return zero if it processes this message.


If an application is displaying a caret, the caret should be destroyed at this point.

See Also


Both was pulled from the win 32 API reference that can be found on my web page, or any other ASM web page out there (think IcZelion has it on his... )

Posted on 2002-02-12 21:34:31 by NaN