Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Using cards.dll in Windows 7

Using cards.dll in Windows 7

Scheduled Pinned Locked Moved C#
comgraphicstutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mc_Topaz
    wrote on last edited by
    #1

    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?

    G 1 Reply Last reply
    0
    • M Mc_Topaz

      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?

      G Offline
      G Offline
      Ghydo
      wrote on last edited by
      #2

      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.

      M 1 Reply Last reply
      0
      • G Ghydo

        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.

        M Offline
        M Offline
        Mc_Topaz
        wrote on last edited by
        #3

        It did the job! Thanks!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups