Jump to content
Sign in to follow this  

Incoming Connections dialog, syslistview32, impossible to script

Recommended Posts


It seems impossible to have autoit set/clear the checkbox for the modem in the dialog for Incoming Connections Properties.


The modem is listed in an entry of a SysListView32 control. In old postings (2006) I find remarks that the SysListView32 is different and much more difficult to script than the ListView32.

This posting, though, mentions also solutions as the Auto3Lib UDF, which is now incorporated into AutoIT. Even sample source code as in patch_maker_uts.au3.

I tried everything (please find commented code below), but I still wonder if I did something wrong and that someone could help me making this work.

;#include <A3LListView.au3>   ; cannot be found
#include <GUIListView.au3>  ; successor of Auto3Lib

$wt="Incoming Connections Properties" ;window title
$cid="[CLASS:SysListView32; INSTANCE:1]" ;control ID of list box

; obtaining the handle of a window; usage: instead of window title with empty window text
$hwnd=WinActivate($wt, "")
;MsgBox(0, "msg", "hwnd="&$hwnd) ;hwnd=0x00000F04C2 --> nonzero --> OK

; moving the window should be easy, an unsupported control should not matter
; initial window position is (70, 114)
WinMove($hwnd, "", 20, 20) ;--> no movement --> WRONG

; obtaining the handle of a control is easy, but how do you use this handle?????
;$hctl=ControlGetHandle($wt, "", $cid) ;--> 0x00001C052C --> nonzero --> OK
$hctl=ControlGetHandle($wt, "", "SysListView321")   ;see patch_maker_uts.au3  ;-->OK
;MsgBox(0, "msg", "lv handle=" & $hctl)

; trying to find out how many entries are in the listview
;$n= _ListView_GetItemCount($hctl)   ; error: unknown function name
;$n=ControlListView($hctl, "GetItemCount") ; error: Incorrect nr of parameters
$n=ControlListView($hwnd, "", "SysListView321", "GetItemCount") ;see patch_maker_uts.au3; -->items=0 WRONG
;$n=_GUICtrlListView_GetItemCount($hctl) ;--> items=0 --> cannot find items --> WRONG
;MsgBox(0, "msg", "items=" & $n)

; trying to (un)check the first item in the list (NB: my list has 1 entry)
;_ListView_SetItemChecked($h, 0, True)   ; error: unknown function name
_GUICtrlListView_SetItemChecked($hctl, 0, True) ; no check mark appearing

In summary: I can approach the window and the control to obtain valid handles, but cannot move the window, find the number of entries in the list, set or clear the checkbox, or even press the Properties button. I even tried MouseClick with the absolute screen coordinates.

If Microsoft made this window and control so much non-standard, there might as well be a good reason. Perhaps it is out of fear of malware sending spam if it is able to surreptitiously turn on the modem. This might also explain why this window is so hard to find: search in the control panel for "network", open View All Connections, then File/Properties.

The reason for wanting to automate this check box is a standalone (embedded) application for process control, that sometimes detects an error or alarm that needs to be send to a remote control room using a modem and telephone line, but that the rest of the time can be dialed into from the control room. The check box must be cleared before dialing out, and set when the dial out call finishes, to avoid a conflict between Incoming Connections and Dial-Out over the same modem.

Admittedly the exact scenario of malware, but this is a serious application.

Any feedback that shines some light on this issue is extremely appreciated.

Share this post

Link to post
Share on other sites

Have you tried to search for a registry solution?

I bet you can disable the setting in the registry.

Maybe netsh can do it, too.



Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

Link to post
Share on other sites

I indeed found a registry setting:


but it does not always control that checkmark.

I indeed searched for netsh commands, and C++ programming examples.

But if I guessed right that MS deliberately obstructs this kind of automation, this might be the reason that those methods do not yield a solution.

And if (*IF*) my autoit code is correct, this checkmark and/or dialog is so much special that automation cannot be done.

Anyone sees another AutoIT solution?

Share this post

Link to post
Share on other sites

I'm also looking for the same solution, please someone can help???

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.