CSDN博客

img liyux

OLE DB API 程序设计

发表于2004/10/13 22:09:00  811人阅读

分类: [Win32]Ole DB

开始之前,需要知道的一些不属于OLE DB,但又需要用道的函数。

CoInitialize();

CoCreateInstance();
创建一个单一的,由CLSID指定的未初始化的类对象。
STDAPI CoCreateInstance(
  REECLSID rclsid, //Class identifier (CLSID) of the object
  LPUNKNOWN pUnkOuter, //Pointer to controlling IUnknow
  DWORD dwClsContext, //Context for running executable code
  REFIID riid,  //Reference to the identifier of the interface
  LPVOID * ppv  //Address of output variable that receives
);

REFCLSID rclsid,
REFIID riid,
两个id指定了组件及其接口。

DWORD dwClsContext = CLSCTX_INPROC_SERVER,

IDBPromptInitialize* pIDBPromptInitialize;
hr = CoCreateInstance(
  CLSID_DataLinks,
  NULL,
  CLSCTX_INPROC_SERVER,
  IID_IDBPromptInitialize,
  (void**)&pIDBPromptInitialize);


CoGetMalloc();
CoUninitialize();

包含的头文件:
#include <oledb.h>
#include <oledberr.h>
#include <msdasc.h>
#include <comdef.h>

#include "jetoledb.h"
#include "msjetoledb.h"

阅读全文
0 0

相关文章推荐

img
取 消
img