Wednesday, January 6, 2010

Windows programmer trick #1 --> FindWindowEx & Dialogs

FindWindowEx can be used to find not just your run of the mill window, but dialogs as well.

The documentation is a bit sparse, but makes reference to the MAKEINTATOM macro, this macro just like MAKEINTRESOURCE (they are practically the same), is used when an API call asks for a string but you have an int.


The secret to finding a Dialog with FindWindowEx is to use MAKEINTATOM like so:


HWND hwndDlg = FindWindowEx(NULL,NULL,MAKEINTATOM(32770),NULL);

32770 is the system atom for a dialog box class.

The above line of code searches for dialog boxes with the desktop as the parent window. Works handy for finding tool-windows etc..

chris' shared items

Twitter Updates

Official blog of Chris Lee Runyan

Fastest C++ in the west.