I hope you can help here. I created a program which 'hooks' into an external programs window win32 messages and adds a couple of buttons.
To do this i detect and intercept the programs WM_WINPOSCHANGED message. When i intercept this message i check if the window being opened is the one i want to add the buttons to (using the window title) and i add my button to the screen. However this has caused a couple of problems.
I have found out that there are a couple of windows with the same window title (i.e. "customers") that do totally different things, and so to distinguish between the different windows i decided to look for a field on the screen which was unique to that screen, i.e. a field with the text "contacts".
So when i intercept the WM_WINPOSCHANGED from the window with the title "customers" i set up an EnumChildProc of its windows and iterate through the windows to see if a window with the text "contacts" is present. if so than i will want to add the button.
however the is when the WM_WINPOSCHANGED message is sent for the window "customers" all of the child windows have not been added to the screen. so when i iterate through using the EmunChildProc i don't iterate through all the windows, and so cannot check the text in the field.
(this also adds the problem of the buttons not being added to the top the screen, but this can be solved using BringWindoToTop()).
Now, would it be possible to detect the WM_WINPOSCHANGED message and somehow put a hold (using a timer or something) executing my check and add button code until all the windows have been added?
(Could i perhaps intercept the WM_WINPOSCHANGED message wait and then post my own user message which would add the buttons? how would i do this?)