Solved

GetModuleUsage

Posted on 1997-06-13
9
344 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

623 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