Use this tool to determine the name of the Window Class of an application

How To Use

Open the other application, then open Spy++ in VS (Menu > Tools > Spy++)

Under the Search menu, click “Find Window”.

Click and Drag the Finder Tool, the little crosshair inside the miniature window, onto the other application, then let go. The dialog in Spy++ will tell you the Window Handle, Caption, and Class name of the other application.

In general, you will want to find the Handle of the other window programatically, because it will be different every time the app is launched, but Spy++ is great for debugging your app. And, the class name won’t change from one instance of an app to another, so you can use Spy++ to get the class name, then use it in your call to FindWindow() or FindWindowEx()

Getting ID Of Menu Items, Toolbars etc

Spy > Log Messages
Use the target tool to select the window you want to trace
Click OK and all messages to do with that window start getting logged
Do the operation (like selecting a menu item pressign a toolbar button)
If your lucky and the ap opnes a new window then the trace will stop and pretty much the last entry will be the one you want (wID is the control ID you needyou need for the post message). If not you’ll just have to find it

	int Xposn = 0;
	int Yposn = 0;
			SomeProcess->MainWindowHandle,	//hWnd - Handle to the window whose window procedure is to receive the message.
			273,								//Msg - Specifies the message to be posted (273 / 0x111 = WM_COMMAND)
			46018,								//wParam - Specifies additional message-specific information (Control ID of the Synchronise button | (BN_CLICKED = 0))
			((Yposn * 0x10000) + Xposn));		//lParam - Specifies additional message-specific information
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.


Your email address will not be published. Required fields are marked *