Solved

Use standard SDK function, not MFC

Posted on 2003-11-06
6
413 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 178
countEvens challenge 2 116
Problem to event 3 121
Bartender label printing - switch on and off graphics 3 92
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…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.

738 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