|
-
February 27th, 2011, 08:42 PM
#1
Calling a function on another window
I'm working on a C++/MFC program and I need to call a function on another window. I can get the *CWnd easily enough:
CWnd* parent_hwnd = GetParent();
Unfortunately I cannot easily access the functions on this window, though. I've read that I could get this to work if I made a member variable of the correct type, but I've had no luck with that since the class of that GetParent() window is defined in a separate project in the same solution. I'm unable to just include the .h file to cast(?) my CWnd* as the exact type. I've tried to add the other project in "Additional Include Directories" but this is a large program and when I include the other project a lot of stuff breaks. I also tried to make another .h file in the same project to define my function (sort of like what you can do for remoting) but it won't let me repeat the class names like that in C++/MFC.
When I step though the program I have no problem calling member functions like this:
parent_hwnd->CXSXPlotMgrWndw()->SetYLimits(1,2);
But that only works at run-time, not compile time. How can I compile something that does the same as the line above? Maybe parent_hwnd->CallMemberFunc()? I was unable to find any decent documentation on that.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|