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:


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.