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. Call to unmanaged dll function

Call to unmanaged dll function

Scheduled Pinned Locked Moved C#
questiongraphicssecurityhelp
2 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.
  • A Offline
    A Offline
    Aslam Bari
    wrote on last edited by
    #1

    Does anybody know what is the problem in the below code. The InPtr returned by the funcion is always 0 means null. Why? //////////////// public class ThumbnailExtractor { [System.Security.SuppressUnmanagedCodeSecurity] [DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?acdbGetPreviewBitmap@@YAPAUtagBITMAPINFO@@PB_W@Z")] extern static private IntPtr acdbGetPreviewBitmap(string filename); static Bitmap GetBitmapFromDwg(string filename) { return Marshaler.BitmapInfoToBitmap(acdbGetPreviewBitmap(filename)); } public Bitmap GetImage(string filename) { return GetBitmapFromDwg(filename); } } /////////////////// Thanks in advance

    M 1 Reply Last reply
    0
    • A Aslam Bari

      Does anybody know what is the problem in the below code. The InPtr returned by the funcion is always 0 means null. Why? //////////////// public class ThumbnailExtractor { [System.Security.SuppressUnmanagedCodeSecurity] [DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?acdbGetPreviewBitmap@@YAPAUtagBITMAPINFO@@PB_W@Z")] extern static private IntPtr acdbGetPreviewBitmap(string filename); static Bitmap GetBitmapFromDwg(string filename) { return Marshaler.BitmapInfoToBitmap(acdbGetPreviewBitmap(filename)); } public Bitmap GetImage(string filename) { return GetBitmapFromDwg(filename); } } /////////////////// Thanks in advance

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Not sure where this acdb17.dll is coming from, but the EntryPoint is looking really strange. In most cases you can simply p/invoke functions from Win32 DLLs by just declaring the static method with the same name as the function in the DLL. The EntryPoint attribute is only neccessary if you want to (or have to) name you function differently. So I'd suggest trying:

      [DllImport("acdb17.dll")]
      extern static private IntPtr acdbGetPreviewBitmap(string filename);

      Does it work then?

      Regards, mav -- Black holes are the places where god divided by 0...

      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