#ifndef DMREGISTER
#define DMREGISTER
#include <Windows.h>
#include <QLibrary>
#include "atlbase.h"
//#include "dm.tlh"
struct Idmsoft;
Idmsoft* DmReg(const char* file);
#endif // DMREGISTER
#include "DmReg.h"
#include "dm.tlh"
//#include "atlcom.h"
//#import "D:\\3.1233\\dm.dll" no_namespace
typedef HRESULT (__stdcall *Func) (REFCLSID,REFIID,LPVOID*);
Idmsoft *DmReg(const char* file)
{
//CoInitialize(0);
HRESULT hr;
Func GetClass=nullptr;
GetClass=(Func)QLibrary::resolve(file,"DllGetClassObject");
if(!GetClass)return nullptr;
IClassFactory* pFactory=nullptr;
hr=GetClass(__uuidof(dmsoft),IID_IClassFactory,(LPVOID*)&pFactory);
if(FAILED(hr))return nullptr;
Idmsoft* idmsoft=nullptr;
hr=pFactory->CreateInstance(NULL,__uuidof(Idmsoft),(LPVOID*)&idmsoft);
pFactory->Release();
if(!idmsoft)return nullptr;
return idmsoft;
}