how to Get Current Window?
Posted: Thu May 25, 2006 1:07 pm
Hello!
since PB4, you have to place the Window parameter in the WindowID() function. In PB3.94, I was able to determine the current window using WindowID() without parameters.
However, I am making a custom gadget library and I thought it would be "handier" if the user doesn't need to supply the hWnd.
I am using Win32 API calls, like CreateWindowEx_() and so on.
Let's assume this is my current code:
It would be better if it would look like this, wouldn't it?
The GetCurrentWindow() function should return the hWnd of the calling window. (For example, window #0 calls MyCustomGadget(), the procedure calls GetCurrentWindow() and the result is equal to WindowID(0))
I am asking how to achieve this, as I am sure there's a workaround, but I did not stumble in it yet.
Thanks! Any help is appreciated!
since PB4, you have to place the Window parameter in the WindowID() function. In PB3.94, I was able to determine the current window using WindowID() without parameters.
However, I am making a custom gadget library and I thought it would be "handier" if the user doesn't need to supply the hWnd.
I am using Win32 API calls, like CreateWindowEx_() and so on.
Let's assume this is my current code:
Code: Select all
Procedure MyCustomGadget(Window, x, y, Width, Height)
CreateCustomGadget(WindowID(Window), x, y, Width, Height)
EndProcedureCode: Select all
Procedure MyCustomGadget(x, y, Width, Height)
Window=GetCurrentWindow()
CreateCustomGadget(Window, x, y, Width, Height)
EndProcedureI am asking how to achieve this, as I am sure there's a workaround, but I did not stumble in it yet.
Thanks! Any help is appreciated!