Solved

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

Posted on 1998-11-25
4
371 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

778 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