Solved

Bring a VB application to front and activate it

Posted on 2002-03-24
7
226 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

23 Experts available now in Live!

Get 1:1 Help Now