现在 c++有一个方法: int CPAPISetScanParam( LPCPAPISCANINFO pInfo )
【说 明】
CPAPISetScanParam 用于在pInfo 所指定的扫描参数中,设置CapturePerfect 的扫描参数。请在进
行扫描前调出该函数。
【自变量】
pInfo:指定保存扫描参数的CPAPISCANINFO 结构指针。--------------------------------------------------------------
LPCPAPISCANINFO 结构
typedef struct tagCpAPIScanInfo{
DWORD dwSize;
BOOL bOverWrite;
BOOL bScanContinue;
BOOL bShowDriver;
int nStartPage;
LPCTSTR lpszProfile;
LPCTSTR lpszUserPassword;
LPCTSTR lpszOwnerPassword;
DWORD dwAuthorityFlags;
DWORD dwCallbackFunc;
DWORD dwParam1;
long lMaxScanPages;
}CPAPISCANINFO, *LPCPAPISCANINFO;
【说 明】
是用于保存所有扫描参数的结构。
【自变量】
dwCallbackFunc :指定CallBack 函数的地址。如果发生事件,CapturePerfect SDK 则调出该
CallBack 函数。
int CallBackFunc(int nEvent, WPARAM wParam, LPARAM lParam, DWORD dwParam1)小弟现在想在c# 中调用上面的方法,但这个结构不知道怎么定义,求帮助

解决方案 »

  1.   


            struct tagCpAPIScanInfo
            {
                uint dwSize;
                bool bOverWrite;
                bool bScanContinue;
                bool bShowDriver;
                int nStartPage;
                string lpszProfile;
                string lpszUserPassword;
                string lpszOwnerPassword;
                uint dwAuthorityFlags;
                uint dwCallbackFunc;
                uint dwParam1;
                long lMaxScanPages;
            }
      

  2.   


    但这个dwCallbackFunc成员是指向一个方法的地址,这个怎么写呢?
      

  3.   


    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
    public struct tagCpAPIScanInfo {
        public uint dwSize;
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
        public bool bOverWrite;
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
        public bool bScanContinue;
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
        public bool bShowDriver;
        public int nStartPage;
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPTStr)]
        public string lpszProfile;
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPTStr)]
        public string lpszUserPassword;
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPTStr)]
        public string lpszOwnerPassword;
        public uint dwAuthorityFlags;
        public uint dwCallbackFunc;
        public uint dwParam1;
        public int lMaxScanPages;
    }
        [System.Runtime.InteropServices.DllImportAttribute("<Unknown>", EntryPoint="CPAPISetScanParam")]
    public static extern  int CPAPISetScanParam(ref tagCpAPIScanInfo pInfo) ;不知道可以用不
    楼猪得试了
      

  4.   

    http://blog.csdn.net/carl2380/archive/2010/01/21/5219793.aspx这个会对你有帮助。