Code Red > VB(A)

Activate new window

(1/6) > >>

Keith™:
Ok, anyone out there familiar with API please help....
I am in need of making the AutoCAD current drawing the current window AFTER I specify a new application window as HWND_TOPMOST.

Here is the scenario....
I am developing an external app that runs in windows alongside of AutoCAD. I need this app to stay on top so that the user can change the settings on the fly AND be visible so the user can select the commands associated with the program.

I have been able to set the HWND_TOPMOST setting of the external dialog, but whenever I send the commands to AutoCAD, I have to click 2 or 3 times in the drawing window to make it current so I can use the program. This is really a frustrating proposition.

I would like to have the external app remain on top, but be inactive and the AutoCAD current drawing to become active so I don't have to click 2 or 3 times in the drawing, then inadvertently clicking in the wrong place and having to start again.

Am I making myself clear?

Keith™:
Ok just to let you guys know... you are off the hook... I received an email from someone I didn't know (maybe they didn't want to offend me by making me feel inferior) Anyway the answer is:

--- Code: ---
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Public Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Boolean

SetForegroundWindow FindWindow(vbNullString, AcadApplication.Caption)

--- End code ---


He just pointed me in the right direction and the rest was mine...

This API stuff is awesome!!

Daron:
Well, if you didn't find out, I was thinking of sending you to vbdesign.net. I have some questions. What are the uses of programming the API and how do you go about understanding how?

SMadsen:
KEB, just curious, don't you have to take specific action to keep the inactivated window on top?
I thought SetForegroundWindow would put the whdl in front, while e.g. PutFocus would simply allow it to be handled without put in front.

SMadsen:
Daron, check out http://www.allapi.net. They have some great (and free) resources.

Navigation

[0] Message Index

[#] Next page

Go to full version