Using cards.dll in Windows 7
-
Hello! I have been looking in this article: Drawing Cards with Cards.dll[^] and wanted to try it out myself. But I have not find out how to initialize the cards.dll on Windows 7. I downloaded cards.dll and put in under: c:\windows\system32. This is my code so far:
public partial class Form1 : Form
{
[DllImport("cards.dll")]
private static extern bool cdtInit(ref int width, ref int height);public Form1()
{
InitializeComponent();int width = 12, height = 12; if (!cdtInit(ref width, ref height)) throw new Exception("cards.dll did not load");
}
}The if-statement crashes with the a BadImageFormatException with this message (translated from Swedish to English): "An attempt to read the program/application with bad format was made. (Exception from HRESULT: 0x8007000B)" How shall I make this work?
-
Hello! I have been looking in this article: Drawing Cards with Cards.dll[^] and wanted to try it out myself. But I have not find out how to initialize the cards.dll on Windows 7. I downloaded cards.dll and put in under: c:\windows\system32. This is my code so far:
public partial class Form1 : Form
{
[DllImport("cards.dll")]
private static extern bool cdtInit(ref int width, ref int height);public Form1()
{
InitializeComponent();int width = 12, height = 12; if (!cdtInit(ref width, ref height)) throw new Exception("cards.dll did not load");
}
}The if-statement crashes with the a BadImageFormatException with this message (translated from Swedish to English): "An attempt to read the program/application with bad format was made. (Exception from HRESULT: 0x8007000B)" How shall I make this work?
It looks like you are trying to load a 32bit dll from a 64bit program. Are you using a 64bit os and compiling you program for any platform? If so you can try to compile your app for 32bit only (set the project’s properties from "any" platform target to "x86" - it will run also on 64bit systems) and see if it works. Hope it helps.
-
It looks like you are trying to load a 32bit dll from a 64bit program. Are you using a 64bit os and compiling you program for any platform? If so you can try to compile your app for 32bit only (set the project’s properties from "any" platform target to "x86" - it will run also on 64bit systems) and see if it works. Hope it helps.