COM.ahk, best version?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 2670
Joined: 19 Dec 2016, 01:58
Location: UK

COM.ahk, best version?

01 Apr 2017, 17:39

Which is the best/most up-to-date version of COM.ahk?

I found 4 versions. Line counts: 555, 572, 625, 633.

==================================================

I tested these with AutoHotkeyU32 v1.1.25.01, and a script which I have posted lower down:

[555 lines (488 sloc) 20.7 KB][works][COM_L.zip (UNICODE)]
COM.AHK/com.ahk at master · ttnnkkrr/COM.AHK · GitHub
https://github.com/ttnnkkrr/COM.AHK/blob/master/com.ahk

[572 lines][runs, but with error message][COM_L.zip (ANSI)]
[worked when I replaced the COM_SysString function]

[625 lines (558 sloc) 26 KB][wouldn't open]
AHKs/COM.ahk at master · camerb/AHKs · GitHub
https://github.com/camerb/AHKs/blob/master/thirdParty/COM.ahk

[633 lines (564 sloc) 25.1 KB][runs, but with error message]
[worked when I replaced the COM_SysString function]
Autohotkey-Scripts/com.ahk at master · dufferzafar/Autohotkey-Scripts · GitHub
https://github.com/dufferzafar/Autohotkey-Scripts/blob/master/lib/com.ahk

Perhaps there is yet another, better version?

Usual text comparisons in WinMerge, and things like checking for new parameters in the function definitions, proved indecisive in determining which was the best version.

==================================================

My quick-fix function:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



==================================================

The code I tested it on:
IE_Add() or COM_AtlAxCreateContainer() or AtlAxWin() - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/32138-ie-add-or-com-atlaxcreatecontainer-or-atlaxwin/#entry204552

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



==================================================

Why I'm interested in COM.ahk.

The script above and COM.ahk give you a way to create a simple GUI with an 'Internet Explorer_Server' control. This is useful for understanding GUIs generally, understanding how AutoHotkey works, creating GUIs in AHK v1 that are not #Persistent (i.e. they do not use the Gui command), and creating GUIs in other programming languages.

I was trying to make a SplashImage replacement that can handle more filetypes like animated gifs and svg files.

Reading through COM.ahk is also a very good way to understand AutoHotkey's native COM. I intend to recommend that for my objects tutorial, however, I need to pick a version first!

jeeswg's objects tutorial (not yet complete) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=29232

==================================================

[EDIT:]
In general, I am in interested in having GUIs that don't use the Gui command, this allows you to have GUIs in script libraries that do not cause a script to become #Persistent (i.e. you would otherwise have to modify the script by changing lines to ExitApp etc, otherwise they would never close, unless closed manually).

[EDIT:]
Some advantages of making GUIs via DllCall only, and not the Gui command, are that they can be simpler to write and maintain, and for example (unless AHK brings in this functionality) allow you to choose a GUI class name, or specify a window with no icon.

==================================================

All roads lead to COM.
COM one, COM all.
TweedleCOM and TweedleRelease.
Will the real COM Query please stand up?
I'm SpartaCOM!
just me
Posts: 4796
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: COM.ahk, best version?

02 Apr 2017, 03:26

jeeswg wrote:Some advantages of making GUIs via DllCall only, and not the Gui command, are that they can be simpler to write and maintain, ...
You know that you have to write your own Window Procedure in this case? Good luck!
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
jeeswg
Posts: 2670
Joined: 19 Dec 2016, 01:58
Location: UK

Re: COM.ahk, best version?

03 May 2017, 16:37

@just me. Yep I did, thanks for the encouragement.

==================================================

So overall, this appears to be the best version:

[555 lines (488 sloc) 20.7 KB][works][COM_L.zip (UNICODE)]
COM.AHK/com.ahk at master · ttnnkkrr/COM.AHK · GitHub
https://github.com/ttnnkkrr/COM.AHK/blob/master/com.ahk

I did some of the necessary conversion, to try and make it x64/x32 compatible, if someone who understands the script/issues better wants to finish it off:

DllCall converter/cleaner (e.g. x32 to x64/x32 two-way compatible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=31365

==================================================

Note: Functions in other versions of COM, not in the '555 lines' version:
COM_Invoke_
COM_ActiveXObject
COM_SysStringLen
COM_Ansi4Unicode
COM_Unicode4Ansi
COM_Ansi2Unicode
COM_Unicode2Ansi

Return to “Ask For Help”

Who is online

Users browsing this forum: gregster and 47 guests