Solved

Use standard SDK function, not MFC

Posted on 2003-11-06
6
404 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 156
Separate files macro - Errors on larger data set 18 65
Best tools for Backup and restore of Wordpress site 6 55
either24  challenge 19 90
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

932 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

11 Experts available now in Live!

Get 1:1 Help Now