Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Really Easy : How do you reference a control ?

Posted on 1998-12-12
1
Medium Priority
?
169 Views
Last Modified: 2010-04-02
I have a resource file that contains a dialog box which in turn contains 3 Text boxes (Edit Controls) and a button. When the button is clicked I want to disable the text boxes.

There is only one dialog for the entire application (done with CreateDialogParam). When the user clicks on the button I receive the windows message and the handle to the button : I need to use the EnableWindow API but how do I pass it the hWnd of the Text boxe  ?


here is some sammple code (in BASIC) :

CASE %WM_COMMAND
   SELECT CASE LOWRD(wParam)
          CASE 104
          '== [ Start/Abort Button Clicked ] ==
          IF HIWRD(wParam) = %BN_CLICKED THEN
                     Dim cbtnText as ASCIIZ * 256
                     Dim iRCLen as Integer
                iRCLen = GetWindowText (lParam,cbtnText,255)
                if left$(cbtnText,iRCLen) = "&Start Router" then  
                    SetWindowText lParam,"&Abort"
                    '<< Diable Text Boxes >>
                else
                    SetWindowText lParam,"&Start"
                  EnableWindow 101,0
             end if

              END SELECT
0
Comment
Question by:dm_14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 0 total points
ID: 1180005
Use the GetDlgItem API to get the HWND of the text box

The format is

HWND hWndText = GetDlgItem( hWndDialog, IDC_TEXT ) ;

You have the hWndDialog (hWnd of the dialog, this comes in the message you're responding to).  IDC_TEXT is the control id of the text box.


0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

618 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