// Note: Proxy/Stub Information
// To merge the proxy/stub code into the object DLL, add the file
// dlldatax.c to the project. Make sure precompiled headers
// are turned off for this file, and add _MERGE_PROXYSTUB to the
// d…
[/Quote]
你看你工程的中idl文件,里面有对应的clsid信息
这个是我的源文件,封装了一下第三方的dll的几个方法,把他变成com组件模式的,希望在java中调用
// KDGTComm.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To merge the proxy/stub code into the object DLL, add the file
// dlldatax.c to the project. Make sure precompiled headers
// are turned off for this file, and add _MERGE_PROXYSTUB to the
// defines for the project.
//
// If you are not running WinNT4.0 or Win95 with DCOM, then you
// need to remove the following define from dlldatax.c
// #define _WIN32_WINNT 0x0400
//
// Further, if you are running MIDL without /Oicf switch, you also
// need to remove the following define from dlldatax.c.
// #define USE_STUBLESS_PROXY
//
// Modify the custom build rule for KDGTComm.idl by adding the following
// files to the Outputs.
// KDGTComm_p.c
// dlldata.c
// To build a separate proxy/stub DLL,
// run nmake -f KDGTCommps.mk in the project directory.
//write by 高纪 BeginWrite
int KCBPCLI_BeginWrite()
{
HINSTANCE hDll = LoadLibrary("d:\\windows_v5.2\\KCBPCli.dll");
int result = 0;
lpBeginWrite beginwrite;
//write by 高纪 CallProgramAndCommit(servername)
int KCBPCLI_CallProgramAndCommit(char *ServerName)
{
HINSTANCE hDll = LoadLibrary("d:\\windows_v5.2\\KCBPCli.dll");
int result = 0;
lpCallProgramAndCommit commit;
//write by 高纪 RsGetCursorName()
int KCBPCLI_RsGetCursorName(char *pszCursorName, int nLen)
{
HINSTANCE hDll = LoadLibrary("d:\\windows_v5.2\\KCBPCli.dll");
int result = 0;
lpRsGetCursorName getcursorname;
//lpRsFetchRow
//write by 高纪 RsFetchRow()
int KCBPCLI_RsFetchRow()
{
HINSTANCE hDll = LoadLibrary("d:\\windows_v5.2\\KCBPCli.dll");
int result = 0;
lpRsFetchRow fetchrow;
//write by 高纪 RsGetCol()
int KCBPCLI_RsGetCol(int nLen, char *pszCursorName)
{
HINSTANCE hDll = LoadLibrary("d:\\windows_v5.2\\KCBPCli.dll");
int result = 0;
lpRsGetCol getcol;
//write by 高纪 RsGetCol()
int KCBPCLI_DisConnect()
{
HINSTANCE hDll = LoadLibrary("d:\\windows_v5.2\\KCBPCli.dll");
int result = 0;
lpDisConnect disconnect;
VC默认生成的代码如下:
// tDll.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To merge the proxy/stub code into the object DLL, add the file
// dlldatax.c to the project. Make sure precompiled headers
// are turned off for this file, and add _MERGE_PROXYSTUB to the
// defines for the project.
//
// If you are not running WinNT4.0 or Win95 with DCOM, then you
// need to remove the following define from dlldatax.c
// #define _WIN32_WINNT 0x0400
//
// Further, if you are running MIDL without /Oicf switch, you also
// need to remove the following define from dlldatax.c.
// #define USE_STUBLESS_PROXY
//
// Modify the custom build rule for tDll.idl by adding the following
// files to the Outputs.
// tDll_p.c
// dlldata.c
// To build a separate proxy/stub DLL,
// run nmake -f tDllps.mk in the project directory.