Click here to Skip to main content
16,016,962 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what is wrong in this code Pin
prathuraj15-May-07 21:17
prathuraj15-May-07 21:17 
GeneralRe: what is wrong in this code Pin
Hamid_RT15-May-07 21:43
Hamid_RT15-May-07 21:43 
AnswerRe: what is wrong in this code Pin
prasad_som15-May-07 21:24
prasad_som15-May-07 21:24 
GeneralRe: what is wrong in this code Pin
prathuraj15-May-07 21:29
prathuraj15-May-07 21:29 
GeneralRe: what is wrong in this code Pin
Hamid_RT15-May-07 21:31
Hamid_RT15-May-07 21:31 
AnswerRe: what is wrong in this code Pin
prasad_som15-May-07 21:31
prasad_som15-May-07 21:31 
GeneralRe: what is wrong in this code Pin
prathuraj15-May-07 21:39
prathuraj15-May-07 21:39 
AnswerRe: what is wrong in this code Pin
Stephen Hewitt15-May-07 22:03
Stephen Hewitt15-May-07 22:03 
Try this code instead (run in a debug build):
CWnd *pWnd = GetDlgItem(13);
ASSERT(pWnd != NULL);
ASSERT(dynamic_cast<CIPAddressCtrl*>(pWnd) != NULL);
CIPAddressCtrl *ip = static_cast<CIPAddressCtrl*>(pWnd);


If the second line asserts in a debug build the id is wrong.

If the third line asserts in a debug build the CWnd returned was not a CIPAddressCtrl and your cast is in error. Try adding a member variable (using ClassWizard in MSVC6); this step makes calling GetDlgItem unnecessary. If this line fails to compile enable RTTI (just in the debug build) and try again.

If the fourth line fails to compile CIPAddressCtrl is not derived from CWnd.

Don't use C-style casts!

Steve

AnswerRe: what is wrong in this code Pin
krmed16-May-07 1:56
krmed16-May-07 1:56 
QuestionHow to check if a valid document file is loaded in mfc Pin
TariqZ15-May-07 19:58
TariqZ15-May-07 19:58 
QuestionRe: How to check if a valid document file is loaded in mfc Pin
Nelek15-May-07 22:00
protectorNelek15-May-07 22:00 
Questionhow to combine to dialog boxes and a formview in a single application .. Pin
mirraa15-May-07 19:27
mirraa15-May-07 19:27 
AnswerRe: how to combine to dialog boxes and a formview in a single application .. Pin
Nelek15-May-07 21:57
protectorNelek15-May-07 21:57 
GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
mirraa16-May-07 1:11
mirraa16-May-07 1:11 
GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
Nelek16-May-07 1:30
protectorNelek16-May-07 1:30 
GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
mirraa18-May-07 20:43
mirraa18-May-07 20:43 
GeneralRe: how to combine to dialog boxes and a formview in a single application .. Pin
Nelek19-May-07 23:02
protectorNelek19-May-07 23:02 
QuestionHow to use debugger Pin
Jerry Burns15-May-07 17:23
Jerry Burns15-May-07 17:23 
AnswerRe: How to use debugger Pin
_AnsHUMAN_ 15-May-07 18:01
_AnsHUMAN_ 15-May-07 18:01 
AnswerRe: How to use debugger Pin
Hamid_RT15-May-07 19:35
Hamid_RT15-May-07 19:35 
Questionlarge numbers Pin
locoone15-May-07 17:00
locoone15-May-07 17:00 
AnswerRe: large numbers Pin
Naveen15-May-07 17:45
Naveen15-May-07 17:45 
GeneralRe: large numbers Pin
locoone16-May-07 17:12
locoone16-May-07 17:12 
AnswerRe: large numbers Pin
Nelek15-May-07 21:53
protectorNelek15-May-07 21:53 
GeneralRe: large numbers Pin
locoone16-May-07 17:14
locoone16-May-07 17:14 

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.