There is an onresize event for forms, you could possibly use that and check whether the size has increased from your original values. You could compare the new form height / width values to the Screen.Height and Screen.Width which would give you the fullscreen values for your current resolution.

hello ziche, I do not know of a function or message in the API that is called or sent when another application is maximized, although you can detect thin in your own application. What I would do is use the API function IsZoomed( ), which will tell you is a top level wimdow is maximized, since there are no events for other apps maximized, I would set up a TTimer with an interval of about 200 milliseconds (5 times a second) and then test the IsZoomed(OtherHandle) and if it is true then you can stop the timer and do something

FindWindow(classname,windowname) - finds the handles using the specified windowname/classname. It is possible to search just using one of those parameters ie...

form1.caption:=inttostr(FindWindow(0,'Untitled - Notepad'));

or alternatively, you can get the one underneath the cursor

myhandle:=WindowFromPoint(Mouse.CursorPos);

Would return the handle to the instance of the untitled document in Notepad. I understand for your uses this isn't particularly useful, because i imagine you would like to enumerate the processes executed on the system. This can also be accomplished.

Firstly download Hyperstring from http://www.mindspring.com/~efd/hyperstr.htm, which contains many useful utilities. There is a function which returns a list of all the currently open windows in there. The following example i've written requires HyperStr and Hyperfrm to be added to the uses clause. Then just stick in a memo. When you run the application, the windows are parsed into a TStringList and query the API as to whether they are maximized or not. If they are, then the result is added to the memo which you will have put onto the form.

OK, what do you know about the program (or it's MAIN Window), that you want to monitor? ?
Is it just ONE program, or do you want to be able to choose a diferent program when YOUR application runs?
Does it always have the same TitleBar title in it's window, or does it change from time to time?
Can this program run more than one at a time? And do you want to monitor all of it's running windows, or just a certain one?
Would you know the file path to this program?

Ill be completely ignorant of the other applications my application will be monitoring and I will also like to monitor all the applications that will be currently running on the system.

Here's more about what I want to do...

I want to create a windowless application that runs in the background. As the user runs other applications, I want my application to do something every time any window of any application covers the screen. This could be a window in Internet Explorer, Word or anything.

So I suppose this means when any form is maximized in an SDI application but only when the Parent form is maximized from an MDI application. But this consideration isn't really that important to begin with.

here is some code for two button clicks, the sbut_GetMaximizeClick button click will do a EnumWindows( ) API function, which will start the EnumFunc( ) to get all top level windows into an Array of TWinMax, and then it will start Timer3. In the Timer3 event it will loop through all window in array and test the IsZoomed. . If the IsMax if false then you can do code for a maximize event. . . . The other button click will just stop the Timer3
This has NO effect for sub MDI forms, only top level (Parent) windows

for i := 0 to High(aryWinRec) do
if IsZoomed(aryWinRec[i].Handle) then
begin
if not aryWinRec[i].IsMax then // this is the Maximize Event
Label10.caption := 'EVENT , '+IntToStr(aryWinRec[i].Handle)+' has JUST Maximized';
// Do Whatever code you need to execute here for a maximize

Featured Post

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

The uses clause is one of those things that just tends to grow and grow.
Most of the time this is in the main form, as it's from this form that all others are called.
If you have a big application (including many forms),
the uses clause in the in…

This article explains how to create forms/units independent of other forms/units object names in a delphi project.
Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…

Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…