[COM] How to enumerate IEnumNetworkConnections in a more "native" way?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
DataLife
Posts: 460
Joined: 29 Sep 2013, 19:52

Re: [COM] How to enumerate IEnumNetworkConnections in a more "native" way?

12 Jun 2018, 07:36

Flipeador wrote:Would not it be better to send several test files compressed in ZIP?.
I recommend using AHK Unicode and always save your scripts in UTF-8 with BOM, that is the solution. I do not think CP0 (Ansi) is correct, the string is UTF-16 (Unicode). That is the reason why only one letter is displayed.
I have been sending zip files.
I did save at UTF-8 BOM and compile with the Autohotkey Unicode 32 bit version.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
DataLife
Posts: 460
Joined: 29 Sep 2013, 19:52

Re: [COM] How to enumerate IEnumNetworkConnections in a more "native" way?

12 Jun 2018, 07:46

just me wrote:
Flipeador wrote:I do not think CP0 (Ansi) is correct, the string is UTF-16 (Unicode).
It should be Unicode, but what is shown for the user in Sweden doesn't look like reasonable Unicode. One option would be ANSI. Otherwise it might be an arbitrary number read as Unicode.

BTW: More than 2700 different network connections! How did your user do that?
I also was shocked at the 2700 different network connections. I have not asked but he has mentioned traveling alot. I will ask if he thinks that might be accurate. I can sort the list and remove duplicates and see how many are shown. There should not be any duplicates but if it is a display issue then sorting before displaying should not change the 2700 count. If it does eliminate duplicates then is it a problem with retrieving the correct names and not a display issue?

I haven't sent the code to the user in Sweden that displays only 1 letter on each line because I do not know how to interpret his results. What am I expecting? Am I expecting 1 readable letter per line? If so what does that tell me? If the results are 1 unreadable letter per line what does that tell me?

As a recap, here is what ansi and unicode look like. Even saving as UTF-8 Bom does not change the way it looks when saving as Unicode.
I install Ansi Autohotkey and compile and a user in Sweden gets this...notice the ?? network names.
https://www.dropbox.com/s/jm8500soxijw7ks/Ansi.PNG?dl=0

When install Unicode Autohotkey and compile the user in Sweden gets this...
https://www.dropbox.com/s/806qj9j9uqj7g ... e.PNG?dl=0
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: [COM] How to enumerate IEnumNetworkConnections in a more "native" way?

12 Jun 2018, 08:36

- Maybe the Unicode version is returning the correct data. But that for whatever reason, some of the information stored is gibberish. Which will come out as either question marks in ANSI, or random characters in Unicode.
- The best thing to do would be to scroll to the bottom of both lists, or to the exact same point in both lists, where some valid names appear, and see if they correspond. (You could add in line numbers to make this easier.)
- If you have examples known to be at the same point in the list, where the ANSI version does *not* begin with question marks, we could compare it to Unicode version, by seeing if the ANSI characters converted to Unicode, match the Unicode version.
- Also, do the names for the currently available networks appear correctly?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
just me
Posts: 9482
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [COM] How to enumerate IEnumNetworkConnections in a more "native" way?

12 Jun 2018, 08:39

On AHK ANSI, ? is the replacement character for each Unicode character which isn't available in ANSI. On AHK Unicode, almost every combination of two bytes will show 'some' character.

If the network connection names are stored as Unicode, StrGet(pNetworkName, "CP0") will get exactly one character for characters within the ASCII range, because the second byte of the string is NULL. In case of your Swedish user, it might retrieve some more characters which might result in a readable string, or not. It's only a test.

Edit: Hi jeeswg, I missed your answer.
User avatar
DataLife
Posts: 460
Joined: 29 Sep 2013, 19:52

Re: [COM] How to enumerate IEnumNetworkConnections in a more "native" way?

12 Jun 2018, 22:45

jeeswg wrote:- Maybe the Unicode version is returning the correct data. But that for whatever reason, some of the information stored is gibberish. Which will come out as either question marks in ANSI, or random characters in Unicode.
- The best thing to do would be to scroll to the bottom of both lists, or to the exact same point in both lists, where some valid names appear, and see if they correspond. (You could add in line numbers to make this easier.)
- If you have examples known to be at the same point in the list, where the ANSI version does *not* begin with question marks, we could compare it to Unicode version, by seeing if the ANSI characters converted to Unicode, match the Unicode version.
- Also, do the names for the currently available networks appear correctly?
Yes, I think your are right Ansi is ??? and Unicode is gibberish.

I think this is what your are asking for...Haymarket_Guest_Wifi is on the same line and the same on both.
Ansi
https://www.dropbox.com/s/bi3s1vj319t9q ... i.png?dl=0
Unicode
https://www.dropbox.com/s/4a3n8a2advy62 ... e.png?dl=0

You asked "Also, do the names for the currently available networks appear correctly?"
What method would I retrieve the currently available networks? Netsh wlan export profile ?

I can export the wireless connections via netsh to a text file, then read the text file and display in a message box.
I will do this and see how it displays.

thanks
Robert
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
DataLife
Posts: 460
Joined: 29 Sep 2013, 19:52

Re: [COM] How to enumerate IEnumNetworkConnections in a more "native" way?

13 Jun 2018, 11:04

Concerning network names with Ansi are ??? and Unicode are gibberish. Please see my post here explaining Korean characters....https://autohotkey.com/boards/viewtopic ... 42#p223742
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aqualest and 326 guests