Hi all,
I'm looking for a code lines that enumerate all the 1st level window on screen and I saw one in api is EnumWindows so could you point me to somewhere that have that sample or orther solution
Posted on 2003-08-20 23:33:34 by nvm
i wish to help, but have no ideas :(

try this link
Posted on 2003-08-21 00:00:04 by S.T.A.S.
Thank friend, I found it.
By the way could you advise me on this case :
My window (my application, or office's app) have a modal dialog box appear which have only one OK button, this modal dialog box can be considered as a child windows of my window or diffrent thing like system dialog box ? If yes can I get it's handle if I know my window's handle id
Posted on 2003-08-21 00:39:04 by nvm
i'm not good with dialog boxes (created with DialogBoxParam)
usually we must specify "handle to owner window" when we create *box (if it is NULL, then owner is Desctop)

but why do you need "modal dialog box which have only one OK button", may be MessageBox will be better?
Posted on 2003-08-21 01:18:32 by S.T.A.S.

BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam){
// here you use hwnd
return TRUE;

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
return 0;

Posted on 2003-08-21 02:24:10 by Azrim
Hi friend,
may be my poor english confuse you my case is:
I have one application that keep reporting error message (the modal dialog box that have only one ok button) and I have to press OK several time to let that application continue running. So I want to write a small process that keep sending OK message to that modal dialog box which is belong to my application. So my approach is get window handle of my application first and get it child window (the modal dialog box) then send the OK message to that modal dialog box
any advise from you are helpful
Posted on 2003-08-21 03:10:00 by nvm
Once you get the handle to the main window you can use EnumChildWindows to enumerate the child winodws of that one. Look for a window of class "#32770" that will be the modal dialog. When you have found it send it WM_COMMAND,IDOK,0. That should do it for you.

PS: you will probably have to do it in a thread as your main window will wait for the modal dialog to be dismissed before processing any new commands.
Posted on 2003-08-21 03:16:53 by donkey
You could also post the WM_COMMAND message instead of sending it, that way you don't need multithreading because PostMessage does not wait for the target window to finish processing the message.
Posted on 2003-08-21 19:05:00 by QvasiModo