Again a question...
How do i get the handle of the main window
of the process that just called one of my own DLL function?
without requiring it to be a parameter on my own DLL function.
How do i get the handle of the main window
of the process that just called one of my own DLL function?
without requiring it to be a parameter on my own DLL function.
GetActiveWindow does what you want I think.
Again a question...
How do i get the handle of the main window
of the process that just called one of my own DLL function?
without requiring it to be a parameter on my own DLL function.
Look into this thread.
You might need to pass the process ID of the calling process to the DLL and do EnumWindows with GetWindowThreadProcessId in EnumWindowsProc. Just compare the PIDs until you find the correct one and return the HWND.
For whom might intrest:
GetForegroundWindow() worked ... even if i first thought it will not :(
Thanks bazik ... i was going to do what you suggested but because it was more complicated i give the above function one last chance and it worked... however GetActiveWindow is not working. Good to know.
GetForegroundWindow() worked ... even if i first thought it will not :(
Thanks bazik ... i was going to do what you suggested but because it was more complicated i give the above function one last chance and it worked... however GetActiveWindow is not working. Good to know.
Erm... and what happens, pray tell, if the window that called your DLL happens to not be in the foreground? ;)
I think Bazik's solution is the safest bet.
I think Bazik's solution is the safest bet.