🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8934

Re: Righ click on application button and select [Restore,Move,Size,Minimize,Maximize,Close]

#8934
From: zoom
Date: Wed, 18 Aug 2004 12:09
35 lines
2271 bytes
Thank you for your help. Following is the code ;

  HWND hwnd;
   hwnd=FindWindow("Notepad", NULL);
   if (hwnd != 0) {
      ShowMessage("Notepad is running. Get ready!..");
       //SendMessage(hwnd,WM_CLOSE,0,0);
       //SendMessage(hwnd,WM_SYSCOMMAND,SC_MAXIMIZE,0 );
       //SendMessage(hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0 );
       //SendMessage(hwnd,WM_SYSCOMMAND,SC_RESTORE,0 );
      //SendMessage(hwnd,WM_SYSCOMMAND,SC_MOVE,0 );
    SendMessage(hwnd,WM_SYSCOMMAND,SC_SIZE,0 );
   }

"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:412231f8@newsgroups.borland.com...
>
> <zoom> wrote in message news:41220535@newsgroups.borland.com...
>
> > How we can perform  [Restore,Move,Size,Minimize,Maximize,Close]
> > operations on an application defined by name or process ID?
>
> Send WM_SYSCOMMAND messages to the desired window.  You have to find the
> window first, though.  If by "application name" you mean the window title,
> then you can use FindWindow() for that.  As for the process ID, that is a
> bit trickier, particularly since a process can have multiple windows.
You
> will have to use EnumWindows() and GetWindowThreadProcessId() to find all
> windows that belong to a given process ID, and then you can pick your
> desired window from that list of windows as needed.
>
>
> Gambit
>
>
Technical Details
Message-ID: <412346ef@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41220535@newsgroups.borland.com> <412231f8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9acd9493b06d9f0b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: <zoom>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41220535@newsgroups.borland.com> <412231f8@newsgroups.borland.com>
Subject: Re: Righ click on application button and select [Restore,Move,Size,Minimize,Maximize,Close]
Date: Wed, 18 Aug 2004 22:09:19 +1000
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 211.30.68.31
Message-ID: <412346ef@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1092830959 211.30.68.31 (18 Aug 2004 05:09:19 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail