Solved

Use standard SDK function, not MFC

Posted on 2003-11-06
6
402 Views
Last Modified: 2013-11-20
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
Comment
Question by:Dr_Nick
  • 4
  • 2
6 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9699159
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
 

Author Comment

by:Dr_Nick
ID: 9699452
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
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9699456
Ohh yes you have to mentione the global scode symbol

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

Good Luck
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 23

Accepted Solution

by:
Roshan Davis earned 150 total points
ID: 9699468
Add "::"  (without quotes) to every function

Good Luck
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9699544
Hi Dr_Nick,
Is that worked?
Rosh :)
0
 

Author Comment

by:Dr_Nick
ID: 9704785
YES!

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

Absolutely perfect.

Nick
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now