Click here to Skip to main content
15,891,943 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I am confused with this: Pin
ThatsAlok12-Jan-05 18:25
ThatsAlok12-Jan-05 18:25 
GeneralRe: I am confused with this: Pin
Selvam R12-Jan-05 23:26
professionalSelvam R12-Jan-05 23:26 
GeneralPROBLEM DRAWING WITH A MOUSE Pin
phijophlip12-Jan-05 17:06
phijophlip12-Jan-05 17:06 
GeneralRe: PROBLEM DRAWING WITH A MOUSE Pin
namaskaaram12-Jan-05 17:46
namaskaaram12-Jan-05 17:46 
GeneralRe: PROBLEM DRAWING WITH A MOUSE Pin
ThatsAlok12-Jan-05 18:49
ThatsAlok12-Jan-05 18:49 
GeneralCompiler error!! !! Pin
LiYS12-Jan-05 16:10
LiYS12-Jan-05 16:10 
GeneralRe: Compiler error!! !! Pin
nutkase12-Jan-05 22:18
nutkase12-Jan-05 22:18 
GeneralON_WM_KILLFOCUS Pin
digwizfox12-Jan-05 15:23
digwizfox12-Jan-05 15:23 
The following code snips relate to code that successfully compiled using Visual Studio 6.0. This same implementation does not compile in Visual Studio .Net 7.0. Here is the error message

ConfigTSAControlsFView.cpp(200) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CConfigTSAControlsFView::* )(UINT)' to 'void (__thiscall CWnd::* )(CWnd *)'


//Function Declaration
afx_msg void OnKillFocus(UINT uiCtrlID);

//Message Map Entry
ON_WM_KILLFOCUS()

//Function Implementation
void CConfigTSAControlsFView::OnKillFocus(UINT uiCtrlID)
{
//the code
}

Now this is what confuses me the most. The MSDN library implies that the OnKillFocus method takes a CWnd*, not a UINT. Visual studio 6.0, somehow was able to compile this and perform a cast. However, Visual Studio .net is complaining that the static_cast is not possible. So can someone explain to me how visual studio 6.0 can make the cast and why visual studio .Net cannot? The uiCntrlId is used in a switch statement so the actual value being used is equal to the resource Id of the window. How did visual studio cast from a CWnd* to a resource Id automatically? This seems like quite a stretch. If anyone has any ideas, I'd appreciate it.

Personally, I think the error message makes perfect sense. Of course the compiler won't cast from a CWnd* to a UINT that has a completely different meaning. I just can't imagine how the code ever compiled and worked with visual studio 6.0. The other thing is that if I change the code to use a CWND*, then it seems to invalidate the existing switch statements, within the function, that expects a controller id.


GeneralRe: ON_WM_KILLFOCUS Pin
Ryan Binns12-Jan-05 17:00
Ryan Binns12-Jan-05 17:00 
GeneralRe: ON_WM_KILLFOCUS Pin
digwizfox13-Jan-05 6:33
digwizfox13-Jan-05 6:33 
GeneralDynamic Views Pin
Anonymous12-Jan-05 15:12
Anonymous12-Jan-05 15:12 
GeneralRe: Dynamic Views Pin
Yulianto.12-Jan-05 15:31
Yulianto.12-Jan-05 15:31 
GeneralMSVC 2003 GUI Help Pin
c++code10112-Jan-05 14:31
c++code10112-Jan-05 14:31 
GeneralSending output to a printer Pin
BRIMID12-Jan-05 13:29
BRIMID12-Jan-05 13:29 
GeneralMFC socket programing problem Pin
shaihnc12-Jan-05 12:39
shaihnc12-Jan-05 12:39 
GeneralRe: MFC socket programing problem Pin
shaihnc13-Jan-05 5:32
shaihnc13-Jan-05 5:32 
GeneralSpeed of operators Pin
Malcolm Smart12-Jan-05 11:57
Malcolm Smart12-Jan-05 11:57 
GeneralRe: Speed of operators Pin
Rick York12-Jan-05 12:18
mveRick York12-Jan-05 12:18 
GeneralRe: Speed of operators Pin
Mike Dimmick12-Jan-05 12:19
Mike Dimmick12-Jan-05 12:19 
GeneralRe: Speed of operators Pin
Mike Dimmick12-Jan-05 12:59
Mike Dimmick12-Jan-05 12:59 
GeneralRe: Speed of operators Pin
Ryan Binns12-Jan-05 16:58
Ryan Binns12-Jan-05 16:58 
GeneralOnSize Function : Positioning Static Controls Pin
tnguyen44412-Jan-05 11:50
tnguyen44412-Jan-05 11:50 
GeneralRe: OnSize Function : Positioning Static Controls Pin
User 1278212-Jan-05 16:13
User 1278212-Jan-05 16:13 
GeneralRe: OnSize Function : Positioning Static Controls Pin
Ryan Binns12-Jan-05 17:01
Ryan Binns12-Jan-05 17:01 
GeneralRe: OnSize Function : Positioning Static Controls Pin
tnguyen44413-Jan-05 6:10
tnguyen44413-Jan-05 6:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.