Solved

GetModuleUsage

Posted on 1997-06-13
9
338 Views
Last Modified: 2008-03-04
I have written a program in VB3 and I need to port it to 32 bits. The only problem I have is that the GetModuleUsage 16 bits api function I did use to "modal" run an external program has gone in the 32 bits api. I need to know how to accomplish this task using the 32 bits api and VB4.
0
Comment
Question by:ega061397
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 4

Accepted Solution

by:
Chizl earned 200 total points
ID: 1427229
To run other EXE files you can a couple of things.  You can use COM or OLE automation or use Shell or ShellExecute.   Com or OLE automation is the best way if you know how its registered and if the program is COM compliant.   If it is then use the function ObjectCreate("Excel.app") for example.  If you use Shell then its as easy as saying   CALL Shell("C:\EXCEL\EXCEL.EXE", 2)
ShellExecute you need to use an API call to use, but works in the same way that shell does.. :)

L8r,
Chizl
http://www.sourcesite.simplenet.com/
The Source Site
The ONLY all platform all language source code site on the net!
0
 

Author Comment

by:ega061397
ID: 1427230
I think I was not very clear to redact my question. I need not only to run a second program, but to wait for it to finnish. And to do it using the VB4 32 bit compiler. I already have done this with the 16 bin Windows API but the GetModuleUsage function is gone in the 32 bit Windows API.
0
 

Author Comment

by:ega061397
ID: 1427231
I think I was not very clear to redact my question. I need not only to run a second program, but to wait for it to finnish. And to do it using the VB4 32 bit compiler. I already have done this with the 16 bin Windows API but the GetModuleUsage function is gone in the 32 bit Windows API.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 4

Expert Comment

by:Chizl
ID: 1427232
Is the second program a DOS program?  Will it be opening a DOS window?
0
 

Author Comment

by:ega061397
ID: 1427233
No, the second program is a Windows program and it wont open any dos box.
0
 
LVL 4

Expert Comment

by:Chizl
ID: 1427234
Is the second program a DOS program?  Does it open a DOS window?

L8r,
Chizl
0
 
LVL 4

Expert Comment

by:Chizl
ID: 1427235
Also does the second program close out completely when finished if so you can do the following..

Declare Function FindWindow Lib "user32.dll" _
                  (ByVal lpclassname As Any, _
                  ByVal lpwindowname As Any) _
                  As Integer

Function CallProgram()
   cText = "Window Caption of second program"

   call Shell("The_second_program.exe",0)

   Wait 5 ' give the program enough time to initialize

   Do While FindWindow(0&, cText) <> Null
        DoEvents
   Loop
end function

Function Wait(nSec As Integer)
    Start = Timer
    Do While Timer < Start + nSec
        DoEvents
    Loop
End Function

0
 
LVL 4

Expert Comment

by:Chizl
ID: 1427236
Please change the :

call Shell("The_second_program.exe",0)

To :

call Shell("The_second_program.exe",2)

The "0" would make the program not show up on screen.:)
0
 

Author Comment

by:ega061397
ID: 1427237
excelent Chizl
thanks a lot !!!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

739 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