Passing Whnd to API function in .NET

  • Thread starter Thread starter Sakharam Phapale
  • Start date Start date
S

Sakharam Phapale

Hi All,

I want to pass this structure to API function.

Private Structure FLASHWINFO

Dim cbSize As Long

Dim hwnd As Long

Dim dwFlags As Long

Dim uCount As Long

Dim dwTimeout As Long

End Structure



Now here handle of window is type "intPtr" so how to convert it to Long ,

Long is Integer in .NET

Is the following statement right?

cint(me.Handle.toInt32)



Regards

Sakharam Phapale
 
define your structure as follows:

Private Structure FLASHWINFO
Dim cbSize As Integer
Dim hwnd As IntPtr
Dim dwFlags As Integer
Dim uCount As Integer
Dim dwTimeout As Integer
End Structure

Now you can directly pass the hWnd without worrying about the conversion to
Int32.

hope this helps..
Imran.
 
* "Sakharam Phapale said:
I want to pass this structure to API function.

Private Structure FLASHWINFO

Dim cbSize As Long

Dim hwnd As Long

Dim dwFlags As Long

Dim uCount As Long

Dim dwTimeout As Long

End Structure

Replace 'Long' with 'Int32' and declare 'hwnd' as 'IntPtr'. Then you
can pass in 'Me.Handle' directly.
 
Back
Top