• 大小: 73.09MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-12-21
  • 语言: 其他
  • 标签: VC++  免注册  大漠  

资源简介

//创建新的大漠对象 Idmsoft *InitNewDm() { Idmsoft *m_dm = NULL; //COleVariant temp1,temp2; bool m_bInit = false; //下面直接加载dll创建对象,避免进行注册文件 typedef HRESULT (__stdcall * pfnGCO) (REFCLSID, REFIID, void**); pfnGCO fnGCO = NULL; HINSTANCE hdllInst = LoadLibrary("dm.dll"); fnGCO = (pfnGCO)GetProcAddress(hdllInst, "DllGetClassObject"); if (fnGCO != 0) { IClassFactory* pcf = NULL; HRESULT hr=(fnGCO)(__uuidof(dmsoft), IID_IClassFactory, (void**)&pcf;); if (SUCCEEDED(hr) && (pcf != NULL)) { hr = pcf->CreateInstance(NULL, __uuidof(Idmsoft), (void**)&m_dm); if ((SUCCEEDED(hr) && (m_dm != NULL))==FALSE) return false; } pcf->Release(); m_bInit=true; } else m_bInit=false; return m_dm; };

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “atlbase.h“
#include “obj.h“

class MyDispatchDriver
{
public:
    IDispatch* p;
    MyDispatchDriver()
    {
        p = NULL;
    }
    MyDispatchDriver(IDispatch* lp)
    {
        if ((p = lp) != NULL)
            p->AddRef();
    }
    ~MyDispatchDriver() { if (p) p->Release(); }
    HRESULT GetIDOfName(LPCOLESTR lpsz DISPID* pdispid)
    {
        HRESULT hr = -1;
        if (p == NULL) return hr;
        return p->GetIDsOfNames(IID_NULL (LPOLESTR*)&lpsz 1 LOCALE_USER_DEFAULT pdispid);
    }
    HRESULT Invoke0(DISPID dispid VARIANT* pvarRet = NULL)
    {
        HRESULT hr = -1;
        DISPPARAMS dispparams = { NULL NULL 0 0};
        if (p == NULL) return hr;
        return p->Invoke(dispid IID_NULL LOCALE_USER_DEFAULT DISPATCH_METHOD &dispparams pvarRet NULL NULL);
    }
    HRESULT InvokeN(DISPID dispid VARIANT* pvarParams int nParams VARIANT* pvarRet = NULL)
    {
        HRESULT hr = -1;
        DISPPARAMS dispparams = { pvarParams NULL nParams 0};
        if (p == NULL) return hr;
        return p->Invoke(dispid IID_NULL LOCALE_USER_DEFAULT DISPATCH_METHOD &dispparams pvarRet NULL NULL);
    }
};

dmsoft::dmsoft()
{
    CLSID clsid;
    IUnknown * pUnknown = NULL;
    HRESULT hr;

    obj = NULL;
    hr = ::CLSIDFromProgID( L“dm.dmsoft“ &clsid );
    if (FAILED(hr))
    {
        return;
    }

    hr = ::CoCreateInstance( clsid NULL CLSCTX_ALL IID_IUnknown (LPVOID *)&pUnknown);
    if (FAILED(hr))
    {
        return;
    }

    pUnknown->QueryInterface(IID_IDispatch (void **)&obj);
    if (pUnknown) pUnknown->Release();
}

dmsoft::~dmsoft()
{
        if (obj) obj->Release();
}

long dmsoft::SetRowGapNoDict(long row_gap)
{
    static DISPID dispatch_id = -1;
    MyDispatchDriver spDisp(obj);
    HRESULT hr;
    COleVariant pn[1];
    CComVariant vResult;

    pn[0] = COleVariant(row_gap);

    if (dispatch_id == -1)
    {
        spDisp.GetIDOfName(L“SetRowGapNoDict“&dispatch_id);
    }

    hr = spDisp.InvokeN(dispatch_idpn1&vResult);
    if (SUCCEEDED(hr))
    {
        return vResult.lVal;
    }
    return 0;
}

long dmsoft::MoveDD(long dxlong dy)
{
    static DISPID dispatch_id = -1;
    MyDispatchDriver spDisp(obj);
    HRESULT hr;
    COleVariant pn[2];
    CComVariant vResult;

    pn[1] = COleVariant(dx);
    pn[0] = COleVariant(dy);

    if (dispatch_id == -1)
    {
        spDisp.GetIDOfName(L“MoveDD“&dispatch_id);
    }

    hr = spDisp.InvokeN(dispatch_idpn2&vResult);
    if (SUCCEEDED(hr))
    {
        return vResult.lVal;
    }
    return 0;
}

long dmsoft::FreeScreenData(long handle)
{
    static DISPID dispatch_id = -1;
    MyDispatchDriver spDisp(obj);
    HRESULT hr;
    COleVariant pn[1];
    CComVariant vResult;

    pn[0] = COleVariant(handle);

    if (dispatch_id == -1)
    {
        spDisp.GetIDOfName(L“FreeSc

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     40960  2019-02-24 18:03  test\.vs\test\v15\.suo

     文件   77717504  2019-02-24 18:03  test\.vs\test\v15\Browse.VC.db

     文件  120586240  2019-02-24 17:11  test\.vs\test\v15\ipch\407de3634375c9e0.ipch

     文件    3549752  2019-01-22 20:26  test\Debug\dm.dll

     文件   10877440  2019-02-24 17:58  test\Debug\test.exe

     文件   24510160  2019-02-24 17:58  test\Debug\test.ilk

     文件   30068736  2019-02-24 17:58  test\Debug\test.pdb

     文件    3549752  2019-01-22 20:26  test\test\Debug\dm.dll

     文件     102173  2019-01-22 20:26  test\test\Debug\dm.tlh

     文件     101724  2019-01-22 20:26  test\test\Debug\dm.tli

     文件    1929766  2019-02-24 16:59  test\test\Debug\obj.obj

     文件       9727  2019-02-24 17:03  test\test\Debug\RegDM.obj

     文件    1011620  2019-02-24 16:59  test\test\Debug\stdafx.obj

     文件         69  2019-02-24 17:58  test\test\Debug\test.log

     文件      74208  2019-02-24 16:59  test\test\Debug\test.obj

     文件   56754176  2019-02-24 16:59  test\test\Debug\test.pch

     文件    1431972  2019-02-24 16:59  test\test\Debug\test.res

     文件       3352  2019-02-24 17:58  test\test\Debug\test.tlog\CL.command.1.tlog

     文件      92046  2019-02-24 17:58  test\test\Debug\test.tlog\CL.read.1.tlog

     文件       3456  2019-02-24 17:58  test\test\Debug\test.tlog\CL.write.1.tlog

     文件       1494  2019-02-24 17:58  test\test\Debug\test.tlog\link.command.1.tlog

     文件       6054  2019-02-24 17:58  test\test\Debug\test.tlog\link.read.1.tlog

     文件        658  2019-02-24 17:58  test\test\Debug\test.tlog\link.write.1.tlog

     文件        248  2019-02-24 16:59  test\test\Debug\test.tlog\rc.command.1.tlog

     文件     164564  2019-02-24 16:59  test\test\Debug\test.tlog\rc.read.1.tlog

     文件        142  2019-02-24 16:59  test\test\Debug\test.tlog\rc.write.1.tlog

     文件        192  2019-02-24 17:58  test\test\Debug\test.tlog\test.lastbuildstate

     文件      48113  2019-02-24 17:58  test\test\Debug\testDlg.obj

     文件    1362944  2019-02-24 17:58  test\test\Debug\vc141.idb

     文件    9359360  2019-02-24 17:58  test\test\Debug\vc141.pdb

............此处省略34个文件信息

评论

共有 条评论