Load A ImageList in a second Script

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
emmanuel d
Posts: 90
Joined: 17 Nov 2013, 04:45

Load A ImageList in a second Script

Post by emmanuel d » 22 Sep 2023, 09:09

I am making a Imagelist In the first script, and put some icons in it.
Then i want to pass it to a second compiled script(exe).
He will load a bunch of icons, that i then want to use in the 1st script.
sure my problem probably are pointers or varref or something :?

The Caller:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance force   
#Warn All
Msgbox(ImageListID := IL_Create(10, 10,1))
Loop 10  ; Load the ImageList with some standard system icons.
    IL_Add(ImageListID, "shell32.dll", A_Index)
Run('"E:\Documents\My_Programing\AHK\IL Test External fill.exe" ' ImageListID)
The receiver:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance force   
#Warn All
if A_Args.Length {
  Msgbox("Handle passed: " A_Args[1])
  ImageListID := A_Args[1]
  }
Msgbox DllCall("ComCtl32.dll\ImageList_GetImageCount", "Ptr", ImageListID, "Int")
Loop 10  ; Load the ImageList with some standard system icons.
    Msgbox(IL_Add(ImageListID, "shell32.dll", 10+A_Index))
Anybody some clues

teadrinker
Posts: 4412
Joined: 29 Mar 2015, 09:41
Contact:

Re: Load A ImageList in a second Script

Post by teadrinker » 22 Sep 2023, 11:58

ImageListID is a handle, it cannot be passed to another process, it has no meaning there.

User avatar
emmanuel d
Posts: 90
Joined: 17 Nov 2013, 04:45

Re: Load A ImageList in a second Script

Post by emmanuel d » 23 Sep 2023, 12:33

That makes no sense to me, we use handles of other things for different scripts all the time. :shock:
you can change all kind of content of other controls that dont belong to the script. :eh:
So if it is just a handle, we should be capable of using it :think:

teadrinker
Posts: 4412
Joined: 29 Mar 2015, 09:41
Contact:

Re: Load A ImageList in a second Script

Post by teadrinker » 24 Sep 2023, 01:10

Image list handles are specific to a single process and cannot be shared across processes.

User avatar
emmanuel d
Posts: 90
Joined: 17 Nov 2013, 04:45

Re: Load A ImageList in a second Script

Post by emmanuel d » 10 Oct 2023, 10:36

thx
to bad :cry:

Post Reply

Return to “Ask for Help (v2)”