Generally speaking you need to know the names of the publicly available methods and the parameters they require, and what to expect either as returns or as OUT addresses.
Code:
/// <summary>
/// Load colored cursor handle from a file
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
[DllImport("user32.dll", EntryPoint = "LoadCursorFromFileW", CharSet = CharSet.Unicode)]
public static extern IntPtr LoadCursorFromFile(string fileName);
Sometimes its just a matter of sending the right data to the right address with the flags/commands
Code:
[DllImport("Winmm.dll")]
private static extern long PlaySound(byte[] data, IntPtr hMod, UInt32 dwFlags);
// Laster used like this
public void PlayWavResource(string wav)
{
// get the namespace
string strNameSpace = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString();
// get the resource into a stream
Stream str = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(strNameSpace + "." + wav);
if (str == null)
return;
// bring stream into a byte array
byte[] bStr = new Byte[str.Length];
str.Read(bStr, 0, (int)str.Length);
// play the resource
PlaySound(bStr, IntPtr.Zero, 1 | 4);
}
If all you know is the name of the DLL for the card, but have no SDK for using the card you are kind of working in the dark. You don't know the functions created by the DLL/card manufacturer or the rules for accessing those functions.
Comment