Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: ADO.NET cross-base transactions Pin
Yoyosch23-Apr-10 3:02
Yoyosch23-Apr-10 3:02 
GeneralRe: ADO.NET cross-base transactions Pin
PIEBALDconsult23-Apr-10 4:36
mvePIEBALDconsult23-Apr-10 4:36 
QuestionCLR stored procedure cross base access Pin
Yoyosch23-Apr-10 1:33
Yoyosch23-Apr-10 1:33 
AnswerRe: CLR stored procedure cross base access Pin
Dave Kreskowiak23-Apr-10 3:48
mveDave Kreskowiak23-Apr-10 3:48 
QuestionNeed help with emailing a web page. Pin
Boipelo23-Apr-10 1:20
Boipelo23-Apr-10 1:20 
AnswerRe: Need help with emailing a web page. Pin
#realJSOP23-Apr-10 1:47
mve#realJSOP23-Apr-10 1:47 
GeneralRe: Need help with emailing a web page. Pin
Boipelo30-Apr-10 2:55
Boipelo30-Apr-10 2:55 
QuestionHelp with importing DLL Pin
TimSWatson23-Apr-10 0:17
TimSWatson23-Apr-10 0:17 
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();

outbi.biSize = Convert.ToUInt32(Marshal.SizeOf(outbi)); // 40
outbi.biBitCount = 24;
outbi.biWidth = 640;
outbi.biHeight = 480;
outbi.biPlanes = 1;
outbi.biBitCount = 24;
outbi.biCompression = 0;

inbi.biSize = Convert.ToUInt32(Marshal.SizeOf(inbi));
inbi.biWidth = width;
inbi.biHeight = height;
inbi.biPlanes = 1;
inbi.biBitCount = Convert.ToUInt16(countBitsPerPixel);

byte[] outImgData = new byte[(outbi.biHeight * outbi.biWidth * (outbi.biBitCount / 8))];
GCHandle outImgHnd = GCHandle.Alloc(outImgData, GCHandleType.Pinned);

UInt32 lpckid = new Int32();
UInt32 lpdwflags = new Int32();

int i = Avi.ICCompress(compressorHnd,
                    0,
                    ref outbi,
                    outImgHnd.AddrOfPinnedObject(),
                    ref inbi,
                    inBmpDat.Scan0,
                    out lpckid,
                    out lpdwflags,
                    frameNum,
                    0,
                    5000,
                    IntPtr.Zero,
                    IntPtr.Zero);


So the ICCompress call returns -2 and there is no data in outImgData. Does anyone know where I have gone wrong?
AnswerRe: Help with importing DLL Pin
TimSWatson23-Apr-10 1:18
TimSWatson23-Apr-10 1:18 
GeneralRe: Help with importing DLL Pin
#realJSOP23-Apr-10 1:45
mve#realJSOP23-Apr-10 1:45 
QuestionCreating UDL... Pin
The_Collector22-Apr-10 22:55
The_Collector22-Apr-10 22:55 
AnswerRe: Creating UDL... Pin
Dave Kreskowiak23-Apr-10 3:46
mveDave Kreskowiak23-Apr-10 3:46 
GeneralRe: Creating UDL... Pin
The_Collector23-Apr-10 16:18
The_Collector23-Apr-10 16:18 
QuestionProgressBar while getting data from webservice Pin
igalep13222-Apr-10 22:45
igalep13222-Apr-10 22:45 
AnswerRe: ProgressBar while getting data from webservice Pin
Luc Pattyn22-Apr-10 23:44
sitebuilderLuc Pattyn22-Apr-10 23:44 
AnswerRe: ProgressBar while getting data from webservice Pin
#realJSOP22-Apr-10 23:46
mve#realJSOP22-Apr-10 23:46 
GeneralRe: ProgressBar while getting data from webservice Pin
igalep13224-Apr-10 10:04
igalep13224-Apr-10 10:04 
GeneralRe: ProgressBar while getting data from webservice Pin
igalep13227-Apr-10 10:35
igalep13227-Apr-10 10:35 
Questionreferencing dll Pin
Member 59031022-Apr-10 20:18
Member 59031022-Apr-10 20:18 
AnswerRe: referencing dll Pin
Ice_Freez0522-Apr-10 21:44
Ice_Freez0522-Apr-10 21:44 
AnswerRe: referencing dll Pin
Dave Kreskowiak23-Apr-10 3:44
mveDave Kreskowiak23-Apr-10 3:44 
Questiondays of week Pin
Tauseef A22-Apr-10 19:35
Tauseef A22-Apr-10 19:35 
AnswerRe: days of week Pin
Sandeep Mewara22-Apr-10 19:57
mveSandeep Mewara22-Apr-10 19:57 
AnswerRe: days of week Pin
Peace ON22-Apr-10 21:12
Peace ON22-Apr-10 21:12 
GeneralRe: days of week Pin
Richard MacCutchan22-Apr-10 21:26
mveRichard MacCutchan22-Apr-10 21:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.