本文整理汇总了C++中CComModule::GetResourceInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ CComModule::GetResourceInstance方法的具体用法?C++ CComModule::GetResourceInstance怎么用?C++ CComModule::GetResourceInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComModule
的用法示例。
在下文中一共展示了CComModule::GetResourceInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wWinMain
extern "C" int WINAPI wWinMain(HINSTANCE hInstance,
HINSTANCE /*hPrevInstance*/, __in LPWSTR lpCmdLine, int /*nShowCmd*/)
{
lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
CoInitialize(0);
_Module.Init( ObjectMap, hInstance, &LIBID_ATLLib );
::InitCommonControls();
RECT rcPos = { CW_USEDEFAULT, 0, 0, 0 };
HMENU hMenu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MENU1));
HICON hIcon = LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON1));
CWMPHost frame;
frame.GetWndClassInfo().m_wc.hIcon = hIcon;
frame.Create(GetDesktopWindow(), rcPos, L"WMP Host Container", 0, 0, (UINT)hMenu);
frame.ShowWindow(SW_SHOWNORMAL);
MSG msg;
while (GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
_Module.Term();
CoUninitialize();
return 0;
}
示例2:
HRESULT CObjectFeatureScript2::SetLong (CebThread & Thread, BOOL fBreak, BOOL fAuto, LPCSTR lpcstr)
{
ASSERT(lpcstr);
if (NULL == lpcstr) return E_POINTER;
long lName = (long)(LPSTR)lpcstr;
Thread.SetLong (SETLONG_BREAK, fBreak); // BreakFlag voreinstellen
Thread.SetLong (SETLONG_AUTO, fAuto); // Auto voreinstellen
Thread.SetLong (SETLONG_NAME, lName); // Name voreinstellen
Thread.SetLong (SETLONG_HPROJECT, reinterpret_cast<LONG>(DEX_GetDataSourceHandle())); // Datenquelle voreinstellen
Thread.SetLong (SETLONG_HINSTANCE, reinterpret_cast<LONG>(_Module.GetResourceInstance()));
return S_OK;
}
示例3: DownloadFile
//.........这里部分代码省略.........
HTTP_STATUS_FORBIDDEN is the same as 403 and
403 was specially handled few lines above! */
if (dwStatus == HTTP_STATUS_FORBIDDEN) {
if (bUIFeedback) {
bRetryHttpRequest = (IDRETRY == m_dlg->SafeMessageBox(
IDS_HTTP_STATUS_FORBIDDEN,
IDS_HTTP_INSTRUCTION_FORBIDDEN,
IDS_ERROR_CAPTION,
DIALOG_ERROR_RETRYCANCEL,
L"403"));
}
}
else if (dwStatus == HTTP_STATUS_SERVER_ERROR) {
if (bUIFeedback) {
bRetryHttpRequest = (IDRETRY == m_dlg->SafeMessageBox(
IDS_HTTP_STATUS_SERVER_ERROR,
IDS_HTTP_INSTRUCTION_UNKNOWN_ERROR,
IDS_ERROR_CAPTION,
DIALOG_ERROR_RETRYCANCEL,
L"500"));
}
}
else if (dwStatus == HTTP_STATUS_SERVICE_UNAVAIL) {
if (numberOfRetry < 5) {
// If the server is busy, automatically retry
// We wait couple seconds before retry to avoid
// congestion
for (long i = (long) secondsToWait; i >= 0; i--) {
// Update status
if (bUIFeedback) {
char szBuffer[BUFFER_SIZE];
::LoadString(_Module.GetResourceInstance(),
IDS_DOWNLOAD_STATUS_RETRY, szStatus,
BUFFER_SIZE);
wsprintf(szBuffer, szStatus, i);
::SetWindowText(hProgressInfo, szBuffer);
}
// Sleep 1 second
::Sleep(1000);
}
// We use a semi-binary backoff algorithm to
// determine seconds to wait
numberOfRetry += 1;
secondsToWait = secondsToWait + 30;
bRetryHttpRequest = TRUE;
continue;
}
else {
if (bUIFeedback) {
bRetryHttpRequest = (IDRETRY == m_dlg->SafeMessageBox(
IDS_HTTP_STATUS_SERVICE_UNAVAIL,
IDS_HTTP_INSTRUCTION_SERVICE_UNAVAIL,
IDS_ERROR_CAPTION,
DIALOG_ERROR_RETRYCANCEL,
L"503"));
if (bRetryHttpRequest) {
numberOfRetry = 0;
secondsToWait = 60;
continue;
示例4: if
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance,
HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
{
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
HRESULT hRes = CoInitialize(NULL);
#endif
_ASSERTE(SUCCEEDED(hRes));
_Module.Init(ObjectMap, hInstance, NULL);
int nRet = 0;
// Various mode of operation
BOOL bSilentMode = FALSE;
TCHAR szTargetBaseVersionInfo[256];
TCHAR szTargetNewVersionInfo[256];
// Open patch trace file
OPEN_PATCH_TRACEFILE();
do
{
TCHAR szDirectory[BUFFER_SIZE];
szDirectory[0] = NULL;
//---------------------------------------------------
// Parse parameters from command line
//
if ((__argc == 2) ||
(__argc == 3 && lstrcmpi(__argv[1], TEXT("-s")) == 0))
{
// jupdate [-s] dir (Apply patch)
//
wsprintf(szDirectory, "%s", __argv[__argc - 1]);
//---------------------------------------------------
// Remove trailing '\' in path (#4689837)
//
int iPathLen = lstrlen(szDirectory);
if (szDirectory[iPathLen - 1] == '\\' || szDirectory[iPathLen - 1] == '\"')
szDirectory[iPathLen - 1] = NULL;
if (__argc == 3)
bSilentMode = TRUE;
}
else
{
// Invalid options
nRet = UPDATE_ERROR_OPTIONS;
break;
}
//---------------------------------------------------
// Check if VM is running
//
UINT uRet = IDRETRY;
while (IsVMRunning(szDirectory) && uRet == IDRETRY)
{
/*
// Should not ask user if we are in silent mode
if (bSilentMode)
{
nRet = UPDATE_ERROR_VM_RUNNING;
break;
}
else
*/ {
TCHAR szBuffer[BUFFER_SIZE], szMessage[BUFFER_SIZE], szCaption[BUFFER_SIZE];
::LoadString(_Module.GetResourceInstance(), IDS_ERROR_VM_RUNNING, szBuffer, BUFFER_SIZE);
::LoadString(_Module.GetResourceInstance(), IDS_CAPTION_WARNING, szCaption, BUFFER_SIZE);
wsprintf(szMessage, szBuffer, NEW_IMAGE_FULLVERSION);
uRet = MessageBox(NULL, szMessage, szCaption, MB_RETRYCANCEL | MB_ICONWARNING);
}
}
// Make sure we break out of the loop
if (nRet == UPDATE_ERROR_VM_RUNNING)
break;
if (uRet == IDCANCEL)
{
nRet = UPDATE_ERROR_VM_RUNNING;
break;
}
//---------------------------------------------------
// Retrieve version info of patched image and base image
//
// Retrieve version info of base image
if (RetrievePatchInfo(szDirectory, szTargetBaseVersionInfo) == FALSE)
{
// Cannot locate version.dat
//.........这里部分代码省略.........