Hello, basic question regarding checkboxes

S

stewb85

Hello.

I want to check a checkbox using the CheckDlgButton
(hWND,IDC_CHECK1,BE_CHECKED) command


The checkbox resides in a Dialog box called IDD_MYAPPLICATION_DIALOG.
However, when I put this in the hWND field I get the error

error C2664: 'CheckDlgButton' : cannot convert parameter 1 from 'int'
to 'HWND'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast



What do I have to put in the hWND field to make this work?

Cheers
 
V

Victor Bazarov

I want to check a checkbox using the CheckDlgButton
(hWND,IDC_CHECK1,BE_CHECKED) command

It's not a command. It's a function call.
The checkbox resides in a Dialog box called IDD_MYAPPLICATION_DIALOG.
However, when I put this in the hWND field I get the error

error C2664: 'CheckDlgButton' : cannot convert parameter 1 from 'int'
to 'HWND'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast

Compiler is correct. You cannot pass integers where 'HWND' (whatever
that is) should be. C++ is a strongly typed language.
What do I have to put in the hWND field to make this work?

You need to find the HWND (IIRC it's the window "handle") of your
checkbox. Sorry, that's the extend of my ability to help you. This
is a C++ _language_ newsgroup, not Windows GUI programming newsgroup.
Please post your Windows GUI question to a Windows GUI forum.

V
 
C

Christopher

Hi,

If you use MFC it is the m_hWnd member of CDialog.
Or if you use CreateDialog it is the return value.

Regards, Ron AF Greve

Ron,

Your continued willingness to answer Windows specific questions does
nothing but encourage off topic postings. Why do you continue to do
so? Everytime you do it, you let an OT poster think they can keep
posting Windows specific questions here and receive help, which
clutters the newsgroup. The microsoft.public newsgroups suit this
purpose just fine. MSDN also, recently added forums in conjunction
with Windows Live. This would question would perfectly match the topic
of "Windows SDK" or "UI Development" on those forums. They can always
use more people to answer questions there. I have a few unanswered
questions there myself. Perhaps you should start lending a hand there.
If you would like to argue what is on and off topic, or that the FAQ
should be ignored, than let us hash that out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top