Solved

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

Posted on 1998-11-25
4
374 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
[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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

636 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