We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Minimize app

sirbounty
sirbounty asked
on
Medium Priority
622 Views
Last Modified: 2012-08-14
How to programmatically minimze my app/form?
More preferred - verify somehow that the now foreground app is internet explorer...
And if so - sendkeys (Ctrl+D) to the URL?
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
crazycomputers - Thanx - that's great - the points are yours.
But for 'bonus' points - can I alter the last bit a little?

I'm "using" IE  - but it loads under an overlay (www.myie2.com).
It arranges seperate windows in tabbed format, similar to netscape.

Do you know of a way to get that information?

Thanx - increasing to 350 - will increase to 500 if you can get this info for me!
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
Actually, I saw the message box when I clicked on my app in the taskbar... Hmm...
Thanx for all your help!  
I like your profile, btw. :D
You're welcome.  =)  And what specifically about my profile attracts your attention?  ;)

As for the "tabbed format" and such, I'm not sure exactly what you're asking.  Could you describe it better and/or post a screenshot?
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
well, myie2 overlays iexplore.exe - it doesn't replace it.
It's got a great pop up killer and it allows you to run your browser in one instance, instead of multiple instances for each page you load.
For instance, if I load 2 IE pages - there will be two items in my task bar.
But myie2 only loads one instance and I can have 20 windows open - they're just 'tabbed' - much like VB's tab control...

Okay, well - perhaps you can walk me through your code...
I'm self-teaching myself VB, but have a long way to go apparently... would you mind walking me through these?

>>Public Declare Function GetForegroundWindow Lib "user32" () As Long<<
>>Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long<<

>>    Dim sClass As String * 50<< 'why * 50?

>>     fWnd = GetForegroundWindow ' I take it that this uses user32 to find out what the foreground window is - but how?

>>    GetClassName fWnd, sClass, 50<< ??

>>    IsIEActive = (Left(sClass, 8) = "IEFrame" & vbNullChar) << ' guess I'll understand this when I understand why sclass (string?) is multiplied by 50...  Is "IEFrame" related to IE somehow?

Thanx.

Can you send an email to me on the other?  I like to keep personal items out of the threads...  Thanx. :D
Public Declare Function GetForegroundWindow Lib "user32" () As Long
' Imports the GetForegroundWindow API function.  It returns a
' handle to the foreground window.

Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
' Imports the GetClassNameA API function.  Given a window handle,
' a string, and the string's length, it fills the string with the window
' class of the window represented by the handle.

' Note that GetClassNameA is aliased to GetClassName in the VB code.

Dim sClass As String * 50
' * 50 declares a string to be a 50-character fixed-length string.  We
' need to pre-allocate space for GetClassNameA to fill.

GetClassName fWnd, sClass, 50
' Fills sClass with the window class, up to 50 characters.

IsIEActive = (Left(sClass, 8) = "IEFrame" & vbNullChar)
' Let's break this down:

' Left(sClass, 8) returns the left-most 8 characters of sClass.  "IEFrame"
' is 7, plus one null character to ensure that it's not "IEFrame2" or
' something else like that.

' "IEFrame" & vbNullChar is the 8-character string we want to compare
' to the left eight characters of sClass.  We can't directly compare
' because sClass is 50 characters (it's fixed-length).

' IsIEActive = ... sets the return value.
> I'm "using" IE  - but it loads under an overlay (www.myie2.com).
> It arranges seperate windows in tabbed format, similar to netscape.

> Do you know of a way to get that information?

Get what information?
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
Well, how do you know that sClass will be "IEFrame"?  Is that something that's within IE?
I mean - if I wanted to check that Outlook was the foreground, how would I alter this (for example), or for Word, Excel - whatever?

Thanx so much for your help.  You're really good at this! :D
> Well, how do you know that sClass will be "IEFrame"?

I didn't before you posted this.  =)

All you do is after "GetClassName fWnd, sClass, 50" just do something like "Debug.Print sClass" or "MsgBox sClass" and look at what it is.  Of course, the program you're targetting must be the foreground window when the code is executed.  (Timers are useful here.)

> Thanx so much for your help.  You're really good at this! :D

I'm just an information sponge.  ;)
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
Thank you very much for your help Mr. information sponge...
Wish I was younger, my sponge is slowly shrinking... :D
You're welcome.  =)  Let me know if you need any more help with VB.
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
What times are you normally online?
Pretty much random.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.