Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error using GetDlgItem()

Status
Not open for further replies.

Simse

Programmer
Feb 24, 2005
22
Hi there!

I'm quite a newbie and i've created a property sheet in which i want to hide/rename/change the function of buttons. All solutions i found used GetDlgItem(), but it doesn't work for me.
(error C2660 : function does not take 1 parameters)
The critical lines are:

CWnd *pWnd = GetDlgItem( IDHELP );
pWnd->ShowWindow( FALSE );

or

((CWnd*)GetDlgItem(IDHELP))->ShowWindow(SW_HIDE);

whatever...nothing works!

Does anyone know, what might be the problem?

Is it possible not to close the property sheet when clicking the ok-button?

Hoping for help, thanks!
 
Ok, first problem partly solved. I forgot to insert the handler. Now the lines are:

CPropertySheet dlg("Test"); //didn't post that the first time

CWnd *pWnd = (CWnd*)dlg.GetDlgItem( IDHELP );
pWnd->ShowWindow( FALSE );

Now, there's an assertion error in winocc.cpp (line 76)
and the problem with the OK-button is still there.
If you got a solution, let me hear it.

CU
 
let me start by saying that i don't know mfc well.. (just to boost your confidence in my response :))

i have had assertion failures before tho.. i can't remember exactyl.. but on the message box (of the error) that you get.. there are a few buttons.. one of them will just exit the app and the other will take to the line of code where teh "assert" fails. this will proabbly not be in a file that you wrote.. it will be in a library file (most likely if you can't find the source of the error). so, some of the mfc libraries call assert. as soon as the assert fails, the program crashes. so you go to the line where the error occurs and scroll around. you will be able to see which function (this will be a function that you called in your code) causes teh error. take a look at the library code and see what they are trying to "assert" and modify your code accordingly.

also, have a look at this FAQ at codeguru:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top