GetModuleUsage 32-bit API declare? 
Author Message
 GetModuleUsage 32-bit API declare?

Can someone give me the 32-bit declare for the
GetModuleUsage API?  

Thanks,
Blake

Please remove the 454 from my email address if responding
by email (SPAM protection):



Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

GetModuleUsage no longer  exists under win32

Quote:

>Can someone give me the 32-bit declare for the
>GetModuleUsage API?

>Thanks,
>Blake

>Please remove the 454 from my email address if responding
>by email (SPAM protection):




Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

On Mon, 20 Apr 1998 12:44:54 -0500, "greg munro"

Quote:

>GetModuleUsage no longer  exists under win32

That clears that one up.  Now..

How can I tell if an app is still running under Win32 (a DOS
app in this instance)?

Blake

Please remove the 454 from my email address if responding
by email (SPAM protection):



Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

   The GetModuleUsage function is obsolete and is not included in the Win32
API. This is because memory or instance handles are no longer shared between
applications. However, the following declares can be used to retreive the
usage of all currently running processes. Is this the equivilent of what you
need under Win32?


Public Const TH32CS_SNAPPROCESS As Long = 2&
Public Const MAX_PATH   As Integer = 260

Public Type PROCESSENTRY32
dwSize                  As Long
cntUsage                As Long
th32ProcessID           As Long
th32DefaultHeapID       As Long
th32ModuleID            As Long
cntThreads              As Long
th32ParentProcessID     As Long
pcPriClassBase          As Long
dwFlags                 As Long
szExeFile               As String * MAX_PATH
End Type

Type FILETIME  '  8  Bytes
     dwLowDateTime As Long
     dwHighDateTime As Long
End Type

Public Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Long
End Type

Public Declare Function CreateToolhelpSnapshot Lib _
    "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal _
    lFlags As Long, ByVal lProcessID As Long) As Long
Public Declare Function ProcessFirst Lib "kernel32" Alias _
    "Process32First" (ByVal hSnapShot As Long, uProcess As _
    PROCESSENTRY32) As Long
Public Declare Function ProcessNext Lib "kernel32" Alias _
    "Process32Next" (ByVal hSnapShot As Long, uProcess As _
    PROCESSENTRY32) As Long
Public Declare Sub CloseHandle Lib "kernel32" (ByVal hPass _
    As Long)

Quote:

>Can someone give me the 32-bit declare for the
>GetModuleUsage API?

>Thanks,
>Blake

>Please remove the 454 from my email address if responding
>by email (SPAM protection):




Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

   I found the following code example for using OpenProcess and
GetExitCodeProcess to determine when a process has terminated.

Eric

Private Sub cmdWatch_Click()
   Dim ProcessId&
   Dim hProcess&
   Dim ExitCode&

   ProcessId = Shell("project1.exe", vbNormalFocus)
   hProcess = OpenProcess(PROCESS_QUERY_ INFORMATION, False, ProcessId)
   cmdWatch.Enabled = False
   Do
      Call GetExitCodeProcess(hProcess, ExitCode)
      DoEvents
   Loop While (ExitCode = STILL_ACTIVE)
   cmdWatch.Enabled = True
   Call CloseHandle(hProcess)
End Sub

Quote:

>On Mon, 20 Apr 1998 12:44:54 -0500, "greg munro"

>>GetModuleUsage no longer  exists under win32

>That clears that one up.  Now..

>How can I tell if an app is still running under Win32 (a DOS
>app in this instance)?

>Blake

>Please remove the 454 from my email address if responding
>by email (SPAM protection):




Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

On Mon, 20 Apr 1998 13:04:42 -0500, "erussell"

Quote:

>   The GetModuleUsage function is obsolete and is not included in the Win32
>API. This is because memory or instance handles are no longer shared between
>applications. However, the following declares can be used to retreive the
>usage of all currently running processes. Is this the equivilent of what you
>need under Win32?


><much useful text deleted>

I needed to check and see if the app was still runnning.  I
found the answer in the Knowledge Base, article id Q129796.

Thanks for the reply.

Blake

Please remove the 454 from my email address if responding
by email (SPAM protection):



Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

On Mon, 20 Apr 1998 13:14:21 -0500, "erussell"

Quote:

>   I found the following code example for using OpenProcess and
>GetExitCodeProcess to determine when a process has terminated.

>Eric

>Private Sub cmdWatch_Click()
>   Dim ProcessId&
>   Dim hProcess&
>   Dim ExitCode&

>   ProcessId = Shell("project1.exe", vbNormalFocus)
>   hProcess = OpenProcess(PROCESS_QUERY_ INFORMATION, False, ProcessId)
>   cmdWatch.Enabled = False
>   Do
>      Call GetExitCodeProcess(hProcess, ExitCode)
>      DoEvents
>   Loop While (ExitCode = STILL_ACTIVE)
>   cmdWatch.Enabled = True
>   Call CloseHandle(hProcess)
>End Sub

I might give that a try.  It looks a lot simpler than the KB
article.

Blake

Please remove the 454 from my email address if responding
by email (SPAM protection):



Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?



Quote:
>On Mon, 20 Apr 1998 13:14:21 -0500, "erussell"

>>   I found the following code example for using OpenProcess and
>>GetExitCodeProcess to determine when a process has terminated.

>>Eric

>>Private Sub cmdWatch_Click()
>>   Dim ProcessId&
>>   Dim hProcess&
>>   Dim ExitCode&

>>   ProcessId = Shell("project1.exe", vbNormalFocus)
>>   hProcess = OpenProcess(PROCESS_QUERY_ INFORMATION, False, ProcessId)
>>   cmdWatch.Enabled = False
>>   Do
>>      Call GetExitCodeProcess(hProcess, ExitCode)
>>      DoEvents
>>   Loop While (ExitCode = STILL_ACTIVE)
>>   cmdWatch.Enabled = True
>>   Call CloseHandle(hProcess)
>>End Sub

>I might give that a try.  It looks a lot simpler than the KB
>article.

>Blake

>Please remove the 454 from my email address if responding
>by email (SPAM protection):


Declare Function OpenProcess Lib "kernel32" Alias "OpenProcess" (ByVal
dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal
dwProcessId As Long) As Long
Declare Function WaitForSingleObject Lib "kernel32" Alias
"WaitForSingleObject" (ByVal hHandle As Long, ByVal dwMilliseconds As
Long) As Long
Public Const PROCESS_QUERY_INFORMATION = &H400
Public Const WAIT_TIMEOUT = &H102&

Sub Win32WaitTilFinished(ProgEXE As String)
    Dim ProcessID As Long
    Dim hProcess As Long
    Dim RetVal As Long

    ProcessID = Shell(ProgEXE, vbNormalFocus)
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False,
ProcessID)
    Do
        DoEvents
        RetVal = WaitForSingleObject(hProcess, 50)
    Loop Until RetVal <> WAIT_TIMEOUT
End Sub

Donkey

????????????????????????????????????????????
DOS never says "EXCELLENT command or filename"
-
Note: remove "NOSPAM" from my address
to e-mail me
????????????????????????????????????????????



Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

Quote:

>Can someone give me the 32-bit declare for the
>GetModuleUsage API?  

Because the 32-bit Windows architecture is completely different than
the 16-bit (applications run in separate processes as opposed to a
single shared process), GetModuleUsage is obsolete.

Paul
~~~~



Fri, 06 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

I have the same requirement as you and have tried the examples offered
and some in the KB and have not found a complete solution.

I want to run the shelled task hidden (or at a pinch minimised).

I can either

Wait for a task to finish using CreateProcessA and WaitforSingleObject
but wShowWindow element of STARTUPINFO doesn't seem to do anything

Or use Shell, OpenProcess and WaitforSingleObject and get it hidden but
Wait.. doesn't.

Any ideas ?

Thanks

Ian



Sat, 07 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

On Tue, 21 Apr 1998 15:15:06 +0100, Ian Addinsell

Quote:

>I have the same requirement as you and have tried the examples offered
>and some in the KB and have not found a complete solution.

>I want to run the shelled task hidden (or at a pinch minimised).

>I can either

>Wait for a task to finish using CreateProcessA and WaitforSingleObject
>but wShowWindow element of STARTUPINFO doesn't seem to do anything

>Or use Shell, OpenProcess and WaitforSingleObject and get it hidden but
>Wait.. doesn't.

>Any ideas ?

>Thanks

>Ian

I just use the Shell method right now.  Since my "hidden"
task is just a program to insert records into an Oracle
database using ODBC, I made a formless executable (no VB
form at all.. just a compiled module with a "sub Main" to
start it).  Not a problem to hide something that you can't
show.   Since it's just a big passthrough SQL query I can't
really check it's status anyway.. I just have to wait for it
to finish.   If anyone has a method for a % complete when
doing ODBC passthough SQL inserts, I'd appreciate it,
though!

If it's your own program, you could always do a "if
me.windowstate <> vbMinimized then me.windowstate =
vbMinimized" in the form's Activate event, I guess.  

Otherwise, have you tried the shell with a
vbMinimizedNoFocus [ex. ProcessId = Shell(PrgToExecute,
vbMinimizedNoFocus)]?  That might work.  Of course if they
click to maximize it's game over - the form pops up & haunts
you.

Other than that, I'm out of ideas - unless you want to get
really {*filter*} with some API's to hunt down the offending
app and monitor it's status.

I hope that helped a little.

Blake

Please remove the 454 from my email address if responding
by email (SPAM protection):



Sat, 07 Oct 2000 03:00:00 GMT  
 GetModuleUsage 32-bit API declare?

Quote:

>I have the same requirement as you and have tried the examples offered
>and some in the KB and have not found a complete solution.
>I want to run the shelled task hidden (or at a pinch minimised).
>I can either
>Wait for a task to finish using CreateProcessA and WaitforSingleObject
>but wShowWindow element of STARTUPINFO doesn't seem to do anything

What is the value you are assigning to wShowWindow. I've implemented
this in an application and don't have any problem hiding the DOS
window.

Paul
~~~~



Sun, 08 Oct 2000 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. 32 bit equivalent of 16 bit API call GetModuleUsage

2. 32 bit equiv. of GetModuleUsage API

3. Using both 16 bit and 32 bit FindWindow declares

4. 32 bit equivalent fo GetModuleUsage

5. 32 bit Getmoduleusage ??

6. 32 bit version of GetModuleUsage ???

7. GetModuleUsage - 32 bit equivalent required

8. GetModuleUsage is there a 32 bit version

9. What is the 32 bit API equivalent of the getmoduleusage 16 bit API function ???

10. API Conversion 16 bit to 32 bit

11. Need some 16 bit and 32 bit API assistance

12. 16 bit API calls in VB 3 supported in 32 bit VB 4.0

 

 
Powered by phpBB® Forum Software