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. Help with importing DLL

Help with importing DLL

Scheduled Pinned Locked Moved C#
csharpc++databasehelpquestion
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.
  • T Offline
    T Offline
    TimSWatson
    wrote on last edited by
    #1

    Hi Im having trouble with a imported function called ICCompress. Im not sure if I have transled the function properly can someone help me? Native

    typedef struct tagBITMAPINFOHEADER {
    DWORD biSize;
    LONG biWidth;
    LONG biHeight;
    WORD biPlanes;
    WORD biBitCount
    DWORD biCompression;
    DWORD biSizeImage;
    LONG biXPelsPerMeter;
    LONG biYPelsPerMeter;
    DWORD biClrUsed;
    DWORD biClrImportant;
    } BITMAPINFOHEADER;

    DWORD ICCompress(
    HIC hic,
    DWORD dwFlags,
    LPBITMAPINFOHEADER lpbiOutput,
    LPVOID lpData,
    LPBITMAPINFOHEADER lpbiInput,
    LPVOID lpBits,
    LPDWORD lpckid,
    LPDWORD lpdwFlags,
    LONG lFrameNum,
    DWORD dwFrameSize,
    DWORD dwQuality,
    LPBITMAPINFOHEADER lpbiPrev,
    LPVOID lpPrev
    );

    C# code

        \[StructLayoutAttribute(LayoutKind.Sequential)\]
        public struct BITMAPINFOHEADER
        {
            public uint biSize;
            public int biWidth;
            public int biHeight;
            public ushort biPlanes;
            public ushort biBitCount;
            public uint biCompression;
            public uint biSizeImage;
            public int biXPelsPerMeter;
            public int biYPelsPerMeter;
            public uint biClrUsed;
            public uint biClrImportant;
        }
    
        \[DllImport("MSVFW32.dll")\]
        public static extern int ICCompress(
            IntPtr hic,
            UInt32 dwFlags,        // flags
            ref BITMAPINFOHEADER lpbiOutput,     // output format
            IntPtr lpData,         // output data
            ref BITMAPINFOHEADER lpbiInput,      // format of frame to compress
            IntPtr lpBits,         // frame data to compress
            out UInt32 lpckid,         // ckid for data in AVI file
            out UInt32 lpdwFlags,      // flags in the AVI index.
            int lFrameNum,      // frame number of seq.
            UInt32 dwFrameSize,    // reqested size in bytes. (if non zero)
            UInt32 dwQuality,      // quality within one frame
            IntPtr lpbiPrev,       // format of previous frame
            IntPtr lpPrev          // previous frame
            );
    

    The code that calls ICCompress is

            // Setup compressor
            compressorHnd = Avi.ICOpen(Avi.FOURCC.ICTYPE\_VIDEO, Avi.FOURCC.mmioFOURCC('L','E','A','D'), Avi.ICMODE.ICMODE\_COMPRESS);
            
            outbi = new Avi.BITMAPINFOHEADER();
            inbi = new Avi.BITMAPINFOHEADER
    
    T 1 Reply Last reply
    0
    • T TimSWatson

      Hi Im having trouble with a imported function called ICCompress. Im not sure if I have transled the function properly can someone help me? Native

      typedef struct tagBITMAPINFOHEADER {
      DWORD biSize;
      LONG biWidth;
      LONG biHeight;
      WORD biPlanes;
      WORD biBitCount
      DWORD biCompression;
      DWORD biSizeImage;
      LONG biXPelsPerMeter;
      LONG biYPelsPerMeter;
      DWORD biClrUsed;
      DWORD biClrImportant;
      } BITMAPINFOHEADER;

      DWORD ICCompress(
      HIC hic,
      DWORD dwFlags,
      LPBITMAPINFOHEADER lpbiOutput,
      LPVOID lpData,
      LPBITMAPINFOHEADER lpbiInput,
      LPVOID lpBits,
      LPDWORD lpckid,
      LPDWORD lpdwFlags,
      LONG lFrameNum,
      DWORD dwFrameSize,
      DWORD dwQuality,
      LPBITMAPINFOHEADER lpbiPrev,
      LPVOID lpPrev
      );

      C# code

          \[StructLayoutAttribute(LayoutKind.Sequential)\]
          public struct BITMAPINFOHEADER
          {
              public uint biSize;
              public int biWidth;
              public int biHeight;
              public ushort biPlanes;
              public ushort biBitCount;
              public uint biCompression;
              public uint biSizeImage;
              public int biXPelsPerMeter;
              public int biYPelsPerMeter;
              public uint biClrUsed;
              public uint biClrImportant;
          }
      
          \[DllImport("MSVFW32.dll")\]
          public static extern int ICCompress(
              IntPtr hic,
              UInt32 dwFlags,        // flags
              ref BITMAPINFOHEADER lpbiOutput,     // output format
              IntPtr lpData,         // output data
              ref BITMAPINFOHEADER lpbiInput,      // format of frame to compress
              IntPtr lpBits,         // frame data to compress
              out UInt32 lpckid,         // ckid for data in AVI file
              out UInt32 lpdwFlags,      // flags in the AVI index.
              int lFrameNum,      // frame number of seq.
              UInt32 dwFrameSize,    // reqested size in bytes. (if non zero)
              UInt32 dwQuality,      // quality within one frame
              IntPtr lpbiPrev,       // format of previous frame
              IntPtr lpPrev          // previous frame
              );
      

      The code that calls ICCompress is

              // Setup compressor
              compressorHnd = Avi.ICOpen(Avi.FOURCC.ICTYPE\_VIDEO, Avi.FOURCC.mmioFOURCC('L','E','A','D'), Avi.ICMODE.ICMODE\_COMPRESS);
              
              outbi = new Avi.BITMAPINFOHEADER();
              inbi = new Avi.BITMAPINFOHEADER
      
      T Offline
      T Offline
      TimSWatson
      wrote on last edited by
      #2

      Ok i think that the problem is that I havnt specified the correct format in lpbiOutput. So I need to get the correct output format. I found a function called ICCompressGetFormat but I dont know how to use it. Can I import this function?

      realJSOPR 1 Reply Last reply
      0
      • T TimSWatson

        Ok i think that the problem is that I havnt specified the correct format in lpbiOutput. So I need to get the correct output format. I found a function called ICCompressGetFormat but I dont know how to use it. Can I import this function?

        realJSOPR Online
        realJSOPR Online
        realJSOP
        wrote on last edited by
        #3

        When you want to provide more info, and if you're not responding to a reply, edit the original message.

        .45 ACP - because shooting twice is just silly
        -----
        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

        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