Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-11-25
4
Medium Priority
?
377 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 400 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
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 …

715 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