1 Star 0 Fork 0

soui3-demo/mclistview_demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mclistview_demo.cpp 2.89 KB
一键复制 编辑 原始数据 按行查看 历史
// dui-demo.cpp : main source file
//
#include "stdafx.h"
#include "StudentSmsDlg.h"
//从PE文件加载,注意从文件加载路径位置
#define RES_TYPE 1
//#define RES_TYPE 0 //从文件中加载资源
// #define RES_TYPE 1 //从PE资源中加载UI资源
#ifdef _DEBUG
#define SYS_NAMED_RESOURCE _T("soui-sys-resourced.dll")
#else
#define SYS_NAMED_RESOURCE _T("soui-sys-resource.dll")
#endif
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int /*nCmdShow*/)
{
HRESULT hRes = OleInitialize(NULL);
SASSERT(SUCCEEDED(hRes));
int nRet = 0;
SComMgr *pComMgr = new SComMgr;
//将程序的运行路径修改到项目所在目录所在的目录
TCHAR szCurrentDir[MAX_PATH] = { 0 };
GetModuleFileName(NULL, szCurrentDir, sizeof(szCurrentDir));
LPTSTR lpInsertPos = _tcsrchr(szCurrentDir, _T('\\'));
_tcscpy(lpInsertPos + 1, _T("..\\mclistview_demo"));
SetCurrentDirectory(szCurrentDir);
{
BOOL bLoaded=FALSE;
CAutoRefPtr<SOUI::IImgDecoderFactory> pImgDecoderFactory;
CAutoRefPtr<SOUI::IRenderFactory> pRenderFactory;
bLoaded = pComMgr->CreateRender_Skia((IObjRef**)&pRenderFactory);
SASSERT_FMT(bLoaded,_T("load interface [render] failed!"));
bLoaded=pComMgr->CreateImgDecoder((IObjRef**)&pImgDecoderFactory);
SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),_T("imgdecoder"));
pRenderFactory->SetImgDecoderFactory(pImgDecoderFactory);
SApplication *theApp = new SApplication(pRenderFactory, hInstance);
theApp->RegisterWindowClass<SSearchDropdownList>();
//从DLL加载系统资源
HMODULE hModSysResource = LoadLibrary(SYS_NAMED_RESOURCE);
if (hModSysResource)
{
CAutoRefPtr<IResProvider> sysResProvider;
CreateResProvider(RES_PE, (IObjRef**)&sysResProvider);
sysResProvider->Init((WPARAM)hModSysResource, 0);
theApp->LoadSystemNamedResource(sysResProvider);
FreeLibrary(hModSysResource);
}else
{
SASSERT(0);
}
CAutoRefPtr<IResProvider> pResProvider;
#if (RES_TYPE == 0)
CreateResProvider(RES_FILE, (IObjRef**)&pResProvider);
if (!pResProvider->Init((LPARAM)_T("uires"), 0))
{
SASSERT(0);
return 1;
}
#else
CreateResProvider(RES_PE, (IObjRef**)&pResProvider);
pResProvider->Init((WPARAM)hInstance, 0);
#endif
theApp->AddResProvider(pResProvider);
theApp->InitXmlNamedID(namedXmlID,ARRAYSIZE(namedXmlID),TRUE);
// BLOCK: Run application
{
CStudentSmsDlg dlgMain;
nRet = dlgMain.DoModal();
}
delete theApp;
}
delete pComMgr;
OleUninitialize();
return nRet;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/soui3-demo/mclistview_demo.git
git@gitee.com:soui3-demo/mclistview_demo.git
soui3-demo
mclistview_demo
mclistview_demo
master

搜索帮助