一个简单问题,非常菜,可是我不会(100分)

  • 主题发起人 主题发起人 lk1023
  • 开始时间 开始时间
L

lk1023

Unregistered / Unconfirmed
GUEST, unregistred user!
怎么才能调用一个vc++写的com dll.

STDMETHOD MYCLASS::FUNCTIONNAME([in] first parameters,[in] second,[out] *result)
{
....
return S_OK !
}
 
把vc++里的函数先声明
例如:

function getfreediskspace(drive:char):integer;stdcall;external 'zwsd4.dll';
 
已经比我强了,向你学习。
 
[red]I Don't Know Either!!![/red][:D]
 
对于com,应该先把服务器(dll)在系统注册表中注册,再在客户程序中用interface调用。
 
敌人太谦虚了,你把我们往哪儿搁!这不算简单问题啊,
 
Var
O:Variant;
begin
O:=CreateComObject(GUID);
O.FunctionName(,,,);
end;
 
可以有两种方式,导入类型库和后期连接。
先期连接
var
t:itype;
begin
t:=cotype.create;
t.function();
end;


var
v:variant;
begin
v:=createoleobject(你的COM对象);
v.function;
end;
 
请看如下程序:,如能改成或详细介绍一下改的方法,我加200分,其中ring3.dll已注册
IKodakCameraManagerPtr为其中的成员函数
// HydraSampleDlg.h : header file
//

#if !defined(AFX_HYDRASAMPLEDLG_H__0CC908E9_4C30_11D4_A8BF_00A024BB3D37__INCLUDED_)
#define AFX_HYDRASAMPLEDLG_H__0CC908E9_4C30_11D4_A8BF_00A024BB3D37__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


//Incorporate information from the ring3 type library

//In case of a compile error:
//Search your hard drive to obtain the installed location of the ring3.dll.
//If necessary, edit the path below for your compiler to find it.

//#import "ring3.dll" no_namespace named_guids
#import "c:/Program Files/Common Files/Kodak/IFSCore/Ring3/ring3.dll" no_namespace named_guids
//#import "e:/Winnt/System32/ring3.dll" no_namespace named_guids

#define USER_DESCR_STRING_LEN 100 //String to hold camera description must be this big.

/////////////////////////////////////////////////////////////////////////////
// CHydraSampleDlg dialog

class CHydraSampleDlg : public CDialog
{
// Construction
public:
CHydraSampleDlg(CWnd* pParent = NULL); // standard constructor

~CHydraSampleDlg();

// Dialog Data
//{{AFX_DATA(CHydraSampleDlg)
enum { IDD = IDD_HYDRASAMPLE_DIALOG };
CStatic m_Thumbnail;
CComboBox m_expIndexCombo;
CComboBox m_expModeCombo;
CComboBox m_zoomCombo;
CEdit m_GetParmsBox;
CComboBox m_listcombobox;
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHydraSampleDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
HICON m_hIcon;

// Generated message map functions
//{{AFX_MSG(CHydraSampleDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnEditSelChangeSelectcamera();
afx_msg void OnTakeasync();
afx_msg void OnRefreshget();
afx_msg void OnFormatmedia();
afx_msg void OnSelchangeZoomcombo();
afx_msg void OnSelchangeExpmodecombo();
afx_msg void OnSelchangeExpindexcombo();
afx_msg void OnTakepict();
afx_msg void OnRadio1();
afx_msg void OnRadio2();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

private:

IKodakCameraManagerPtr m_pCameraManager;

long m_lError;

void CHydraSampleDlg::PrintVariant(HRESULT hr, LPCTSTR szLabel, VARIANT _result);
void GetParms(IKodakDCCameraPtr pCurrentSettings);
void PrintKlong(HRESULT hr, LPCTSTR szLabel, HYDRA_KLONG kLong);
void PrintKMlong(HRESULT hr, LPCTSTR szLabel, HYDRA_EXPOSURE_MODES kMLong);
void PrintKBool(HRESULT hr, LPCTSTR szLabel, HYDRA_KBOOL kBool);

IKodakDCCameraPtr GetCurrentCamera();


};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_HYDRASAMPLEDLG_H__0CC908E9_4C30_11D4_A8BF_00A024BB3D37__INCLUDED_)
 
后退
顶部