Connect to the previous log.
Write the code in the wm_lbuttonup message response function:
Point PNT;
Wchar wc_targtwndtittle [200];
: Getcursorpos (& PNT); hwnd h_targetwnd =: windowfrompoint (PNT); // get the window handle at the cursor;: getwindowtext (h_targetwnd, wc_targtwndtittle, 200 );
Display wc_targtwndtittle in the edit box control of the dialog box program. This involves a cross-class usage of data and functions, in a picture control file, you cannot assign values to the edit box and display them in a timely manner. If you submit the value obtained by the wm_lbuttonup message response function to the edit box as a global variable, you can display it in the edit box, but it is not easy to display it in real time, there is an ontimer method on the Internet, and it is unnecessary. My processing is:
1. Find the instance of the class where the variable Member of the edit box control is located. In this main program initialization function (initinstance (), there will be a dialog box instance named cxxxxdlg;, declare a pointer to the Main Dialog Box class before the file, for example: cxxxxdlg * g_p_dlg;
Add the code g_p_dlg = & DLG; to the initinstance (); function;
2. In the picture control file, you need to include the header file of the main program and write it into: # inlcude "xxxxdlg. H ". Add the code to the wm_lbuttonup message response function:
Extern cxxxxdlg * g_pdlg; g_p_dlg-> ce_tittle.setwindowtext (wc_targtwndtittle );
Ce_tittle is the member variable added by the control in the my associated editing box. The data type is cedit;
In the next article, obtain the base address of the process and the data address of the process space.
Get the window handle and title, call the cross-class interface, and display it in the editing box (vs2010) in real time)