I'm working with a windows hook, and I intercept WM_CREATE for all the windows.
I need to know if a window is going to be visible, I tried using IsWindowVisible(HWND) and checking WS_VISIBLE flag (wich are the same :S) and I always get false, because the window is not yet created.
Do someone knows how can I do to know if the window beign created is going to be visible?
Well if I follow the entire thread correctly it is not what you want since you are now testing that the WS_VISIBLE style is NOT set!
Consider this possible window creation sequence:
A) application code calls CreateWindow passing a style.... say WS_POPUP
B) OS sends a WM_CREATE containing the style
C) your hook recieves this message and the style WS_VISIBLE is not set
D) application code handles the WM_CREATE message and changes the window style to WS_VISIBLE
At this point I am not convinced that I have a complete understanding of the requirements.
I need to get only the applications that appear in the task administrator.
I guess you refer to the "Windows Task Manager" and the list of processes in the "Applications" tab?
If so there is a completely different way to accomplish that rather than using a System hook. There are APIs that allow you to get the list of running processes.
I would think some Google would find articles and sample code to get you much of the way there. There might even be a Code Project Article. The MSDN Documentation[^] on Process Enumeration is a good place to start if you want to figure it out for yourself.
One example approach might be using the GetStartupInfo() API that returns a STARTUPINFO structure. The structure has a member for which the documentation states:
For console processes, this is the title displayed in the title bar if a new console
window is created. If NULL, the name of the executable file is used as the window title
instead. This parameter must be NULL for GUI or console processes that do not create a
new console window.
I have the hook, to know among other things, when a new window is created by a user.
The hook is used for my "single sign on" app, thats why i'm using it.
If that window belongs to an App like the one in task manager "applications" tab
I need to report the opening to a local service.
The problem is for example with the calculator and other apps.
windows title: calcMsgPump
or some crap like that, that's why I want only the visible windows.
The ms_instances array contains pointers to Ball objects
What happens when j = 0;
Ball * const ball = ms_instance;
Does this mean it has no pointers because ms_instance ?
Do you need atleast j = 1 to create a pointer ........ like ms_instance means 1 pointer
.... ms_instance means array of two pointers......... so what does 0 mean?