Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to check a checkbox inside a program called AviReComp and I'm unable to do it somehow. I've tried all sorts of code:

//Check the checkbox
        IntPtr SubtitlesSection = FindWindowEx(MoreOptions, IntPtr.Zero, null, "Subtitles");
        IntPtr AddSubtitlesCheckbox = FindWindowEx(SubtitlesSection, IntPtr.Zero, null, "Enable/Disable");

        SendMessage(AddSubtitlesCheckbox, BM_SETSTATE, 1, IntPtr.Zero);
        SendMessage(AddSubtitlesCheckbox, BM_SETCHECK, 1, IntPtr.Zero);
        SendMessage(AddSubtitlesCheckbox, WM_PAINT, 0, IntPtr.Zero);
        SendMessage(AddSubtitlesCheckbox, WM_LBUTTONDOWN, 1, MakeLParam(10, 10));
        SendMessage(SubtitlesSection, WM_PARENTNOTIFY, (int)MakeLParam((int)AddSubtitlesCheckbox, WM_LBUTTONDOWN), MakeLParam(26, 31));
        SendMessage(SubtitlesSection, WM_PARENTNOTIFY, (int)MakeLParam((int)AddSubtitlesCheckbox, WM_LBUTTONUP), MakeLParam(26, 31));

The checkbox is located within the Additions tab underneath the Subtitles section and is called Enable/Disable.

Am I doing something wrong?

Thanks for any help!

Edit: I now see that this code actually works and it does check the checkbox but I still have a problem since it does not change all the controls that are supposed to change when I check the checkbox manually and not inside my program. Is there a way to force the parent control to repaint itself or trigger the change event when I mark the checkbox as checked?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
279 views
Welcome To Ask or Share your Answers For Others

1 Answer

try to use spy++ to make sure of the location of the Check-box if all didn't work and this has to run on vista and above I Would use Windows Automation


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...