Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to restore another application from Minimize State to a previous Window size (Maximize or Previous)?

114 views
Skip to first unread message

Timofey Shor

unread,
Jul 14, 2003, 7:50:17 AM7/14/03
to
Good mornign everybody.
I got a question on how to find out that a particular application is running
and when it is minimized how to restore it to the previous window size
(Maximized or Restore).

Thank you for your help.


Tim Shor


Jason Berkan

unread,
Jul 14, 2003, 6:52:33 PM7/14/03
to
On Mon, 14 Jul 2003 07:50:17 -0400, "Timofey Shor"
<kazac...@yahoo.com> wrote:
>Good mornign everybody.
>I got a question on how to find out that a particular application is running
>and when it is minimized how to restore it to the previous window size
>(Maximized or Restore).

Through liberal use of the Windows API.

1. Prototype the following API functions in your global map.

EnumWindowsProc(ULONG,LONG),BYTE,PASCAL,TYPE
EnumWindows(EnumWindowsProc,LONG),BYTE,PASCAL,PROC
GetWindowText(ULONG,ULONG,ULONG),LONG,PASCAL,NAME(''GetWindowTextA''),PROC
ShowWindow(ULONG,ULONG),BYTE,PASCAL,PROC
IsIconic(ULONG),BYTE,PASCAL
SetForegroundWindow(ULONG),BYTE,PASCAL,PROC

2. Write the EnumWindowsProc procedure. This must be a source
procedure that matches the prototype listed above. Call the two
parameters pHandle and pParam.

The procedure should be as follows:

DATA
SW_RESTORE EQUATE(9)
WindowName CSTRING(101)

CODE
GetWindowText(pHandle, ADDRESS(WindowName), SIZE(WindowName)
IF MATCH(WindowName, 'Text of Window',MATCH:Wild+MATCH:Case)
IF IsIconic(pHandle)
ShowWindow(pHandle, SW_RESTORE)
ELSE
SetForegroundWindow(pHandle)
END
RETURN False
END
RETURN True

3. Issue the following line whenever you want to find the window whose
name is 'Text of Window' and restore it.

EnumWindows(EnumWindowsProc, 0)

If you want to get even fancier, you can populate a CSTRING with the
name to search for, and pass its address as the second parameter to
EnumWindows. It will then get passed to EnumWindowsProc as the pParam
parameter.

Jason

Geoff Spillane

unread,
Jul 14, 2003, 8:29:48 PM7/14/03
to
Hi Tim,

The ABCFree templates will do want you want. Specifically the "Misc:
One Application Instance" Global template will determine if the
application is already running, and the "API: Enumerate Windows and
Child Windows" Global template will restore the existing application
to its previous state and give it focus. The ABCFree templates are
available at:
http://www.authord.com/Clarion/

Best Regards,
Geoff Spillane

On Mon, 14 Jul 2003 07:50:17 -0400, "Timofey Shor"
<kazac...@yahoo.com> wrote:

Timofey Shor

unread,
Jul 15, 2003, 12:35:41 PM7/15/03
to
Hey, Jason.

Thank you for your help.
It worked perfectly in Clarion.
I will try to do the same thing in a C++ and VB6 applications that I have,
those apps will be bringing the Clarion app forward or Restore its window.

Thanks again.
Have a great day.

Tim Shor

"Jason Berkan" <jason_...@canada.com> wrote in message
news:3f133403...@news.softvelocity.com...

Juan Véliz

unread,
Jul 16, 2003, 4:29:35 PM7/16/03
to
Hello, today I heard about Clarion, and I began to search about it and I
find this newsgroup.

I want to know something.

In Clarion for DOS

Can you link with a C++ obj to use objs functions

Thanks


Jason Berkan

unread,
Jul 16, 2003, 4:33:41 PM7/16/03
to
On Wed, 16 Jul 2003 16:29:35 -0400, "Juan Véliz" <mat...@mixmail.com>
wrote:

Yes, if you can export the C++ functions as C functions (extern "C").
Note that this means you cannot directly access a C++ object.

Linking a C module to Clarion is not simple - there is an entire
appendix in the CPD 2.1 Language Reference describing the process.

It is much simpler in Clarion for Windows, provided the C++ code is
compiled into a DLL.

Jason

0 new messages