Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, my name is Juliana Botero. I

Status
Not open for further replies.

2521616

Programmer
Oct 1, 2002
1
CO
Hello, my name is Juliana Botero. I am trying to open a VB program ("ConsultaDocLinking.exe") from a Extra! client Macro. At this moment the macro is working well but my problem is that "ConsultaDocLinking.exe" is not being opened by the system as a main window.I have to minimize the Extra Cliente in order to see the application. Please someone help me.... I NEED this application as the main window.

I have already tryed with this functions:

num=shell("ConsultaDocLinking.exe", 1)
iRetVal = SetActiveWindow(num)
iRetVal = SetForegroundWindow32(num)
iRetVal = ShowWindow32(num,9)
iRetVal = SetFocus(num)


Here is the macro code:
*********************************************************
'32 Bit Declares.

Declare Function ShowWindow32 Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Declare Function FindWindow32 Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function SetForegroundWindow32 Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long

Declare Function SetActiveWindow Lib "user32" (ByVal hwnd As Long) As Long

Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long


Sub Main

Dim System As ExtraSystem, Session As ExtraSession

' Get the main system object
Set System = CreateObject("EXTRA.System")
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object." Stop
End If

' Get the necessary Session Object
Set Session = System.ActiveSession
If (Session is Nothing) Then
Msgbox "Could not create the Session "
Stop
else
msgbox Session.name
dim num
dim iRetVal

num=shell("ConsultaDocLinking.exe", 1)
iRetVal = SetActiveWindow(num)
iRetVal = SetForegroundWindow32(num)
iRetVal = ShowWindow32(num,9)
iRetVal = SetFocus(num)
end if
 
I remember trying to use the return value from Shell to get the window handle, but then learning that shell actually returns the Process handle not the window handle. I don't see why

num = FindWindow ("Actual Window Title for doc.exe",vbNull)

wouldn't work. If the window title changes you would have to adjust for that. There are others ways to get a definite handle if you need them let me know.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top