15,979
社区成员
发帖
与我相关
我的任务
分享
BOOL CResSkinApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CAppFace af ; //line 1
af.Start(_T("IDR_MY_URF"),GTP_LOAD_RESOURCE,NULL,_T("MYTYPE"),NULL) ; //line 2
/*
if(HRSRC hr = ::FindResource(NULL,"IDR_MY_URF","MYTYPE"))
{
ULONG nResSize = ::SizeofResource(NULL,hr) ;
if(HGLOBAL hz = ::LoadResource(NULL,hr))
{
char* p = (char*)LockResource(hz);
if(p)
af.Start(p,GTP_LOAD_MEMORY,nResSize,NULL,NULL) ;
}
}
*/
CResSkinDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
af.Remove() ; //Line 3
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
File: appface.h
Purpose: Use this class to load AppFace API easyly.
Version 0.2
Compatible with:
Microsoft Windows 9x, NT, 2000, XP
Microsoft Visual C++ 5-7
uses no MFC
*==========================================================
* Cpyright MatinSoft Inc. 2004.11.22
*
* COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
* OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
* THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
* OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
* CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
* THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
* SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
* PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER.
*
* Use at your own risk!
* ==========================================================
How to use it ?
1.Include this file in your project,and copy "AppFace.dll" to the project EXE file output folder.
2.Declare a global variable in your project: CAppFace g_af ;
3.Load appface before the first window created in the process by call: g_af.Start(char* UiResourceFile);
4.Before exit the process to release resource call this : g_af.Remove();
Others:
1.Load URF(UI Resource File) from disk file: g_af.Start(_T("c:\\Yourpath\\yoururf.urf")) ;
2.Load URF(UI Resource File) from Resource : g_af.Start(_T("IDR_URFNAME_YOURDEFINED"),GTP_LOAD_RESOURCE,(DWORD)::GetModuleHandle(NULL),_T("RESOURCETYPE")) ;
3.Load URF(UI Resource File) from Memory : g_af.Start((char*)pBuf,GTP_LOAD_MEMORY,nBufLen)
4.Change the application UI : g_af.Start(_T("c:\\Yourpath\\yourotherurf.urf")) ;
5.Return to windows default UI : g_af.Start() ;
Bug reported:
appface@matinsoft.com
http://www.matinsoft.com
http://www.appface.com
------------------------------------------------------------
这个类帮助您更容易的使用 AppFace 界面开发包
使用方法:
1. 将这个文件添加进您的工程,将"AppFace.dll"拷贝到EXE文件的输出目录
2. 在您的工程中声明一个全局变量 CAppFace g_af ;
3. 在创建第一个窗口前调用 g_af.Start(char * UiResourceFile) ;
4. 在程序退出前调用 g_af.Remove() ;
其它:
1.从磁盘文件加载 URF(UI Resource File) : g_af.Start(_T("c:\\Yourpath\\yoururf.urf")) ;
2.从资源加载 URF(UI Resource File) : g_af.Start(_T("IDR_URFNAME_YOURDEFINED"),GTP_LOAD_RESOURCE,(DWORD)::GetModuleHandle(NULL),_T("RESOURCETYPE")) ;
3.从内存加载 URF(UI Resource File) : g_af.Start((char*)pBuf,GTP_LOAD_MEMORY,nBufLen)
4.更换UI : g_af.Start(_T("c:\\Yourpath\\yourotherurf.urf")) ;
5.恢复Windows 默认界面 : g_af.Start() ;
Bug reported:
support_cn@matinsoft.com
http://www.matinsoft.com
http://www.appface.com
-------------------------------------------------------------
History:
AppFace.h 0.2 2004.11.25
Modified "Start" member fucntion to load urf file from resource or memory.
Modified the description for class CAppFace .
Supported UNICDOE
Added a help function, void T2C(IN LPCTSTR src,OUT char* dst,IN int dstlen)
which used to convert a TCHAR string to char string
AppFace.h 0.1 2004.09.25
Can work.