Solved

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

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

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

Suggested Solutions

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…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

821 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