Page 1 of 1

Posted: Sat Aug 03, 2002 10:59 am
by BackupUser
Restored from previous forum. Originally posted by PB.

I'm trying to use the ShowWindow API to maximize an Outlook Express "new mail"
window, but it fails on the first call. Subsequent calls work fine. A check
of the Win32hlp file confirms that "this parameter is ignored the first time an
application calls ShowWindow" ("parameter" being #SW_MAXIMIZE).

Basically, I need to somehow send a "dummy" ShowWindow call to the target first,
then another to make it actually maximize. But whatever I try doesn't work.

Here's a code snippet if you can help...

Code: Select all

r=FindWindow_(0,"New Message") ; Watch for new Outlook Express email.
If r0 And IsZoomed_(r)=#FALSE
  ShowWindow_(r,#SW_MAXIMIZE) ; Doesn't work on *first* call!
EndIf

PB - Registered PureBasic Coder

Posted: Sat Aug 03, 2002 11:10 am
by BackupUser
Restored from previous forum. Originally posted by freak.

Tested your ship with Notepad, and it just worked fine.

Are you sure, your Window is calles 'New Message' ? Maybe it's called
something like 'Outlook Express - New Message'.

Timo

--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.

Posted: Sat Aug 03, 2002 11:28 am
by BackupUser
Restored from previous forum. Originally posted by PB.

> Are you sure, your Window is calles 'New Message' ?

Yep -- it works with subsequent calls to the window, but not with the first.

> Tested your ship with Notepad, and it just worked fine.

True -- but it doesn't with Outlook Express. To quote the Win32hlp file in full:

nCmdShow -- Specifies how the window is to be shown. This parameter is ignored
the first time an application calls ShowWindow, if the program that launched the
application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow
is called, the value should be the value obtained by the WinMain function in its
nCmdShow parameter.


So... it would appear that when Outlook Express is first launched, and the
first "New Message" window appears, that a STARTUPINFO structure is being
provided, hence why ShowWindow fails. I need some way of bypassing this.


PB - Registered PureBasic Coder

Edited by - PB on 03 August 2002 12:31:08

Posted: Sat Aug 03, 2002 12:43 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

Ok, I had a look at the Platform SDK, and it looks like you need
to get the STARTUPINFO Structure from Outlook.
This doesn't seem to be possible, becourse it says, that this is
only possible for the Thread that created the Window.

There's a Function, designed to Show Windows from other Apps, maybe this works

it's called ShowWindowAsync_() and works exactly the same as ShowWindow_().

Can't test that, becourse i don't have Outlook installed, sorry.

That's it, hope it helped...

Timo

--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.

Posted: Sat Aug 03, 2002 4:29 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> ShowWindowAsync_()

Yep, already tried that too -- sorry I forgot to mention this before.

The thing is, when the "New Message" first opens (and fails to maximize), if I give
the focus to another window, and then give it back to the message one, it maximizes;
so it appears I should probably give the focus to an "invisible" window for a
moment to achieve the goal (or something like that). Stupid, eh?


PB - Registered PureBasic Coder

Edited by - PB on 03 August 2002 17:59:36

Posted: Sat Aug 03, 2002 6:55 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

> Stupid, eh?

Yep, that really sounds stupid.

Sorry, but i can't help you, since i don't have Outlook, so i can do no testing.
Good luck ...

Timo

--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.