As far as I know, DLL can be launched using attached/detach process or thread.
Is it possible for attached DLL, to wait for an Executable window, then after that, generates "Hello World" Message?

No !Maya wrote:Good evening All,
As far as I know, DLL can be launched using attached/detach process or thread.
What does this executable completely load in memory ?Maya wrote:Is it possible for attached DLL, to wait for an Executable until it completely loaded in memory, then after that only, it generates "Hello World" Message?
Code: Select all
ProcedureDLL AttachProcess(Instance)
MessageRequester("", "Attach")
EndProcedure
Hi,wombats wrote: Fri Dec 29, 2023 5:44 amThat pops up the message requester when I open the library.Code: Select all
ProcedureDLL AttachProcess(Instance) MessageRequester("", "Attach") EndProcedure
You could create a thread in attach, wait for the required objects to be there (Window) and execute it then. However the better way would be to have some init function called from inside the main executable.Maya wrote: Fri Dec 29, 2023 1:07 pmHi,wombats wrote: Fri Dec 29, 2023 5:44 amThat pops up the message requester when I open the library.Code: Select all
ProcedureDLL AttachProcess(Instance) MessageRequester("", "Attach") EndProcedure
"AttachProcess" pops up the Message, then it disappeared, then after, the main window appears, which is not the required sequence.
You are right, the solution in the 'Threads', but unfortunately, I have no idea about it.DarkDragon wrote: Fri Dec 29, 2023 4:09 pmYou could create a thread in attach, wait for the required objects to be there (Window) and execute it then. However the better way would be to have some init function called from inside the main executable.Maya wrote: Fri Dec 29, 2023 1:07 pmHi,wombats wrote: Fri Dec 29, 2023 5:44 amThat pops up the message requester when I open the library.Code: Select all
ProcedureDLL AttachProcess(Instance) MessageRequester("", "Attach") EndProcedure
"AttachProcess" pops up the Message, then it disappeared, then after, the main window appears, which is not the required sequence.
I wish I can do this by the DLL itself.
Code: Select all
; blabla
; code before the executable wants to tell the DLL.
tellTheDLL()
; code after the executable have told the DLL
Code: Select all
ProcedureDLL tarteAuxPoireaux()
EndProcedure
ProcedureDLL tellTheDLL()
MessageRequester("Uh?", "The DLL received a call from the executable, by simply executing this procedure.")
EndProcedure
Use SetWinEventHook from AttachProcess and track the creation of windowsMaya wrote: Thu Dec 28, 2023 7:30 pm Is it possible for attached DLL, to wait for an Executable window, then after that, generates "Hello World" Message?
Code: Select all
hCBTHook = SetWindowsHookEx_(#WH_CBT,@CBTProc(),#Null,GetCurrentThreadId_())