[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Bring a VB application to front and activate it

Posted on 2002-03-24
7
Medium Priority
?
247 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
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.

 
LVL 6

Accepted Solution

by:
pierrecampe earned 160 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

825 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