Solved

how can I change the GetModuleUsage in 16 bit to 32 bit

Posted on 1998-11-25
4
368 Views
Last Modified: 2008-02-26
In my application in access 1.1 there is a function called
waitshell, this function runs a ftp process and uses a function called GetModuleUsage.
This application was upgradring to access 95, i consulted
about this function in kernel32 but there isn't.
what can i do, to change this function if it is in a while
section?

hMod=Shell("ftp -s:\\jiracheta\pat\valsoftp.bat",3)
while (GetModuleUsage(hMod)>0)
   DoEvents
Wend

how can i get the seem functionality in access 95?

Thanks of lot,

Javier Iracheta
0
Comment
Question by:jiracheta
  • 2
4 Comments
 
LVL 3

Expert Comment

by:NullTerminator
ID: 1969389
Use CreateProcess() to kick off your process, and then watch for it with
WaitforSingleObject(hMod, 0) until WaitForSIngleObject returns WAIT_OBJECT_0, meaning the process terminated.

The STARTUPINFO and PROCESSINFO structures are a pain, but it should work for you.

'\0'
0
 

Author Comment

by:jiracheta
ID: 1969390
I can't found any function called CreateProcess().

What about TaskFirst() and TaskNext() from ToolHelp.dll?

May I use these function in 32 bit and how?

do exist other way to do this?
0
 

Accepted Solution

by:
RSG earned 100 total points
ID: 1969391
NullTerminator answer was the correct method. But unless you see a sample working code you won't be able to do it. So I thought of giving you a sample routine. I have doen this in MS Access 97. It will work for Access 95 too.

Copy the code into a moudle and then call the subroutine from anywhere in your application.

This may make your life easier.

Good luck




Option Compare Database
Option Explicit

Global Const NORMAL_PRIORITY_CLASS = &H20&
Global Const INFINITE = -1&

Type STARTUPINFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Long
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type

Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessID As Long
    dwThreadID As Long
End Type

Declare Function CreateProcessA Lib "kernel32" _
   (ByVal lpApplicationName As Long, ByVal lpCommandLine As _
   String, ByVal lpProcessAttributes As Long, ByVal _
   lpThreadAttributes As Long, ByVal bInheritHandles As _
   Long, ByVal dwCreationFlags As Long, ByVal _
   lpEnvironment As Long, ByVal _
   lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, _
   lpProcessInformation As PROCESS_INFORMATION) As Long
Declare Function CloseHandle Lib "kernel32" (hObject As Long) _
    As Boolean
Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
    hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Sub ShellAndWait(AppToRun)
    On Error GoTo ErrorRoutineErr
   
    Dim NameOfProc As PROCESS_INFORMATION
    Dim NameStart As STARTUPINFO
    Dim rc As Long

    NameStart.cb = Len(NameStart)
    rc = CreateProcessA(0&, AppToRun, 0&, 0&, 1&, _
       NORMAL_PRIORITY_CLASS, _
       0&, 0&, NameStart, NameOfProc)
    rc = WaitForSingleObject(NameOfProc.hProcess, INFINITE)
    rc = CloseHandle(NameOfProc.hProcess)
   
ErrorRoutineResume:
    Exit Sub
ErrorRoutineErr:
    MsgBox "AppShell.Form1.ShellAndWait" & Err & Error
    Resume Next

End Sub





0
 

Expert Comment

by:RSG
ID: 1969392
jiracheta,

I am glad to know that my answer solved your problem.

RSG
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

757 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

20 Experts available now in Live!

Get 1:1 Help Now