Solved

Bring a VB application to front and activate it

Posted on 2002-03-24
7
223 Views
Last Modified: 2010-05-02
Hi,I have a VB applications which deals with autocad i can make the autocad the activeapplication by using
AppActivate "AutoCAD" but i don't know how to let my vb form active and raised infront of the autocad application when i neeed so.
0
Comment
Question by:nermeen
7 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6892085
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 Sub Command1_Click()
  SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, 3
End Sub
0
 
LVL 6

Expert Comment

by:pierrecampe
ID: 6893517
fortunately in newer windows versions an app can not easily bring itself to the foreground
a workaround is your app 'appactivates' an other app and that other app 'appactivates' your app and quits
to do it directly your app has to attach itself to the input thread of the foreground app (in your case autocad)
there is an api to do that i think it is called something like 'attachthreadinput'
give me some time i'll try to look it up

0
 

Author Comment

by:nermeen
ID: 6895925
Thank u vinnyd79 and pierrecampe for trying to help.
I tried your function vinnyd79 but it didn't work but i
got the same problem the form appears in the taskbar but it is not raised in the front.
As for u pierrecampe I am waiting for your api.
Thanks again for concern.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 6

Accepted Solution

by:
pierrecampe earned 40 total points
ID: 6896139
okay here it is explained by the vb pro himself:

http://www.devx.com/premier/archives/listissue.asp?MagIssueId=170
0
 

Author Comment

by:nermeen
ID: 6909875
Thank u very very much  pierrecampe your answer was more
than excellent for me i am going to increase the questions
points to the double i wish i could increase them more
i don't have many much points thank u very much u did me
a great help.Sorry for the delay in accepting the answer
it i was in avacation thanks again.
0
 

Author Comment

by:nermeen
ID: 6909877
It deserves more than A++++++++++++++++++................
0
 
LVL 4

Expert Comment

by:bhermer
ID: 14934848
This is the problem with posting links, I have exactly the same problem, and the bl***y link is dead, please please please people, post the answer not the link to the answer, this is makin EE unusable
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now