Help to make a wrapper for IMGUI

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Help to make a wrapper for IMGUI

Post by Noblish » 21 Jul 2021, 10:52

Hello, I use AHK for some years now, I'm not an expert, but I understand many things. I don't know why, no one has ever made a wrapper for IMGGUI, all I found on Google was on a Russian site, someone succeeded. I need someone to explain to me, what functions on Visual Studio, or where the functions are or needed (imgui project), to make the wrapper in AHK. I have an approach, but cant make it work, also below is a screenshot from the guy that I found. If someone could be kind and patient to explain to me, I would really appreciate. It is a project I wanted to make for a long time, and I am willing to do a full wrapper and post it here later on, I mean… imgui is useful and clean, I'm sure many people would want.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

class ImGui
{
    __New(){
        bitness := A_PtrSize == 8 ? "x64" : "x86"
        dllName := "imgui.dll"
        if (A_IsCompiled){
            dllFile := "Lib\" bitness "\" dllName
            FileCreateDir, Lib
            FileInstall, Lib\imgui.dll, Lib\imgui.dll
            if (bitness == "x86"){
                FileCreateDir, Lib\x86
                FileInstall, Lib\x86\imgui.dll, Lib\x86\imgui.dll
            } else {
                FileCreateDir, Lib\x64
                FileInstall, Lib\x64\imgui.dll, Lib\x64\imgui.dll
            }
        } else {
            dllFile := "Lib\" bitness "\" dllName
        }
        if (!FileExist(dllFile)) {
            MsgBox % "Unable to find " dllFile ", exiting...`nYou should extract both x86 and x64 folders from the library folder in interception.zip into AHI's lib folder."
            ExitApp
        }
        
        hModule := DllCall("LoadLibrary", "Str", dllFile, "Ptr")
        if (hModule == 0) {
            this_bitness := A_PtrSize == 8 ? "64-bit" : "32-bit"
            other_bitness := A_PtrSize == 4 ? "64-bit" : "32-bit"
            MsgBox % "Bitness of " dllName " does not match bitness of AHK.`nAHK is " this_bitness ", but " dllName " is " other_bitness "."
            ExitApp
        }
        DllCall("FreeLibrary", "Ptr", hModule)
        
        dllName := "imgui.dll"
        if (A_IsCompiled){
            dllFile := "Lib\" dllName
        } else {
            dllFile := dllName
        }
        hintMessage := "Try right-clicking " dllFile ", select Properties, and if there is an 'Unblock' checkbox, tick it`nAlternatively, running Unblocker.ps1 in the lib folder (ideally as admin) can do this for you."
        if (!FileExist(dllFile)) {
            MsgBox % "Unable to find " dllFile ", exiting..."
            ExitApp
        }
        
        try {
            ; this.Instance := asm.CreateInstance("AutoHotInterception.Manager")
			DllCall("LoadLibrary", "Str", dllFile, "Ptr")
        }
        catch {
            MsgBox % dllName " failed to load`n`n" hintMessage
            ExitApp
        }
        ; if (this.Instance.OkCheck() != "OK") {
        ; 	MsgBox % dllName " loaded but check failed!`n`n" hintMessage
        ; 	ExitApp
        ; }

    }
    
    Initialization(){
        DllCall(this.Funcs.Initialization)   
    }
    
    SetRenderFunc(function){
        if (this.RenderFunc)
            DllCall("Kernel32.dll\GlobalFree", "Uint", this.RenderFunc)
        if (this.RenderFunc := RegisterCallback("function"))
            DllCall(this.Funcs.SetRenderFunc, "Uint", this.RenderFunc)
    }
    
    Begin(name, p_open, flags:= 0){
    return DllCall(this.Funcs.Begin, "Str", name, "UInt", p_open, "Int", flags)
}

End(){
    return DllCall(this.Funcs.End)
}

Text(text){
    return DllCall(this.Funcs.Text, "Str", text)
}   

class System
{
    GetProcAdress(hModule, lpProcName)
    {
        return DllCall("Kernel32.dll\GetProcAdress", "Uint", hModule, "AStr", lpProcName)
    }
}
}

Msgbox, % IsObject(ImGui)
global ImGui := new ImGui()
ImGui.SetRenderFunc("ImGuiRender")
ImGui.Initialization()

ImGuiRender()
{
    static isOpen:= True
    Imgui.Begin("Test", &isOpen)
    ImGui.Text("Test text")
    ImGui.End()
}

Or with CLR?

Image
Last edited by Noblish on 21 Jul 2021, 11:32, edited 1 time in total.

gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: Help to make a wrapper for IMGUI

Post by gregster » 21 Jul 2021, 11:06

Never heard of ImGUI before, but what has AutoHotInterception to do with it (in your second code box) - isn't that a working project (for remapping keys) by our forum member evilC ?
My guess is that a ImGUI wrapper would be a lot more complex, and that you can't just replace a few lines in the AHI wrapper to make it work.

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 21 Jul 2021, 11:31

Hello , thanks for your reply,

yea that autohotkeyinterception was just an example, with imggui we can create cool guis

https://github.com/ocornut/imgui

someone did it for autoit: https://github.com/thedemons/imgui-autoit/

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 22 Jul 2021, 04:44

bump

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: Help to make a wrapper for IMGUI

Post by malcev » 22 Jul 2021, 07:47

You seriously think that somebody will write wrapper for about 2500 lines of autoit code? :)))
You need to learn autoit and then convert this functions to ahk.
As I see it seems not difficult.

Code: Select all

DllCall("LoadLibrary", "Str", "imgui.dll")
hwnd := DllCall("imgui\GUICreate", "wstr", "AHK ImGui", "int", 300, "int", 300, "int", 100, "int", 100, "Cdecl ptr")
winshow ahk_id %hwnd%
loop
{
   DllCall("imgui\BeginFrame", "Cdecl")
   DllCall("imgui\Begin", "wstr", "Another window", "ptr", 0, "int", 0, "Cdecl")
   DllCall("imgui\Text", "wstr", "Hello there..", "Cdecl")
   DllCall("imgui\End", "Cdecl")
   DllCall("imgui\EndFrame", "uint", 0xFF738C99, "Cdecl")
}

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 22 Jul 2021, 09:38

malcev wrote:
22 Jul 2021, 07:47
You seriously think that somebody will write wrapper for about 2500 lines of autoit code? :)))
You need to learn autoit and then convert this functions to ahk.
As I see it seems not difficult.

Hi, it's not about converting the autoit script to ahk, IMGUI is actually C++. It might seem like many functions, I dont need it all, but I know a way to automate it.

Btw your example does not work..

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: Help to make a wrapper for IMGUI

Post by malcev » 22 Jul 2021, 09:44

My example works.
You need download dll with the same bitness as ahk and unblock it.

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 22 Jul 2021, 09:47

malcev wrote:
22 Jul 2021, 09:44
My example works.
You need download dll with the same bitness as ahk and unblock it.
Ohhh gotchaa, hey thank you. It is all I needed, to start.

thedemons
Posts: 3
Joined: 23 Jul 2021, 13:33

Re: Help to make a wrapper for IMGUI

Post by thedemons » 23 Jul 2021, 13:44

malcev wrote:
22 Jul 2021, 07:47
You seriously think that somebody will write wrapper for about 2500 lines of autoit code? :)))
You need to learn autoit and then convert this functions to ahk.
As I see it seems not difficult.
Hello guys, I'm the creator of that imgui-autoit wrapper, just wonder around on the internet and found this topic.
Yes in fact I didn't write that line by line, I wrote a script to convert c++ code to autoit, but it's still a tremendous amount of works and took me like a week to finish.

If you want, I can help you with it, even tho I don't know AutoHotkey, I can give you the source for the imgui.dll and maybe help you write some script that converts the already-written autoit code to AutoHotkey, that would be easier.

SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Help to make a wrapper for IMGUI

Post by SOTE » 23 Jul 2021, 23:35

@Noblish

What exactly are you looking for or what particular advantage is IMGUI giving you, over the present way that AutoHotkey creates GUIs?

I say this, because there are many scripts that expand abilities of AutoHotkey GUIs (like add color buttons) or integrate with JavaScript.

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 24 Jul 2021, 15:12

SOTE wrote:
23 Jul 2021, 23:35
@Noblish

What exactly are you looking for or what particular advantage is IMGUI giving you, over the present way that AutoHotkey creates GUIs?

I say this, because there are many scripts that expand abilities of AutoHotkey GUIs (like add color buttons) or integrate with JavaScript.
IMGUI is more advanced, has different styling options, and it's the perfect GUI to use with big tools like editing software or game creating tools. And many other advanced things. I don't know everything about it, but you can really create creative tools with it. I feel that it would be a game changer for AHK users, since AHK is easy to use, for me, I use AHK at my personal PC and at work, I feel that having an easy GUI, can boost my productivity (my needs). From buttons, sliders, multiple GUIs in some clicks, advanced graphics, it draws with DirectX, so it's direct. If i could have a little help with the community, i would push to make a full wrapper and post it.

User avatar
DuyMinh
Posts: 40
Joined: 05 May 2017, 08:34

Re: Help to make a wrapper for IMGUI

Post by DuyMinh » 24 Jul 2021, 18:23

thedemons wrote:
23 Jul 2021, 13:44
malcev wrote:
22 Jul 2021, 07:47
You seriously think that somebody will write wrapper for about 2500 lines of autoit code? :)))
You need to learn autoit and then convert this functions to ahk.
As I see it seems not difficult.
Hello guys, I'm the creator of that imgui-autoit wrapper, just wonder around on the internet and found this topic.
Yes in fact I didn't write that line by line, I wrote a script to convert c++ code to autoit, but it's still a tremendous amount of works and took me like a week to finish.

If you want, I can help you with it, even tho I don't know AutoHotkey, I can give you the source for the imgui.dll and maybe help you write some script that converts the already-written autoit code to AutoHotkey, that would be easier.
I'm DuyMinh from AutoIt Guru, can you send me source of this dll. I can try to compile and convert it to AutoHotkey...
Btw, tiếng anh của iêm yếu lắm thím à... Thím cho iêm xin cái source dll nhé, iêm sẽ thử convert nó qua AHK cho. Sẵn cho iêm xin cách nào để liên hệ với thím nhé, facebook không thấy thím online.

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: Help to make a wrapper for IMGUI

Post by malcev » 24 Jul 2021, 20:20

what particular advantage is IMGUI giving you, over the present way that AutoHotkey creates GUIs?
I think that it will be easier to inject imgui guis into directx fullscreen games.

thedemons
Posts: 3
Joined: 23 Jul 2021, 13:33

Re: Help to make a wrapper for IMGUI

Post by thedemons » 25 Jul 2021, 01:01

DuyMinh wrote:
24 Jul 2021, 18:23
I'm DuyMinh from AutoIt Guru, can you send me source of this dll. I can try to compile and convert it to AutoHotkey...
Btw, tiếng anh của iêm yếu lắm thím à... Thím cho iêm xin cái source dll nhé, iêm sẽ thử convert nó qua AHK cho. Sẵn cho iêm xin cách nào để liên hệ với thím nhé, facebook không thấy thím online.
Just send me a message on facebook, I can't find you in the group, or just dm me in discord, my tag name is in the imgui-autoit github repository

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 25 Jul 2021, 03:42

thedemons wrote:
23 Jul 2021, 13:44
malcev wrote:
22 Jul 2021, 07:47
You seriously think that somebody will write wrapper for about 2500 lines of autoit code? :)))
You need to learn autoit and then convert this functions to ahk.
As I see it seems not difficult.
Hello guys, I'm the creator of that imgui-autoit wrapper, just wonder around on the internet and found this topic.
Yes in fact I didn't write that line by line, I wrote a script to convert c++ code to autoit, but it's still a tremendous amount of works and took me like a week to finish.

If you want, I can help you with it, even tho I don't know AutoHotkey, I can give you the source for the imgui.dll and maybe help you write some script that converts the already-written autoit code to AutoHotkey, that would be easier.
Hello, thanks for your reply. I really would love if we could help each other here, since I am stuck with some functions

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 25 Jul 2021, 03:44

DuyMinh wrote:
24 Jul 2021, 18:23
thedemons wrote:
23 Jul 2021, 13:44
malcev wrote:
22 Jul 2021, 07:47
You seriously think that somebody will write wrapper for about 2500 lines of autoit code? :)))
You need to learn autoit and then convert this functions to ahk.
As I see it seems not difficult.
Hello guys, I'm the creator of that imgui-autoit wrapper, just wonder around on the internet and found this topic.
Yes in fact I didn't write that line by line, I wrote a script to convert c++ code to autoit, but it's still a tremendous amount of works and took me like a week to finish.

If you want, I can help you with it, even tho I don't know AutoHotkey, I can give you the source for the imgui.dll and maybe help you write some script that converts the already-written autoit code to AutoHotkey, that would be easier.
I'm DuyMinh from AutoIt Guru, can you send me source of this dll. I can try to compile and convert it to AutoHotkey...
Btw, tiếng anh của iêm yếu lắm thím à... Thím cho iêm xin cái source dll nhé, iêm sẽ thử convert nó qua AHK cho. Sẵn cho iêm xin cách nào để liên hệ với thím nhé, facebook không thấy thím online.
https://github.com/thedemons/imgui-autoit

thedemons
Posts: 3
Joined: 23 Jul 2021, 13:33

Re: Help to make a wrapper for IMGUI

Post by thedemons » 25 Jul 2021, 04:40

Noblish wrote:
25 Jul 2021, 03:42
Hello, thanks for your reply. I really would love if we could help each other here, since I am stuck with some functions
Do you have discord? My discord is at the end of the github repos, please contact me

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 25 Jul 2021, 06:08

thedemons wrote:
25 Jul 2021, 04:40
Noblish wrote:
25 Jul 2021, 03:42
Hello, thanks for your reply. I really would love if we could help each other here, since I am stuck with some functions
Do you have discord? My discord is at the end of the github repos, please contact me
Added

Noblish
Posts: 28
Joined: 22 Mar 2020, 06:10

Re: Help to make a wrapper for IMGUI

Post by Noblish » 27 Jul 2021, 11:54

Just wanting to give you all an update, things are working well, it's handling smooth and fast

Image

kazhafeizhale
Posts: 77
Joined: 25 Dec 2018, 10:58

Re: Help to make a wrapper for IMGUI

Post by kazhafeizhale » 16 Aug 2021, 00:39

hi, i am interesting about this, (imgui->ahk),do you have github repository address 8-) ?

Post Reply

Return to “Ask for Help (v1)”