Solved

Bring a VB application to front and activate it

Posted on 2002-03-24
7
241 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
[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
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

691 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