a question about DllImportAttribute

  • Thread starter Thread starter dgk
  • Start date Start date
D

dgk

I'm not sure what the difference is between using the attribute and
just declaring a function in a dll. For that matter, what this code is
doing is also a question (from one of the 101 examples from
Microsoft):

' Specifying Unicode
Public Declare Unicode Function UnicodeBeep Lib "kernel32" Alias
"Beep" _
(ByVal dwFreq As Integer, ByVal dwDuration As Integer) As
Integer

' Specifying Ansi
Public Declare Ansi Function ANSIBeep Lib "kernel32" Alias "Beep"
_
(ByVal dwFreq As Integer, ByVal dwDuration As Integer) As
Integer

' Specifying Auto
Public Declare Auto Function AutoBeep Lib "kernel32" Alias "Beep"
_
(ByVal dwFreq As Integer, ByVal dwDuration As Integer) As
Integer

Any hints appreciated.
 
I'm not sure what the difference is between using the attribute and
just declaring a function in a dll.

See http://www.dotnetinterop.com/faq/?q=DeclareDllImport

For that matter, what this code is
doing is also a question (from one of the 101 examples from
Microsoft):

Good question, I don't know why anyone would write code like that. For
functions that don't take any string or character parameters (such as
Beep), it's irrelevant whether you use a Ansi/Auto/Unicode modifier in
the Declare statement.



Mattias
 
Back
Top