Results 1 to 5 of 5

Thread: [Resolved] n00b to VB.NET need help.

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2004
    Posts
    37

    [Resolved] n00b to VB.NET need help.

    Ok, I am running into an error I dont quite understand and looking at the MSDN files is a tad bit confusing. The following is the code from my module file. BUT it now does not work under visual basic.net is someone can help me out that would be awsome!

    VB Code:
    1. Public oIE As Object
    2.     Public glPid As Integer
    3.     Public glHandle As Integer
    4.     Public colHandle As New Collection
    5.     Public glHwnd As Integer
    6.    
    7.     Public Const SMTO_BLOCK As Short = &H1s
    8.     Public Const SMTO_ABORTIFHUNG As Short = &H2s
    9.     Public Const WM_NULL As Short = &H0s
    10.     Public Const WM_CLOSE As Short = &H10s
    11.     Public Const WM_DESTROY As Short = &H2s
    12.     Public Const PROCESS_ALL_ACCESS As Integer = &H1F0FFF
    13.    
    14.    
    15.    
    16.     'UPGRADE_ISSUE: Declaring a parameter 'As String' is not supported. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1016"'
    17.     Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As String) As Integer
    18.     Declare Function GetParent Lib "user32" (ByVal hwnd As Integer) As Integer
    19.     Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Integer
    20.     Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Integer, ByVal lParam As Integer) As Integer
    21.     Declare Sub ReleaseCapture Lib "user32" ()
    22.     Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessID As Integer) As Integer
    23.    
    24.     Declare Function SendMessageTimeout Lib "user32"  Alias "SendMessageTimeoutA"(ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer, ByVal fuFlags As Integer, ByVal uTimeout As Integer, ByRef pdwResult As Integer) As Integer
    25.    
    26.     Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Integer, ByVal uExitCode As Integer) As Integer
    27.    
    28.  
    29.     Public Function fEnumWindowsCallBack(ByVal hwnd As Integer, ByVal lpData As Integer) As Integer
    30.         Dim lParent As Integer
    31.         Dim lThreadId As Integer
    32.         Dim lProcessId As Integer
    33.        
    34.         fEnumWindowsCallBack = 1
    35.         lThreadId = GetWindowThreadProcessId(hwnd, lProcessId)
    36.        
    37.         If glPid = lProcessId Then
    38.             glHwnd = hwnd
    39.             fEnumWindowsCallBack = 0
    40.             lParent = GetParent(hwnd)
    41.             If lParent = 0 Then
    42.                 colHandle.Add(hwnd)
    43.             End If
    44.         Else
    45.         End If
    46.        
    47.     End Function
    48.    
    49.    
    50.  
    51.    
    52.     Public Function fEnumWindows() As Boolean
    53.         Dim hwnd As Integer
    54.  
    55.         'UPGRADE_WARNING: Add a delegate for AddressOf fEnumWindowsCallBack Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1048"'
    56.         Call EnumWindows(AddressOf fEnumWindowsCallBack, hwnd)
    57.     End Function


    This code is setup to check the process's running and match them to the process I have started using CreateProcess by the PID#. The error I am having trouble understanding in the upgrade is the AddressOf Operator. Again thanks for any help!
    Last edited by dsc_chris; Jul 24th, 2004 at 04:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width