Adding controls to an existing window
-
I am writing a plugin for an existing application, which allows me to create a tool window and provides standard controls from their own SDK to use on the tool window. The problem is thier sdk is inssuficient and lacks many standard things such as a main menu and context menu etc,so I like to use Windows API controls on this tool, but I dont have access to this window's WndProc function. All the callbacks are handled internally by the main application which is seemingly hidden. I am able to find the Hwnd for this tool window using a spy tool. How would I go about adding my own Winapi controls on this window and how would I catch the messages sent by the controls without having access to the WndProc() or the Main() function of the application? If I initiate a seperate WndProc function, it will conflict with the main application and crashes it. There are several overload function for the tool window which the application provides. These inculde the OnPaint() and OnIdle() functions. I was able to do some basic things like painting a rect onto this window so I know I am accessing it correctly. Any help would be much appreciated. Frank
-
I am writing a plugin for an existing application, which allows me to create a tool window and provides standard controls from their own SDK to use on the tool window. The problem is thier sdk is inssuficient and lacks many standard things such as a main menu and context menu etc,so I like to use Windows API controls on this tool, but I dont have access to this window's WndProc function. All the callbacks are handled internally by the main application which is seemingly hidden. I am able to find the Hwnd for this tool window using a spy tool. How would I go about adding my own Winapi controls on this window and how would I catch the messages sent by the controls without having access to the WndProc() or the Main() function of the application? If I initiate a seperate WndProc function, it will conflict with the main application and crashes it. There are several overload function for the tool window which the application provides. These inculde the OnPaint() and OnIdle() functions. I was able to do some basic things like painting a rect onto this window so I know I am accessing it correctly. Any help would be much appreciated. Frank
Well, if you are able to access the HWND, you can use GetWindowLongPtr[^], SetWindowLongPtr[^], and CallWindowProc[^]. GetWindowLongPtr will get you the address of the funcion, then you can set it to the custom procedure, which can then call the old procedure.
-
I am writing a plugin for an existing application, which allows me to create a tool window and provides standard controls from their own SDK to use on the tool window. The problem is thier sdk is inssuficient and lacks many standard things such as a main menu and context menu etc,so I like to use Windows API controls on this tool, but I dont have access to this window's WndProc function. All the callbacks are handled internally by the main application which is seemingly hidden. I am able to find the Hwnd for this tool window using a spy tool. How would I go about adding my own Winapi controls on this window and how would I catch the messages sent by the controls without having access to the WndProc() or the Main() function of the application? If I initiate a seperate WndProc function, it will conflict with the main application and crashes it. There are several overload function for the tool window which the application provides. These inculde the OnPaint() and OnIdle() functions. I was able to do some basic things like painting a rect onto this window so I know I am accessing it correctly. Any help would be much appreciated. Frank
-
Well, if you are able to access the HWND, you can use GetWindowLongPtr[^], SetWindowLongPtr[^], and CallWindowProc[^]. GetWindowLongPtr will get you the address of the funcion, then you can set it to the custom procedure, which can then call the old procedure.