Click here to Skip to main content
15,888,337 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Rs232 Pin
Ashfield18-Dec-08 3:46
Ashfield18-Dec-08 3:46 
AnswerRe: Rs232 Pin
Dave Kreskowiak18-Dec-08 3:53
mveDave Kreskowiak18-Dec-08 3:53 
GeneralRe: Rs232 Pin
Mangore7518-Dec-08 18:50
Mangore7518-Dec-08 18:50 
GeneralRe: Rs232 Pin
Dave Kreskowiak19-Dec-08 1:20
mveDave Kreskowiak19-Dec-08 1:20 
QuestionSendMessage not working for CheckBox Pin
scot_in18-Dec-08 1:04
scot_in18-Dec-08 1:04 
AnswerRe: SendMessage not working for CheckBox Pin
Dave Kreskowiak18-Dec-08 3:55
mveDave Kreskowiak18-Dec-08 3:55 
GeneralRe: SendMessage not working for CheckBox [modified] Pin
scot_in18-Dec-08 17:19
scot_in18-Dec-08 17:19 
AnswerRe: SendMessage not working for CheckBox Pin
arnold_w4-May-21 5:30
arnold_w4-May-21 5:30 
With inspiration from the following web site https://bytes.com/topic/net/answers/637107-how-find-out-if-check-box-checked I solved it like this in C# (it shouldn't be too hard to convert to Visual Basic):
C#
using Accessibility;

[DllImport("oleacc.dll", PreserveSig = false)]
[return: MarshalAs(UnmanagedType.Interface)]
public static extern object AccessibleObjectFromWindow(IntPtr hwnd, uint dwId, ref Guid riid);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam);

public static Nullable<bool> isCheckBoxChecked(IntPtr checkBoxHandle)
{
    const UInt32 OBJID_CLIENT = 0xFFFFFFFC;
    const int UNCHECKED       = 1048576;
    const int CHECKED         = 1048592;

    Guid uid = new Guid("618736e0-3c3d-11cf-810c-00aa00389b71");

    IAccessible accObj = (IAccessible)AccessibleObjectFromWindow(checkBoxHandle, OBJID_CLIENT, ref uid);
    object o2 = accObj.get_accState(0);
    if ((int)o2 == UNCHECKED)
    {
        return false;
    }
    else if ((int)o2 == CHECKED)
    {
        return true;
    }
    else
    {
        return null;
    }
}


public static void setCheckBoxChecked(IntPtr checkBoxHandle, bool shouldBeChecked)
{
    bool isChecked = (bool)isCheckBoxChecked(checkBoxHandle);
    if ((!isChecked) && (shouldBeChecked))
    {
        SendMessage(checkBoxHandle, BM_CLICK, 0, null);
    }
    else if ((isChecked) && (!shouldBeChecked))
    {
        const UInt32 OBJID_CLIENT = 0xFFFFFFFC;
        Guid uid = new Guid("618736e0-3c3d-11cf-810c-00aa00389b71");
        IAccessible accObj = (IAccessible)AccessibleObjectFromWindow(checkBoxHandle, OBJID_CLIENT, ref uid);
        accObj.accDoDefaultAction(0);
    }
}

QuestionClass/Object Question Pin
RGVChris18-Dec-08 0:56
RGVChris18-Dec-08 0:56 
AnswerRe: Class/Object Question Pin
Jay Royall18-Dec-08 1:44
Jay Royall18-Dec-08 1:44 
GeneralRe: Class/Object Question Pin
RGVChris18-Dec-08 1:52
RGVChris18-Dec-08 1:52 
GeneralRe: Class/Object Question Pin
Dave Kreskowiak18-Dec-08 3:52
mveDave Kreskowiak18-Dec-08 3:52 
GeneralRe: Class/Object Question Pin
RGVChris18-Dec-08 4:04
RGVChris18-Dec-08 4:04 
GeneralRe: Class/Object Question Pin
Dave Kreskowiak18-Dec-08 4:08
mveDave Kreskowiak18-Dec-08 4:08 
GeneralRe: Class/Object Question Pin
Jay Royall18-Dec-08 4:12
Jay Royall18-Dec-08 4:12 
GeneralRe: Class/Object Question Pin
RGVChris18-Dec-08 4:21
RGVChris18-Dec-08 4:21 
QuestionHow to create consolidate setup for an application built in VB 2005 Pin
kennylal18-Dec-08 0:47
kennylal18-Dec-08 0:47 
AnswerRe: How to create consolidate setup for an application built in VB 2005 Pin
Dave Kreskowiak18-Dec-08 3:45
mveDave Kreskowiak18-Dec-08 3:45 
Questionexplore the folders in vb Pin
phokojoe17-Dec-08 23:26
phokojoe17-Dec-08 23:26 
AnswerRe: explore the folders in vb Pin
Ashfield18-Dec-08 0:05
Ashfield18-Dec-08 0:05 
AnswerRe: explore the folders in vb Pin
LloydA11119-Dec-08 8:34
LloydA11119-Dec-08 8:34 
QuestionHotel reservation Pin
WebMaster17-Dec-08 23:14
WebMaster17-Dec-08 23:14 
QuestionRe: Hotel reservation Pin
Smithers-Jones17-Dec-08 23:32
Smithers-Jones17-Dec-08 23:32 
AnswerRe: Hotel reservation Pin
Jay Royall17-Dec-08 23:46
Jay Royall17-Dec-08 23:46 
AnswerRe: Hotel reservation Pin
Christian Graus17-Dec-08 23:57
protectorChristian Graus17-Dec-08 23:57 

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.