Home All Groups Group Topic Archive Search About
Author
24 Mar 2005 5:01 PM
Cutlass
What is the proper VB.NET way to declare these VB6 dlls?

Public Declare Function WaitForSingleObject Lib "kernel32" _
  (ByVal hHandle As Long, _
   ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
  (ByVal hObject As Long) As Long
Public Declare Function FindWindow Lib "user32" _
   Alias "FindWindowA" _
   (ByVal lpClassName As String, _
   ByVal lpWindowName As String) As Long
Public Declare Function PostMessage Lib "user32" _
   Alias "PostMessageA" _
   (ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   ByVal lParam As Long) As Long
Public Declare Function IsWindow Lib "user32" _
   (ByVal hwnd As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" _
   (ByVal dwDesiredAccess As Long, _
   ByVal bInheritHandle As Long, _
   ByVal dwProcessId As Long) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" _
   (ByVal hwnd As Long, _
   lpdwProcessId As Long) As Long

Author
24 Mar 2005 5:24 PM
Tom Shelton
In article <41ABC346-CC3B-4303-AA01-5F2BC1A2C***@microsoft.com>, Cutlass wrote:
> What is the proper VB.NET way to declare these VB6 dlls?
>
> Public Declare Function WaitForSingleObject Lib "kernel32" _
>   (ByVal hHandle As Long, _
>    ByVal dwMilliseconds As Long) As Long


Public Declare Function WaitForSingleObject Lib "kernel32" _
    (ByVal hHandle As System.IntPtr, _
    ByVal dwMilliseconds As Integer) As Integer

> Private Declare Function CloseHandle Lib "kernel32" _
>   (ByVal hObject As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" _
    (ByVal hObject As System.IntPtr) As Boolean

> Public Declare Function FindWindow Lib "user32" _
>    Alias "FindWindowA" _
>    (ByVal lpClassName As String, _
>    ByVal lpWindowName As String) As Long

Public Auto Declare Function FindWindow Lib "user32" _
    (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As System.IntPtr

> Public Declare Function PostMessage Lib "user32" _
>    Alias "PostMessageA" _
>    (ByVal hwnd As Long, _
>    ByVal wMsg As Long, _
>    ByVal wParam As Long, _
>    ByVal lParam As Long) As Long

Public Declare Auto Function PostMessage Lib "user32" _
    (ByVal hWnd As  System.IntPtr, _
    ByVal wMsg As Integer, _
    ByVal wParam As Integer, _
    ByVal lParam As Integer) As Boolean

> Public Declare Function IsWindow Lib "user32" _
>    (ByVal hwnd As Long) As Long

Public Declare Function IsWindow Lib "user32" _
    (ByVal hWnd As System.IntPtr) As Boolean

> Public Declare Function OpenProcess Lib "kernel32" _
>    (ByVal dwDesiredAccess As Long, _
>    ByVal bInheritHandle As Long, _
>    ByVal dwProcessId As Long) As Long

Public Declare Function OpenProcess Lib "kernel32" _
    (ByVal dwDesiredAccess As Integer, _
    ByVal bInheritHandle As Boolean, _
    ByVal dwProcessId As System.IntPtr) As System.IntPtr

> Public Declare Function GetWindowThreadProcessId Lib "user32" _
>    (ByVal hwnd As Long, _
>    lpdwProcessId As Long) As Long
>

Public Declare Function GetWindowThreadProcessId Lib "user32" _
    (ByVal hWnd As System.IntPtr, _
    ByRef lpdwProcessId As System.IntPtr) As System.IntPtr

--
Tom Shelton [MVP]
Author
24 Mar 2005 6:20 PM
james
Can't you just add them as references and act upon them once instantiated?

Show quoteHide quote
"Tom Shelton" <t**@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:uBAWGZJMFHA.4080@TK2MSFTNGP09.phx.gbl...
> In article <41ABC346-CC3B-4303-AA01-5F2BC1A2C***@microsoft.com>, Cutlass
> wrote:
>> What is the proper VB.NET way to declare these VB6 dlls?
>>
>> Public Declare Function WaitForSingleObject Lib "kernel32" _
>>   (ByVal hHandle As Long, _
>>    ByVal dwMilliseconds As Long) As Long
>
>
> Public Declare Function WaitForSingleObject Lib "kernel32" _
> (ByVal hHandle As System.IntPtr, _
> ByVal dwMilliseconds As Integer) As Integer
>
>> Private Declare Function CloseHandle Lib "kernel32" _
>>   (ByVal hObject As Long) As Long
>
> Private Declare Function CloseHandle Lib "kernel32" _
> (ByVal hObject As System.IntPtr) As Boolean
>
>> Public Declare Function FindWindow Lib "user32" _
>>    Alias "FindWindowA" _
>>    (ByVal lpClassName As String, _
>>    ByVal lpWindowName As String) As Long
>
> Public Auto Declare Function FindWindow Lib "user32" _
> (ByVal lpClassName As String, _
> ByVal lpWindowName As String) As System.IntPtr
>
>> Public Declare Function PostMessage Lib "user32" _
>>    Alias "PostMessageA" _
>>    (ByVal hwnd As Long, _
>>    ByVal wMsg As Long, _
>>    ByVal wParam As Long, _
>>    ByVal lParam As Long) As Long
>
> Public Declare Auto Function PostMessage Lib "user32" _
> (ByVal hWnd As  System.IntPtr, _
> ByVal wMsg As Integer, _
> ByVal wParam As Integer, _
> ByVal lParam As Integer) As Boolean
>
>> Public Declare Function IsWindow Lib "user32" _
>>    (ByVal hwnd As Long) As Long
>
> Public Declare Function IsWindow Lib "user32" _
> (ByVal hWnd As System.IntPtr) As Boolean
>
>> Public Declare Function OpenProcess Lib "kernel32" _
>>    (ByVal dwDesiredAccess As Long, _
>>    ByVal bInheritHandle As Long, _
>>    ByVal dwProcessId As Long) As Long
>
> Public Declare Function OpenProcess Lib "kernel32" _
> (ByVal dwDesiredAccess As Integer, _
> ByVal bInheritHandle As Boolean, _
> ByVal dwProcessId As System.IntPtr) As System.IntPtr
>
>> Public Declare Function GetWindowThreadProcessId Lib "user32" _
>>    (ByVal hwnd As Long, _
>>    lpdwProcessId As Long) As Long
>>
>
> Public Declare Function GetWindowThreadProcessId Lib "user32" _
> (ByVal hWnd As System.IntPtr, _
> ByRef lpdwProcessId As System.IntPtr) As System.IntPtr
>
> --
> Tom Shelton [MVP]