Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

VB API - Bring Active Model Window To Top

rhshorr

New member
Hi Everyone,

OK, I've got two parts in session: PARTA and PARTB. PARTB is active and displayed. I want to make PARTA active and displayed.

Using the VB API, I can successfully connect to the session, I can successfully check that PARTA is in session, I can make PARTA the active part, but I cannot bring its window to the front and display the part; PARTB's window is displayed and not active.

Does anyone know how to do this?

Here is some code (all the pfcls objects are correctly defined):

FoundModel = False
Ihit = -1
models = session.ListModels ' get list of models in session
If (models.Count > 0) then ' there are models in session
For J = 0 to (models.Count - 1)
model = models(j)
If (model.FullName = "PARTA") then
FoundModel = True
Ihit = j ' save the index
End If
Next
End If
If (FoundModel) then
model = models(Ihit)
window = session.GetModelWindow(model) ' get handle to model's window
window.Activate()
model.Display()
End If

At this point, PARTA is the active part and not displayed. I have to manually click the switch windows icon to display it.

Any help would be greatly appreciated. Thanks!
 
Last edited:
Not sure, try to reorient the call stack of the methods.

model.Display()
window.Activate()

Thank for replying Yaroslav, however I've tried that. I've even tried getting the handle to the window and using Windows 7 USER32 lib APIs to bring the window to the top. That didn't work either!
 

Sponsor

Articles From 3DCAD World

Back
Top