Get the window handle and title, call the cross-class interface, and display it in the editing box (vs2010) in real time)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.