Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

Use standard SDK function, not MFC

MVC++ 6.0

Alright.  

I am trying to call the function "FindWindow()" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/findwindow.asp).  The problem I'm having is that instead of calling this from the standard Windows SDK, it is using the MFC version, CWnd::FindWindow() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cwnd.3a3a.findwindow.asp) which is useless to me.

I'm having the same problem with SendMessage.  Instead of pulling from the SDK, it's using MFC.

Does anyone know how to tell it to use the standard function and not the MFC version?  Basically I want to use the FindWindow function that returns an HWND, not a CWnd.  Similar issue with SendMessage and many other standard functions that have MFC counterparts.

Thanks.
0
Dr_Nick
Asked:
Dr_Nick
  • 4
  • 2
1 Solution
 
Roshan DavisCommented:
Both will give you the same results but one give "CWnd*" but the other HWND. you can convert these 2 into other like

HWND hWnd = pWnd->m_hWnd;

and

CWnd *pWnd = CWnd::FromHandle(hWnd);

Rosh
0
 
Dr_NickAuthor Commented:
Yeah, I know you can cast a CWnd to an HWND, but I still need to know how to use the standard SDK functions.

SendMessage was my other problem.  When I try to use it in VC++ 6, it expects the prototype:

a)  LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );

Because it thinks I mean CWnd::SendMessage(), but I really want the standard SDK function:

b)  LRESULT SendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );

I guess you could simplify my question like this:  I want to use the second SendMessage function (b), but when I try it uses the other one (a).  How can I use function (b) in VC++?

Thanks.
0
 
Roshan DavisCommented:
Ohh yes you have to mentione the global scode symbol

::SendMessage(hWnd, Msg, wParam, lParam); <-----Like this

Good Luck
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Roshan DavisCommented:
Add "::"  (without quotes) to every function

Good Luck
0
 
Roshan DavisCommented:
Hi Dr_Nick,
Is that worked?
Rosh :)
0
 
Dr_NickAuthor Commented:
YES!

Thank you very much for your help.  It worked perfectly!

Absolutely perfect.

Nick
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now