SkylineGlobe MFC C++ 开发示例代码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SkylineGlobe MFC C++ 开发示例代码相关的知识,希望对你有一定的参考价值。

SkylineGlobe的SDK底层是跨平台的C++内核,面向不同平台封装原生的API,具有很高的执行效率,

下面是C++二次开发时的示例代码:

#import "D:\Program Files (x86)\Skyline\TerraExplorer Pro\TerraExplorerX.dll" no_namespace, named_guids

 

void OnLoadFinished();
    void OnFileClosing();
    void OnFrame();
    void OnRButtonDown(long Flags, int X, int Y, VARIANTARG *pbHandled);
	
	ITerraExplorer51Ptr m_spTE;
    DWORD m_dwCookie;

 

// SAMPLE CODE: Implementation for the dispatch and interface maps
BEGIN_DISPATCH_MAP(CMFCEmbeddedTEDlg, CCmdTarget)
    DISP_FUNCTION_ID(CMFCEmbeddedTEDlg, "OnLoadFinished", 1,OnLoadFinished, VT_EMPTY, VTS_NONE)
    DISP_FUNCTION_ID(CMFCEmbeddedTEDlg, "OnFileClosing", 2,OnFileClosing, VT_EMPTY, VTS_NONE)
    DISP_FUNCTION_ID(CMFCEmbeddedTEDlg, "OnFrame", 3,OnFrame, VT_EMPTY, VTS_NONE)
    DISP_FUNCTION_ID(CMFCEmbeddedTEDlg, "OnRButtonDown", 13,OnRButtonDown, VT_EMPTY, VTS_I4 VTS_I4 VTS_I4 VTS_PVARIANT)
END_DISPATCH_MAP()

BEGIN_INTERFACE_MAP(CMFCEmbeddedTEDlg, CCmdTarget)
    INTERFACE_PART(CMFCEmbeddedTEDlg, __uuidof(_ITerraExplorerEvents5), Dispatch)
END_INTERFACE_MAP()

 

// TODO: Add extra initialization here
	
    m_dwCookie = 0;
		
	// Create TerraExplorer COM object
	HRESULT hr = m_spTE.CreateInstance(CLSID_TerraExplorer);
	if (SUCCEEDED(hr))
	{	
    	// Register an event handler for TerraExplorer events
	    BOOL bAdvised = AfxConnectionAdvise(m_spTE,                                             
	                                        __uuidof(_ITerraExplorerEvents5), 
	                                        GetInterface(&IID_IUnknown), 
	                                        TRUE, &m_dwCookie);
	    ASSERT(bAdvised);
    }

 

// SAMPLE CODE: Add OnDestroy handler and disconnect m_TerraExplorerEvents from the TerraExplorer object
void CMFCEmbeddedTEDlg::OnDestroy()
{
    // Must disconnect the event handler before the destruction of the dialog window and the TerraExplorer object.   
    if (m_dwCookie)
    {
        BOOL bUnadvised = AfxConnectionUnadvise(m_spTE, __uuidof(_ITerraExplorerEvents5),
                                                GetInterface(&IID_IUnknown),
                                                TRUE, m_dwCookie);

        TRACE("Unadvise for ITerraExplorerEvents5 %s\n", bUnadvised ? "succeeded" : "failed");
        m_dwCookie = 0;
    }

    m_spTE = NULL;

    CDialog::OnDestroy();

    // TODO: Add your message handler code here
}

void CMFCEmbeddedTEDlg::OnBnClickedLoadFly()
{    
    m_spTE->Load(_T("C:\\Users\\Administrator\\Desktop\\tempsh.FLY"));
}

 

以上是关于SkylineGlobe MFC C++ 开发示例代码的主要内容,如果未能解决你的问题,请参考以下文章

C# & C++ MFC : 使用文件夹文件计数和顺序创建书页

如何在 C++(MFC)中开发 Maya 视口扩展 [关闭]

如何学习 MFC C++ 2013

MFC 对话框错误中的 C++ 多线程

C++ MFC 构建错误,但组件不是 MFC

C++ MFC开发串口通信之多个编辑框输出