Solved

GetModuleUsage

Posted on 1997-06-13
9
332 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 4

Expert Comment

by:Chizl
Comment Utility
Is the second program a DOS program?  Will it be opening a DOS window?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

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

Expert Comment

by:Chizl
Comment Utility
Is the second program a DOS program?  Does it open a DOS window?

L8r,
Chizl
0
 
LVL 4

Expert Comment

by:Chizl
Comment Utility
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
Comment Utility
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
Comment Utility
excelent Chizl
thanks a lot !!!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now