[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference abbott::visual_basic

Title:Microsoft Visual Basic
Moderator:TAMARA::DFEDOR::fedor
Created:Thu May 02 1991
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2565
Total number of notes:10453

2510.0. "GetModuleHandle (in VB4) always returns 0???" by ALLVAX::LI () Tue Mar 04 1997 10:11

    I need help on using the API function "GetModuleHandle" in VB4
    (32 bit version). I have the following test function to get the 
    handle of an executable that I have just shelled but I always get 
    back 0. Thanks for your help in advance.
    
    Declare Function GetModuleHandle Lib "kernel32" Alias
    "GetModuleHandleA" (ByVal lpModuleName As String) As Long
    
    Public Sub ExecQueries()
        Dim x As Long
        Dim WHnd As Long
        Dim AppName As String
        
    	x = Shell("QUERYAPP.EXE", 4)
            
        AppName = "QUERYAPP.EXE"
        Do
            WHnd = GetModuleHandle(AppName)
        Loop Until WHnd <> 0
    
    End Sub
    
    (It never got out the the DO LOOP)  
T.RTitleUserPersonal
Name
DateLines