Results 1 to 8 of 8

Thread: How to get value of checkbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2012
    Posts
    2

    How to get value of checkbox

    I create vb6 software to control external program since create from visual c++ how can i get state value of checkbox from external program.Please help me....

  2. #2

  3. #3
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: How to get value of checkbox

    Code:
    Private Const BM_GETCHECK As Long = &HF0
    
    Private Declare Function GetCheckValue Lib "user32.dll" Alias "SendMessageW" (ByVal hWnd As Long, Optional ByVal uMsg As Long = BM_GETCHECK, Optional ByVal wParam As Long, Optional ByVal lParam As Long) As CheckBoxConstants
    
    'Sample usage
    
    Select Case GetCheckValue(Check1.hWnd)
        Case vbUnchecked:
        Case vbChecked:
        Case vbGrayed:
    End Select
    How you obtain the CheckBox's hWnd is up to you...
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: How to get value of checkbox

    Code:
    Private Const BM_SETCHECK As Long = &HF1
    
    Private Declare Function SetCheckValue Lib "user32.dll" Alias "SendMessageW" (ByVal hWnd As Long, Optional ByVal uMsg As Long = BM_SETCHECK, Optional ByVal Value As CheckBoxConstants = vbUnchecked, Optional ByVal lParam As Long) As Long
    
    'Sample usage
    
    SetCheckValue Check1.hWnd, , vbUnchecked    'Skip 2nd parameter
    SetCheckValue Check1.hWnd, , vbChecked      'Ignore last parameter
    SetCheckValue Check1.hWnd, , vbGrayed       'Choose only from the values presented
    I leave it up to you to supply the CheckBox's hWnd...
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: How to get value of checkbox

    rino is right he is double posting , no patience ?

  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2012
    Posts
    2

    How to get checkbox value form vb6

    I want to control .Net external program by vb6.Please help me to get checkbox value form external program.Thk

  7. #7
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: How to get checkbox value form vb6

    Try this and this.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to get value of checkbox

    Triple threads merged.

    One thread for one topic posted in one forum section is the rule.

    Do not create another thread on this topic.

    Why not respond to some of the suggestions already made?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width