Link to home
Start Free TrialLog in
Avatar of josmic
josmic

asked on

minimize by caption


rew = FindWindow(vbNullString, "caption txt")
rew = ShowWindow(rew, SW_SHOWMINNOACTIVE)
 
Why wont this minimize the window caption txt?
That what I need?
Avatar of TheAnswerMan
TheAnswerMan

what is "caption txt"
Avatar of josmic

ASKER

the caption of a window to be minimized
What are the declaration used for the API's.
Hi,

I've tested the above code and it appears to work ok for me - however, a couple of suggestions.

1) Have you declared the variable rew in your code?  Start by adding the line 'Dim rew As Long' before the API calls.

2) The declarations for the API calls and constants should be as follows (assuming you're using VB5 or 6):

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Const SW_SHOWMINNOACTIVE = 7

3) Look at the results of the first API call by putting a 'Debug.Print rew' command after it.  You should get a value <> 0; if you don't it can't find the window - probably because the window caption is wrong!!

Hope these tips help - let me know how you get on.

Pete


Avatar of josmic

ASKER

Thanks to all who gave comment

peterwest please answer for points your data helped.

Can I use Findwindow with only partial name of caption,
something like  caption nam*?


ASKER CERTIFIED SOLUTION
Avatar of peterwest
peterwest

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of josmic

ASKER

Thanks peterwest, that was great.