I'm in the process of learning C++. I'v开发者_如何转开发e created a boilerplate Win32 app within VC++ 2008. I've studied through the code and am ready do do a bit of experimenting. I thought it would be cool to print all the windows messages received in the message loop to the form created via the boilerplate code. I for the life of me, can't figure out the method of getting text onto that form. I can't seem to identify and named object that I can use to reference that damn form. The best I can figure is I need to use the handle to reference the form somehow. Still, even if I did know how to reference the form, I'm not sure I know how I would create a label to display the text. Anyway, if someone could just point out what methodology I need to learn to make this happen it would be much appreciated.
Thanks, Donovan
If you've created a label using resources, use its resource ID and
HWND *pWnd = ::GetDlgItem(mainDialogHwnd, IDC_YOUR_RESOURCE_ID);
::SetWindowText(pWnd, "Your Updated Text");
There are MFC equivalents for those too, should get you in the right direction. Note that posting message loop means lots and lots of information... might not want to do that. Check Spy++ if that's still available and in use today to see how many messages an app gets!
精彩评论