?
Solved

appactivate with minimized or hidden window

Posted on 1999-06-29
4
Medium Priority
?
1,350 Views
Last Modified: 2012-06-21
if the window you're activating isn't minizized or visible, appactivate doesn't work..
How do I solve this (not by shell "app", vbnormalfocus) the app is already running !*in the system tray*!
0
Comment
Question by:Smout
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1520682
From the EE FAQ:

"It is up to you to assign points to the question based on its difficulty. As a guide, a basic question is worth 50 points, an intermediate question 100 points, and an advanced question 200 points. The more points assigned to a question, the more likely it will be answered."

0
 
LVL 2

Accepted Solution

by:
DavidMartin earned 40 total points
ID: 1520683
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const HWND_TOP = 0
Private Const SWP_SHOWWINDOW = &H40

Private Declare Function GetLastError Lib "kernel32" () As Long


Private Sub Command1_Click()

    Dim lHwnd As Long

    lHwnd = FindWindow(vbNullString, "Yahoo! Messenger")
    Debug.Print "FindWindow : " & GetLastError()
   
    SetWindowPos lHwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW
    Debug.Print "SetWindowPos : " & GetLastError()


End Sub

0
 

Author Comment

by:Smout
ID: 1520684
Thank you
only now I see my program minimized
can you send me the constants plz
0
 
LVL 2

Expert Comment

by:DavidMartin
ID: 1520685
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function GetLastError Lib "kernel32" () As Long

Private Const HWND_TOP = 0
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SW_RESTORE = 9



Private Sub Command1_Click()

    Dim lHwnd As Long

    lHwnd = FindWindow(vbNullString, "Yahoo! Messenger")
    Debug.Print "FindWindow : " & GetLastError()
   
    'SetWindowPos lHwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    'Debug.Print "SetWindowPos : " & GetLastError()

    ShowWindow lHwnd, SW_RESTORE
    Debug.Print "ShowWindow : " & GetLastError()


End Sub
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question