BOOL CFilterEdit::SetCancelBitmaps(UINT uCancelNormal, UINT uCancelPressed, BOOL bShowAlways) { m_bShowCancelButtonAlways = bShowAlways; if (m_hIconCancelNormal) DestroyIcon(m_hIconCancelNormal); if (m_hIconCancelPressed) DestroyIcon(m_hIconCancelPressed); m_hIconCancelNormal = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uCancelNormal), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); m_hIconCancelPressed = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uCancelPressed), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); if ((m_hIconCancelNormal == 0) || (m_hIconCancelPressed == 0)) return FALSE; m_sizeCancelIcon = GetIconSize(m_hIconCancelNormal); ResizeWindow(); return TRUE; }
CString AfxModuleLoadString( UINT nID ) { HINSTANCE hInstanceOld = AfxGetResourceHandle(); AfxSetResourceHandle( AfxGetModuleHandle() ); CString string; string.LoadString( nID ); AfxSetResourceHandle( hInstanceOld ); return string; }
void CNetworkHeaderBar::SetTitle(LPCTSTR lpszTitle) { if ( m_strTitle.CompareNoCase(lpszTitle) ) { m_strTitle = lpszTitle; if (m_hWnd) Invalidate(); } HICON m_hIcon = (HICON)LoadImage( AfxGetResourceHandle(), MAKEINTRESOURCE( IDI_CONNECT ), IMAGE_ICON, 16, 16, 0 ); CWnd::SetIcon( m_hIcon, FALSE ); }
void CMobileOpalDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog(AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_MOBILEOPAL_DIALOG_WIDE) : MAKEINTRESOURCE(IDD_MOBILEOPAL_DIALOG)); } }
BOOL CIconImgList::LoadExtIconData( void) { // 通常アイコンの読み込み m_hBmpDefault = ::LoadBitmap( AfxGetResourceHandle(), MAKEINTRESOURCE( IDB_ICONIMG)); TCHAR szFilePath[ MAX_PATH]; int nLength = GetModuleFileName( NULL, szFilePath, MAX_PATH); for( int nIndex = nLength; nIndex >= 0; nIndex--) { if( TEXT( '\\') == szFilePath[ nIndex]) { lstrcpy( &szFilePath[ nIndex + 1], TEXT( "GetIcon.xml")); break; } } BOOL blResult = FALSE; MSXML2::IXMLDOMDocumentPtr piDocument; if( SUCCEEDED( piDocument.CreateInstance( _T( "Microsoft.XMLDOM")))) { piDocument->PutvalidateOnParse( VARIANT_TRUE); if( VARIANT_FALSE != piDocument->load( _variant_t( _bstr_t( szFilePath)))) { if( LoadIcons( piDocument)) { blResult = LoadGroups( piDocument); } } else { MSXML2::IXMLDOMParseErrorPtr piError; piError = piDocument->GetparseError(); long lCode = piError->GeterrorCode(); TRACE( _T( "0x%08X\n"), lCode); // 0x800C0005 if( NULL != piError && 0 != lCode && 0x800C0005/*INET_E_RESOURCE_NOT_FOUND*/ != lCode) { long lRaw = piError->Getline(); long lCol = piError->Getlinepos(); _bstr_t cBstr = piError->Getreason(); _bstr_t cBstrSrc = piError->GetsrcText(); CString cStr; cStr.Format( _T( "拡張アイコンデータファイルを解析できませんでした。\n%s\n\nソース:%s\n位置:%d行 %d文字"), ( ( char*)cBstr), ( ( char*)cBstrSrc), lRaw, lCol); MessageBox( NULL, cStr, NULL, MB_OK | MB_ICONEXCLAMATION); } } } return blResult; }
void VDEIODLL_EXPORT_API GetRect(CPoint& Point1,CPoint& Point2,BOOL& bFlag) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); HINSTANCE main_hInstance = AfxGetResourceHandle(); //获取主程序资源句柄 AfxSetResourceHandle(theApp.m_hInstance); //获取dll程序资源句柄 CWVedio Dlg; int ret = Dlg.DoModal(); if (ret == 100) { Dlg.GetPoint(Point1,Point2,bFlag); } }
HICON LoadIconFromModule(UINT uID, LPCTSTR lpzModuleName) { HICON hRet = NULL; HINSTANCE hResOld = SwitchResourceToModule(lpzModuleName); { hRet = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(uID)); } AfxSetResourceHandle(hResOld); return hRet; };
void Cexcxx_wce_sqlDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_SIMPLEPROJECT_DIALOG_WIDE) : MAKEINTRESOURCE(IDD_SIMPLEPROJECT_DIALOG)); } }
UINT ThreadProc(LPVOID pVoid) { if(ProgressDlg::hDialog == NULL) { DialogBox(AfxGetResourceHandle(), MAKEINTRESOURCE(DlgID), NULL,(DLGPROC)DialogProc); } return 1; }
void CThreadSynBySemaphoreDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_THREADSYNBYSEMAPHORE_DIALOG_WIDE) : MAKEINTRESOURCE(IDD_THREADSYNBYSEMAPHORE_DIALOG)); } }
void CAucma_HeaterDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_AUCMA_HEATER_DIALOG_WIDE) : MAKEINTRESOURCE(IDD_AUCMA_HEATER_DIALOG)); } }
//--------------------------------------------------------------------- // Function: OnCreate // Description: Called from the main windows create function // Parameters: CMDIFrameWnd *mainWnd = main frames CMDIFrameWnd pointer // Returns: . //--------------------------------------------------------------------- void CModelViewEditor::OnCreate(CMDIFrameWnd *mainWnd) { MENUINFOMESSAGE mim; CBitmap menuBitmap; HINSTANCE appInst; static DWORD msgHash_GetMenuInfo = CHashString(_T("GetMenuInfo")).GetUniqueID(); m_ToolBox->SendMessage(msgHash_GetMenuInfo, sizeof(MENUINFOMESSAGE), &mim); // get the apps instance handle for loading resources appInst = AfxGetResourceHandle(); // now tell the application to look in dll for resources AfxSetResourceHandle(ModelViewEditorDLL.hModule); // we need to mergeMenus VERIFY(MergeMenus(&m_DocTemplate->m_hMenuShared, mim.m_hMenu, _T("&Window"))); // and accelerators VERIFY(MergeAccelerators(&m_DocTemplate->m_hAccelTable, mim.m_hAccel)); mim.m_hAccel = NULL; mim.m_hMenu = NULL; // load up hi-res toolbar icon menuBitmap.LoadBitmap(IDB_TOOLBAR); // we don't really have to have to toolbar visible do we? mim.m_MenuRsrc = IDR_MODELVIEWTYPE; mim.m_MenuBitmap = &menuBitmap; static DWORD msgHash_SetMenuInfo = CHashString(_T("SetMenuInfo")).GetUniqueID(); m_ToolBox->SendMessage(msgHash_SetMenuInfo, sizeof(MENUINFOMESSAGE), &mim); static DWORD msgHash_RegisterResourceCollection = CHashString(_T("RegisterResourceCollection")).GetUniqueID(); DWORD result = m_ToolBox->SendMessage(msgHash_RegisterResourceCollection, sizeof(RESOURCECOLLECTION), &m_ObjCollection); if (result != MSG_HANDLED) { assert(0); } // We do not need to create Cal3D objects. Opening them seems to be enough //FILETYPECREATIONINFO fileInfo; //fileInfo.m_Description = MODELVIEW_EXTENSION_DESCRIPTION; //fileInfo.m_CreationCallback = CModelViewEditor::ModelViewEditorCreationCallback; //static DWORD msgHash_RegisterFileTypeCreationInfo = CHashString(_T("RegisterFileTypeCreationInfo")).GetUniqueID(); //result = m_ToolBox->SendMessage(msgHash_RegisterFileTypeCreationInfo, sizeof( FILETYPECREATIONINFO ), &fileInfo, NULL, NULL ); //if (result != MSG_HANDLED) //{ // assert(0); //} AfxSetResourceHandle(appInst); }
void VDEIODLL_EXPORT_API StartVedio(CString strFilePath,CString strFileName,int nRate, CPoint Point1,CPoint Point2,int nFlag,HWND GetCurHwnd) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); HINSTANCE main_hInstance = AfxGetResourceHandle(); //获取主程序资源句柄 AfxSetResourceHandle(theApp.m_hInstance); //获取dll程序资源句柄 if(NULL == lpVeioScreen) { lpVeioScreen = new VedioScreen(strFilePath,strFileName,nRate,Point1,Point2,nFlag,GetCurHwnd); lpVeioScreen->StartVedio(); } }
void CTITIANII_OSD_TESTDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_TITIANII_OSD_TEST_DIALOG_WIDE) : MAKEINTRESOURCE(IDD_TITIANII_OSD_TEST_DIALOG)); } }
bool CShellTreeList::createMEdUI(HWND hMainWnd) { CWnd* pWnd = CWnd::FromHandle(hMainWnd); m_hICON = LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_SHELLTREE)); CRect rectDummy(0, 0, 0, 0); const DWORD dwTreeStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS; m_wndTree.Create(dwTreeStyle, rectDummy, pWnd, 1200); return true; }
USAGEMODE HRESULT TXFlexRay_vShowConfigureMsgWindow(void* pParentWnd, ETYPE_BUS eBUS) { //Place this code at the beginning of the export function. //Save previous resource handle and switch to current one. HINSTANCE hInst = AfxGetResourceHandle(); AfxSetResourceHandle(TXFlexRayWindowDLL.hResource); int nRes = nShowTxWindow(pParentWnd, eBUS); AfxSetResourceHandle(hInst); return nRes; }
CChildWnd* Create(CXMLElement* pXML, CWindowManager* pWindows) { if ( CChildWnd* pChildWnd = pWindows->Find( RUNTIME_CLASS(CUserWnd) ) ) { FreeLibrary( AfxGetResourceHandle() ); } CChildWnd* pChildWnd = pWindows->Open( RUNTIME_CLASS(CUserWnd) ); // ((CMonitorWnd *)pChildWnd)->LayoutJobs( pXML ); return pChildWnd; }
void CCreateProgressDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_CREATEPROGRESS_DIALOG_WIDE) : MAKEINTRESOURCE(IDD_CREATEPROGRESS_DIALOG)); } }
void CBSObject::SetText(UINT uiTextResID) { CString strTemp; if (strTemp.LoadString(AfxGetResourceHandle(), uiTextResID)) { SetWindowText(strTemp); } else { strTemp = _T(""); } }
void get_dll_resource(void) { /* this function changes the resource handle to that of the DLL */ if (resource_counter == 0) { AFX_MODULE_STATE* pModule= AfxGetStaticModuleState(); save_hInstance = AfxGetResourceHandle(); AfxSetResourceHandle(pModule->m_hCurrentResourceHandle); } resource_counter++; }
void CMonitorWnd::OnUserBlacklst() { HINSTANCE hPrevInst = AfxGetResourceHandle(); HINSTANCE hInstance = m_hInstance ? (HINSTANCE)m_hInstance : NULL; if ( hInstance ) AfxSetResourceHandle( hInstance ); CBlacklstDlg dlg; dlg.DoModal(); AfxSetResourceHandle( hPrevInst ); }
void CVncViewerDlg::OnSize(UINT nType, int cx, int cy) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_VNCVIEWER_DIALOG_WIDE) : MAKEINTRESOURCE(IDD_VNCVIEWER_DIALOG)); } }
bool CScormEngine::LoadXmlResource(CString &csXml, UINT nResource) { HRSRC hRes = ::FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(nResource), _T("XML")); bool success = (hRes != NULL); DWORD dwSize = 0; if (success) { dwSize = ::SizeofResource(AfxGetResourceHandle(), hRes); success = (dwSize > 0); } HGLOBAL hGlobRes = NULL; if (success) { hGlobRes = ::LoadResource(AfxGetResourceHandle(), hRes); success = (hGlobRes != NULL); } LPVOID pData = NULL; if (success) { pData = ::LockResource(hGlobRes); success = (pData != NULL); } if (success) { // char * is on purpose; XML data is in ANSI or UTF8 encoding char *szXml = new char[dwSize + 1]; memcpy(szXml, pData, dwSize); szXml[dwSize] = (char) 0; // CString converts to _TCHAR automatically. csXml = szXml; delete[] szXml; } return success; }
void CMiniMule::UpdateContent(UINT uUpDatarate, UINT uDownDatarate) { ASSERT( GetCurrentThreadId() == g_uMainThreadId ); if (m_bResolveImages) { static const LPCTSTR _apszConnectedImgs[] = { _T("CONNECTEDNOTNOT.GIF"), _T("CONNECTEDNOTLOW.GIF"), _T("CONNECTEDNOTHIGH.GIF"), _T("CONNECTEDLOWNOT.GIF"), _T("CONNECTEDLOWLOW.GIF"), _T("CONNECTEDLOWHIGH.GIF"), _T("CONNECTEDHIGHNOT.GIF"), _T("CONNECTEDHIGHLOW.GIF"), _T("CONNECTEDHIGHHIGH.GIF") }; UINT uIconIdx = theApp.emuledlg->GetConnectionStateIconIndex(); if (uIconIdx >= ARRSIZE(_apszConnectedImgs)){ ASSERT(0); uIconIdx = 0; } TCHAR szModulePath[MAX_PATH]; DWORD dwModPathLen = GetModuleFileName(AfxGetResourceHandle(), szModulePath, _countof(szModulePath)); if (dwModPathLen != 0 && dwModPathLen < _countof(szModulePath)) { CString strFilePathUrl(CreateFilePathUrl(szModulePath, INTERNET_SCHEME_RES)); CComPtr<IHTMLImgElement> elm; GetElementInterface(_T("connectedImg"), &elm); if (elm) { CString strResourceURL; strResourceURL.Format(_T("%s/%s"), strFilePathUrl, _apszConnectedImgs[uIconIdx]); elm->put_src(CComBSTR(strResourceURL)); } } } SetElementHtml(_T("connected"), CComBSTR(theApp.IsConnected() ? GetResString(IDS_YES) : GetResString(IDS_NO))); SetElementHtml(_T("upRate"), CComBSTR(theApp.emuledlg->GetUpDatarateString(uUpDatarate))); SetElementHtml(_T("downRate"), CComBSTR(theApp.emuledlg->GetDownDatarateString(uDownDatarate))); UINT uCompleted = 0; if (thePrefs.GetRemoveFinishedDownloads()) uCompleted = thePrefs.GetDownSessionCompletedFiles(); else if (theApp.emuledlg && theApp.emuledlg->transferwnd && theApp.emuledlg->transferwnd->GetDownloadList()->m_hWnd) { int iTotal; uCompleted = theApp.emuledlg->transferwnd->GetDownloadList()->GetCompleteDownloads(-1, iTotal); // [Ded]: -1 to get the count of all completed files in all categories } SetElementHtml(_T("completed"), CComBSTR(CastItoIShort(uCompleted, false, 0))); SetElementHtml(_T("freeSpace"), CComBSTR(CastItoXBytes(GetFreeTempSpace(-1), false, false))); }
CBCGPRibbonCustomizeRibbonPage::CBCGPRibbonCustomizeRibbonPage( CBCGPRibbonBar* pRibbonBar, BOOL bShowHiddenCategories) : CBCGPPropertyPage(CBCGPRibbonCustomizeRibbonPage::IDD), m_wndRibbonTreeSrc(NULL, pRibbonBar, bShowHiddenCategories), m_wndRibbonTreeDest(&m_CustomizationData, pRibbonBar, bShowHiddenCategories) { ASSERT_VALID (pRibbonBar); //{{AFX_DATA_INIT(CBCGPRibbonCustomizeRibbonPage) m_nCategory = -1; m_nRibbonTabsDest = 1; //}}AFX_DATA_INIT m_pRibbonBar = pRibbonBar; CBCGPLocalResource locaRes; m_psp.hInstance = AfxGetResourceHandle (); m_bIsCustomizeKeyboard = TRUE; m_bNoContextCategories = FALSE; m_bDontProcessSelChanged = FALSE; m_pSelCategorySrc = NULL; m_pSelPanelSrc = NULL; m_pSelElemSrc = NULL; m_pSelCategoryDest = NULL; m_pSelPanelDest = NULL; m_pSelElemDest = NULL; if (m_pRibbonBar->m_bPrintPreviewMode) { m_pRibbonBar->SetPrintPreviewMode(FALSE); CFrameWnd* pParentFrame = m_pRibbonBar->GetParentFrame (); if (pParentFrame != NULL) { CBCGPFrameWnd* pFrameWnd = DYNAMIC_DOWNCAST(CBCGPFrameWnd, pParentFrame); if (pFrameWnd != NULL) { pFrameWnd->ClosePrintPreview(); } else { CBCGPMDIFrameWnd* pMDIFrameWnd = DYNAMIC_DOWNCAST(CBCGPMDIFrameWnd, pParentFrame); if (pMDIFrameWnd != NULL) { pMDIFrameWnd->ClosePrintPreview(); } } } } }
// 读取图片(从资源读) BOOL LoadBitmapFromIDResource(UINT nID, CBitmap &bitmap, CSize &size, CString strType) { HINSTANCE hInst = AfxGetResourceHandle(); HRSRC hRsrc = ::FindResource (hInst,MAKEINTRESOURCE(nID), strType); if (!hRsrc) { return FALSE; } DWORD len = SizeofResource(hInst, hRsrc); BYTE* lpRsrc = (BYTE*)LoadResource(hInst, hRsrc); if (!lpRsrc) { return FALSE; } HGLOBAL m_hMem = GlobalAlloc(GMEM_FIXED, len); BYTE* pmem = (BYTE*)GlobalLock(m_hMem); memcpy(pmem,lpRsrc,len); IStream* pstm; CreateStreamOnHGlobal(m_hMem,FALSE,&pstm); Bitmap* pBitmap = Gdiplus::Bitmap::FromStream(pstm); GlobalUnlock(m_hMem); GlobalFree(m_hMem); pstm->Release(); FreeResource(lpRsrc); HBITMAP hBitmap = NULL; Status status = pBitmap->GetLastStatus(); if(Ok == status) { status = pBitmap->GetHBITMAP(Color(0,0,0), &hBitmap); delete pBitmap; if(Ok == status) { if(bitmap.m_hObject != NULL) { bitmap.Detach(); } bitmap.Attach(hBitmap); BITMAP bmInfo; ::GetObject( bitmap.m_hObject, sizeof(BITMAP), &bmInfo ); size.cx = bmInfo.bmWidth; size.cy = bmInfo.bmHeight; return TRUE; } } return FALSE; }
//--------------------------------------------------------------------- // Function: Initialize // Description: Initialization like InitInstace // Parameters: . // Returns: TRUE, if successful //--------------------------------------------------------------------- BOOL CObjLoader::Initialize() { CString tName; HINSTANCE appInst; CGuiMDIFrame *mainWnd; // Register the doc templates we provide to the app CWinApp* pApp = AfxGetApp(); ASSERT(pApp != NULL); if (pApp == NULL) { return FALSE; } mainWnd = DYNAMIC_DOWNCAST(CGuiMDIFrame, pApp->m_pMainWnd); // get the apps instance handle for loading resources appInst = AfxGetResourceHandle(); // now tell the application to look in dll for resources AfxSetResourceHandle(ObjLoaderDLL.hModule); // use my string / icon resources // *** note IDR_TEXTURE type needs to be unique ID even between // dlls m_DocTemplate = new CMultiDocTemplate(IDR_TEXTURETYPE, RUNTIME_CLASS(CObjDoc), RUNTIME_CLASS(CMDIChildWnd), RUNTIME_CLASS(CObjView)); pApp->AddDocTemplate(m_DocTemplate); VERIFY(MergeMenus(&m_DocTemplate->m_hMenuShared, *(m_ProgramInfo->curMenu), _T("&Window"))); VERIFY(MergeAccelerators(&m_DocTemplate->m_hAccelTable, *(m_ProgramInfo->curAccel))); // construct resource info m_ObjInfo.name.LoadString(IDS_OBJECT_NAME); m_ObjInfo.pageIndex = &m_PageIndex; m_ObjInfo.icon = (HICON)LoadImage(ObjLoaderDLL.hModule, MAKEINTRESOURCE(IDR_TEXTURETYPE), IMAGE_ICON, 0, 0, LR_CREATEDIBSECTION); VERIFY(m_ObjInfo.icon != NULL); // value should be 1 - 1000 m_ObjInfo.priority = IDR_TEXTURETYPE; m_ObjInfo.objFlags = OBJFLAGS_EXPORTABLE | OBJFLAGS_IMPORTABLE | OBJFLAGS_THUMBNAIL; AfxSetResourceHandle(appInst); return TRUE; }
USAGEMODE HRESULT TS_vShowTSExecutorWindow(void* pParentWnd) { //Place this code at the beginning of the export function. //Save previous resource handle and switch to current one. HINSTANCE hInst = AfxGetResourceHandle(); AfxSetResourceHandle(TestSuiteExecutor.hResource); if( g_pomTSExecutorChildWindow == NULL ) { // Create New Instance g_pomTSExecutorChildWindow = new CTSExecutorChildFrame; if( g_pomTSExecutorChildWindow != NULL ) { //// Register Window Class //TODO::ICON LPCTSTR strMDIClass = AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, LoadCursor(NULL, IDC_CROSS), 0, NULL ); CRect omRect(63, 913, 4, 596); if( g_pomTSExecutorChildWindow->Create( strMDIClass, _T("Test Suite Executor"), WS_CHILD | WS_OVERLAPPEDWINDOW|WS_THICKFRAME, omRect, ((CMDIFrameWnd*)pParentWnd)) == TRUE ) { g_pomTSExecutorChildWindow->SetConfigurationData(m_pbyConfigData, m_unConfigSize); // Show window and set focus g_pomTSExecutorChildWindow->ShowWindow( SW_SHOW); g_pomTSExecutorChildWindow->SetFocus(); } } else { //Place this at the end of the export function. //switch back to previous resource handle. AfxSetResourceHandle(hInst); return S_FALSE; } } // If already exist then activate and set the focus else { g_pomTSExecutorChildWindow->ShowWindow( SW_RESTORE ); g_pomTSExecutorChildWindow->MDIActivate(); g_pomTSExecutorChildWindow->SetActiveWindow(); } //Place this at the end of the export function. //switch back to previous resource handle. AfxSetResourceHandle(hInst); return S_OK; }
BOOL CDizzyDialog::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult ) { TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; UINT nID = pNMHDR->idFrom; if (pTTT->uFlags & TTF_IDISHWND) { nID = ::GetDlgCtrlID((HWND)nID); if(nID) { switch (nID) { case IDC_INPUT_LIST: pTTT->lpszText = "Current rotation list"; break; case IDC_INPUT_BOX: pTTT->lpszText = "Enter rotation to be added"; break; case IDC_DELETE_BUTTON: pTTT->lpszText = "Delete selected rotation"; break; case IDC_CLEAR_BUTTON: pTTT->lpszText = "Clear all rotations"; break; case IDC_ADD_BUTTON: pTTT->lpszText = "Add rotation to list"; break; case IDOK: pTTT->lpszText = "Exit Dizzy"; break; case IDC_ABOUT_BUTTON: pTTT->lpszText = "About Dizzy"; break; case IDC_HELP_BUTTON: pTTT->lpszText = "Get help on using Dizzy"; break; case IDC_PASTE_BUTTON: pTTT->lpszText = "Paste from clipboard"; break; case IDC_COPY_BUTTON: pTTT->lpszText = "Copy result to clipboard"; break; case IDC_RESULT_BOX: pTTT->lpszText = "Result"; break; case IDC_UP_BUTTON: pTTT->lpszText = "Move selected rotation up"; break; case IDC_DOWN_BUTTON: pTTT->lpszText = "Move selected rotation down"; break; case IDC_ONTOP: UpdateData(TRUE); if (m_bOnTop) pTTT->lpszText = "Stop window from staying on top."; else pTTT->lpszText = "Keep window above others."; break; case IDC_PRECISION: pTTT->lpszText = "The maximum number of figures to display after the decimal point."; break; case IDC_PRECISION_SPIN: pTTT->lpszText = "Changes the precision value."; break; default: TRACE("Unknown ToolTip - ID : %d\n", nID); } pTTT->hinst = AfxGetResourceHandle(); return(TRUE); } } return(FALSE); }
CColorDialog::CColorDialog( COLORREF clrInit, DWORD dwFlags, CWnd *pParentWnd ) : CCommonDialog( pParentWnd ) /*******************************/ { m_cc.lStructSize = sizeof( CHOOSECOLOR ); m_cc.hwndOwner = pParentWnd->GetSafeHwnd(); m_cc.hInstance = (HWND)AfxGetResourceHandle(); m_cc.rgbResult = clrInit; m_cc.lpCustColors = _CustomColors; m_cc.Flags = dwFlags | CC_RGBINIT | CC_ENABLEHOOK; m_cc.lpfnHook = AfxCommDlgProc; m_cc.lpTemplateName = NULL; }