John Wick1
John Wick1

Reputation: 65

Checking if window of specific application is in minimized state?

Hey guys i am trying to write a program in c++ which can check if an application suppose powerpoint or word is running in minimized form or window is opened... I am new to this concept of windows programming please help....

I have taken a code from @Max keilland...

TCHAR WndCaption[100];
TCHAR NewCaption[] = TEXT("My Window handle is valid");
BOOL res;

GetWindowText(MyHWND,WndCaption,100);
SetWindowText(MyHWND,NewCaption);

// This works correctly.
res = IsWindowVisible(MyHWND);
if(!res) {
   // This always fail
   OpenIcon(MyHWND);
}

where should i pass my name of application to check if that is in minimized state or not.....

PS: it also shows MyHWND not found???? Please can you give me an idea...

Upvotes: 1

Views: 321

Answers (1)

P.W
P.W

Reputation: 26800

You can use the IsIconic function.

The documentation states:

BOOL IsIconic(
  HWND hWnd
);

Determines whether the specified window is minimized (iconic).

Return Value Type: Type: BOOL

If the window is iconic, the return value is nonzero.

If the window is not iconic, the return value is zero.

Upvotes: 1

Related Questions