Passing Whnd to API function in .NET

  • Thread starter Sakharam Phapale
  • 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
 
I

Imran Koradia

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.
 
H

Herfried K. Wagner [MVP]

* "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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top