Solved

GetModuleUsage

Posted on 1997-06-13
9
335 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 64
vb6 connector to SQL Server 2 37
SQL VB connection works in one PC and doesn't in another 15 64
Advice in Xamarin 21 78
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

776 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