Exemplo n.º 1
0
BOOL CParticleEditor::Initialize( )
{
	CWinApp* pApp = AfxGetApp();
	ASSERT(pApp != NULL);
    if (pApp == NULL)
    {
        return FALSE;
    }

	// get the apps instance handle for loading resources
	m_AppInst = AfxGetResourceHandle();

	//Direct the application to look in dll for resources
	AfxSetResourceHandle(ParticleEditorDLL.hModule);

	// use my string / icon resources
	// Note IDR_EXAMPLETYPE has to be a unique id even between DLLS
	// to get the ICONS right on the Window
	m_DocTemplate = new CMultiDocTemplate(IDR_PARTICLETYPE,
			RUNTIME_CLASS(CParticleDoc),
			RUNTIME_CLASS(CParticleFrame),
			RUNTIME_CLASS(CParticleRenderView));

	// put this after setting the menu and accelerators so it won't allocate it's own
	pApp->AddDocTemplate(m_DocTemplate);

	// construct resource info
	m_ObjCollection.name.LoadString(IDS_RESOURCE_NAME);
	m_ObjCollection.pageIndex = &m_PageIndex;

	m_ObjCollection.hIcon = (HICON)LoadImage(ParticleEditorDLL.hModule, MAKEINTRESOURCE(IDR_PARTICLETYPE), 
		IMAGE_ICON, 0, 0, LR_CREATEDIBSECTION);
	VERIFY(m_ObjCollection.hIcon != NULL);

	// value should be 1 - 1000
	// NOTE: Against convention this was set at coding to 31000 even the example is set at 5000
	m_ObjCollection.priority = IDR_PARTICLETYPE; 
    m_ObjCollection.extensions = PARTICLE_EXTENSIONS;
    AfxSetResourceHandle(m_AppInst);

	return TRUE;
}
Exemplo n.º 2
0
VOID Language::UnInstallRunLanguage()///设置成保存的资源进程
{//卸载资源
 // ASSERT(m_hOldInstance!=NULL);
  if(m_hOldInstance==NULL)return;
  HINSTANCE hInstal;
  hInstal=AfxGetResourceHandle();
  ASSERT(FreeLibrary(hInstal));
  AfxSetResourceHandle(m_hOldInstance);
  m_hCurrentInstance=m_hOldInstance;
  m_hOldInstance=NULL;  
}
Exemplo n.º 3
0
void CMediaVisDlg::OnSetup()
{
	int nItem = m_wndList.GetNextItem( -1, LVIS_SELECTED );
	if ( nItem < 0 ) return;

	CString strCLSID = m_wndList.GetItemText( nItem, 1 );
	CString strPath  = m_wndList.GetItemText( nItem, 2 );

	CLSID pCLSID;
	if ( ! Hashes::fromGuid( strCLSID, &pCLSID ) ) return;
	if ( ! Plugins.LookupEnable( pCLSID ) ) return;

	IAudioVisPlugin* pPlugin = NULL;

	if ( Settings.MediaPlayer.VisCLSID == strCLSID &&
		 Settings.MediaPlayer.VisPath == strPath )
	{
		IMediaPlayer* pPlayer = ( m_pFrame != NULL ) ? m_pFrame->GetPlayer() : NULL;

		if ( pPlayer != NULL )
		{
			pPlayer->GetPlugin( &pPlugin );

			if ( pPlugin != NULL )
			{
				pPlugin->Configure();
				pPlugin->Release();
				return;
			}
		}
	}

	HINSTANCE hRes = AfxGetResourceHandle();

	HRESULT hr = CoCreateInstance( pCLSID, NULL, CLSCTX_ALL, IID_IAudioVisPlugin, (void**)&pPlugin );

	AfxSetResourceHandle( hRes );

	if ( FAILED( hr ) || pPlugin == NULL ) return;

	if ( ! strPath.IsEmpty() )
	{
		IWrappedPluginControl* pWrap = NULL;
		hr = pPlugin->QueryInterface( IID_IWrappedPluginControl, (void**)&pWrap );
		if ( SUCCEEDED( hr ) && pWrap != NULL )
		{
			pWrap->Load( CComBSTR( strPath ), 0 );
			pWrap->Release();
		}
	}

	pPlugin->Configure();
	pPlugin->Release();
}
Exemplo n.º 4
0
    virtual BOOL OnInitDialog()
    {
        AfxSetResourceHandle(m_ResourceDllHandle);
        AfxSetResourceHandle(m_ExeHandle);

        //call the Trace Dlg and not TabbedBaseTraceDlg because
        //the dialogs that are displayed on the tab control 
        //should be taken from the Exe resources while the trace dialog
        //is taken from the Resource Dll
        CTraceTabBaseDlg::OnInitDialog();

        // Set the icon for this dialog.  The framework does this automatically
        //  when the application's main window is not a dialog
        SetIcon(m_hIcon, TRUE);			// Set big icon
        SetIcon(m_hIcon, FALSE);		// Set small icon

        UpdateData(FALSE);

        return TRUE;  // return TRUE  unless you set the focus to a control
    }
Exemplo n.º 5
0
//控件绑定
void CCompanionTreeCtrl::PreSubclassWindow()
{
	//加载图片
	if (m_ImageList.GetSafeHandle()==NULL)
	{
		CBitmap TreeImage;
		AfxSetResourceHandle(GetModuleHandle(COMPANION_DLL_NAME));
		TreeImage.LoadBitmap(IDB_TREE_IMAGE);
		AfxSetResourceHandle(GetModuleHandle(NULL));
		m_ImageList.Create(18,18,ILC_COLOR16|ILC_MASK,0,0);
		m_ImageList.Add(&TreeImage,RGB(255,0,255));
	}
	SetImageList(&m_ImageList,LVSIL_NORMAL);

	//设置控件
	SetItemHeight(20);
	SetTextColor(RGB(10,10,10));
	SetBkColor(RGB(245,255,205));
	SendMessage(WN_SET_LINE_COLOR,0,(LPARAM)RGB(69,69,69));

	//插入子项
	TV_INSERTSTRUCT InsertInf;
	memset(&InsertInf,0,sizeof(InsertInf));
	InsertInf.item.cchTextMax=128;
	InsertInf.hInsertAfter=TVI_LAST;
	InsertInf.item.mask=TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT|TVIF_PARAM;

	//游戏好友
	InsertInf.item.iImage=IMAGE_FRIEND;
	InsertInf.item.iSelectedImage=IMAGE_FRIEND;
	InsertInf.item.pszText=TEXT("游戏好友");
	m_hItemFriend=InsertItem(&InsertInf);

	//厌恶玩家
	InsertInf.item.iImage=IMAGE_DETEST;
	InsertInf.item.iSelectedImage=IMAGE_DETEST;
	InsertInf.item.pszText=TEXT("游戏黑名单");
	m_hItemDetest=InsertItem(&InsertInf);

	__super::PreSubclassWindow();
}
//---------------------------------------------------------------------
// Function:	OnCreate
// Description:	Called from the main windows create function
// Parameters:	CMDIFrameWnd *mainWnd = main frames CMDIFrameWnd pointer
// Returns:		.
//---------------------------------------------------------------------
void CStateMachineEditor::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(StateMachineEditorDLL.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_STATEMACHINETYPE;
	//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();
	m_ToolBox->SendMessage(msgHash_RegisterResourceCollection, sizeof(RESOURCECOLLECTION), &m_ObjCollection);

	FILETYPECREATIONINFO fileInfo;
	fileInfo.m_Description = STATEMACHINE_FILE_DESCRIPTION;
	fileInfo.m_CreationCallback = CStateMachineEditor::StateMachineEditorCreationCallback;
	static DWORD msgHash_RegisterFileTypeCreationInfo = CHashString(_T("RegisterFileTypeCreationInfo")).GetUniqueID();
	m_ToolBox->SendMessage(msgHash_RegisterFileTypeCreationInfo, sizeof( FILETYPECREATIONINFO ), &fileInfo );

	AfxSetResourceHandle(appInst);
}
Exemplo n.º 7
0
void CTEditCtrlWnd::SetEditFocus()
{
	if(m_pEditCtrl)
	{
		CString strBeforeText;
		GetWindowText(strBeforeText);
		m_pEditCtrl->SetBeforText(strBeforeText);
	}

	int nGap = 1;
	CRect   rcClient;
	CString strWindow;

	if (m_bEnable == TRUE)
		return;

	GetClientRect(rcClient);
	rcClient.DeflateRect(nGap, nGap, nGap, nGap);

	CRect rt;
	GetWindowRect(rt);
	ScreenToClient(rt);

	HINSTANCE hInstSave = AfxGetResourceHandle();
	AfxSetResourceHandle(theApp.m_hInstance);

	m_pEditCtrl->Create(rcClient, this, IDC_EDIT_MAPLOADEDIT,
		m_nIntegerLength,
		m_nRealLength,
		m_bUseMinus);
	m_pEditCtrl->SetFont(&m_fontDefault);
	m_pEditCtrl->IngnoreComma(m_bIgnoreComma);

	AfxSetResourceHandle(hInstSave);

	if (m_pEditCtrl->GetSafeHwnd() != NULL)
	{
		GetWindowText(strWindow);
		m_pEditCtrl->SetInit(strWindow);
	}
}
Exemplo n.º 8
0
BOOL CQuoteReportApp::InitInstance()
{
	CWinApp::InitInstance();

	HINSTANCE hRes = (HINSTANCE)CWinnerApplication::GetModuleHandle(_T("QuoteLang.dll"));
	if (hRes)
	{
		CWinnerApplication::FormatLog(INFO_LOG_LEVEL,QuoteReportLoggerName,"行情报价模块-重设资源句柄为:%x",hRes);
		AfxSetResourceHandle(hRes);
	}
	return TRUE;
}
Exemplo n.º 9
0
    HICON LoadIconFromModule(UINT uID, LPCTSTR lpzModuleName)
    {
        HICON hRet = NULL;

        HINSTANCE hResOld = SwitchResourceToModule(lpzModuleName);
        {
            hRet = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(uID));
        }
        AfxSetResourceHandle(hResOld);

        return hRet;
    };
Exemplo n.º 10
0
//初始化函数
BOOL CDlgServerItem::OnInitDialog()
{
	__super::OnInitDialog();

	//设置资源
	AfxSetResourceHandle(GetModuleHandle(NULL));

	//加载房间
	LoadDBServerItem();

	return TRUE;
}
Exemplo n.º 11
0
//鼠标按下消息
void CControlMessage::OnLButtonDown(UINT nFlags, CPoint point)
{
	if (m_SplitWnd.GetSafeHwnd()==NULL)
	{
		CRect ClientRect;
		GetClientRect(&ClientRect);
		ClientRect.right=__max(ClientRect.right,3);
		MapWindowPoints(GetParent(),&ClientRect);
		HINSTANCE hLastHandle=AfxGetResourceHandle();
		AfxSetResourceHandle(GetModuleHandle(FACE_DLL_NAME));
		if (m_SplitWnd.Create(NULL,NULL,WS_CHILD|WS_VISIBLE,ClientRect,GetParent(),10))	
		{
			m_SplitWnd.BringWindowToTop();
			SetFocus();
			SetCapture();
		}
		AfxSetResourceHandle(hLastHandle);
	}

	return;
}
Exemplo n.º 12
0
bool GLIShaderDebug::Init(HINSTANCE hInstance, HWND parentWnd, SciTEBase *newScite)
{
  //If already init, return false;
  if(debugInstance != NULL)
  {
    return false;
  }

  //Assign the MFC instance handle
  afxCurrentInstanceHandle = hInstance;
  AfxSetResourceHandle(hInstance);

  //Create the instance  
  debugInstance = new GLIShaderDebug(newScite);

  //Create the dialog window
  debugInstance->dialogWindow = ::CreateDialog(hInstance, MAKEINTRESOURCE(IDD_GLISHADERDEBUG), parentWnd, ShaderDebugMsg); 
  if(!debugInstance->dialogWindow)
  {
    newScite->OutputAppendString("== Unable to init the GLIntercept shader debug window ==\n");
    delete debugInstance;
    debugInstance = NULL;
    return false;
  }

  //Position window 
  HWND parent = GetParent(debugInstance->dialogWindow);
  if(parent)
  {
    RECT parentPos;
    RECT dialogSize;
    if(GetWindowRect(parent, &parentPos) &&
       GetWindowRect(debugInstance->dialogWindow, &dialogSize))
    {
      //Position the window to the right of the host window
      int newW = dialogSize.right  - dialogSize.left;
      int newH = dialogSize.bottom - dialogSize.top;

      int newX = parentPos.right - (newW/4) + 50;
      int newY = parentPos.top   + 160;

      //Set the new window position (Don't activate it)
      SetWindowPos(debugInstance->dialogWindow, HWND_TOP,
                   newX, newY, newW, newH, 
                   SWP_NOACTIVATE);
    }
  }

  //Show the window
  //ShowWindow(debugInstance->dialogWindow, SW_SHOW);

  return true;
}
Exemplo n.º 13
0
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++;
}
Exemplo n.º 14
0
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);
	}
}
Exemplo n.º 15
0
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();
	}
}
Exemplo n.º 16
0
//更新图标
VOID CGameServerDlg::UpdateServerLogo(LPCTSTR pszServerDLL)
{
	//加载资源
	HINSTANCE hInstance=AfxLoadLibrary(pszServerDLL);

	//加载图形
	if (hInstance!=NULL)
	{
		//设置资源
		AfxSetResourceHandle(hInstance);

		//设置资源
		CStatic * pServerLogo=(CStatic *)GetDlgItem(IDC_SERVER_LOGO);
		pServerLogo->SetIcon(::LoadIcon(hInstance,TEXT("SERVER_ICON")));

		//释放资源
		AfxFreeLibrary(hInstance);
		AfxSetResourceHandle(GetModuleHandle(NULL));
	}

	return;
}
Exemplo n.º 17
0
/// Process creating new window command
///	\param	size - unused
///	\param	param - unused
DWORD CUndoRedoComponent::OnCreate(DWORD size, void *param)
{
	MENUINFOMESSAGE mim;
	static DWORD msgHash_GetMenuInfo = CHashString(_T("GetMenuInfo")).GetUniqueID();
	m_pToolBox->SendMessage(msgHash_GetMenuInfo, sizeof(MENUINFOMESSAGE),&mim);

	// get the application instance handle for loading resources
	HINSTANCE appInst = AfxGetResourceHandle();
	// now tell the application to look in dll for resources
	AfxSetResourceHandle(UndoRedoDLL.hModule);

	CMenu menu;
	menu.LoadMenu(IDR_UNDO_MENU);
	ASSERT(menu.m_hMenu != NULL);
	// we need to Merge Menus with Undo/Redo items
    // this code works now, but it may need to be updated for exact filling the menu
	const int nEditMenuPosition = 1;
	HMENU hEditMenu = GetSubMenu(mim.m_hMenu, nEditMenuPosition);

	TCHAR menuName[8];
	if (!GetMenuString(mim.m_hMenu, nEditMenuPosition, menuName, RTL_NUMBER_OF(menuName), MF_BYPOSITION) && !_tcscmp(menuName, _T("&Edit")))
	{
		ASSERT(0);
	}
	VERIFY(MergeSubPopupMenu(hEditMenu, menu.GetSubMenu(0)->m_hMenu));
	// and add accelerators
	HACCEL hAccel = ::LoadAccelerators(UndoRedoDLL.hResource, MAKEINTRESOURCE(IDR_UNDO_ACCELERATOR));
	ASSERT(hAccel != NULL);
	VERIFY(MergeAccelerators(&mim.m_hAccel, hAccel));

	VERIFY(::DestroyAcceleratorTable(hAccel));

	// TODO: add shortcut label to menu items
	static DWORD msgHash_SetMenuInfo = CHashString(_T("SetMenuInfo")).GetUniqueID();
	m_pToolBox->SendMessage(msgHash_SetMenuInfo, sizeof(MENUINFOMESSAGE),&mim);

	AfxSetResourceHandle(appInst);
	return MSG_HANDLED_PROCEED;
}
Exemplo n.º 18
0
USAGEMODE HRESULT Filter_ShowConfigDlg(void* pExistingFilter, const SMSGENTRY* psMsgEntry, 
									   ETYPE_BUS eType, UINT nHardware, CWnd* pParent)
{
	//Place this code at the beginning of the export function.
	//Save previous resource handle and switch to current one.
	HINSTANCE hInst = AfxGetResourceHandle();
	AfxSetResourceHandle(FilterDLL.hResource);

    HRESULT hResult = S_FALSE;
    switch (eType)
    {
        case CAN:
        {
            if (pExistingFilter != NULL)
            {
                SFILTERAPPLIED_CAN* pAppliedFilterCan = (SFILTERAPPLIED_CAN*)pExistingFilter;
                SFILTERAPPLIED_CAN sTempObj;
                sTempObj.bClone(*pAppliedFilterCan);

                CFilterConfigDlg omDlg(&sTempObj, psMsgEntry, nHardware, pParent);
                if (omDlg.DoModal() == IDOK)
                {
                    pAppliedFilterCan->bClone(sTempObj);
                    hResult = S_OK;
                }
                //delete omDlg;
            }
        }
        break;
        default:
        {
        }
        break;
    }
	//Place this at the end of the export function.
	//switch back to previous resource handle.
	AfxSetResourceHandle(hInst); 
    return hResult;
}
Exemplo n.º 19
0
//打开房间
bool CDlgServerItem::OpenGameServer()
{
	//设置资源
	AfxSetResourceHandle(GetModuleHandle(MODULE_MANAGER_DLL_NAME));

	//配置房间
	if (DoModal()==IDC_LOAD_SERVER)
	{
		return true;
	}

	return false;
}
Exemplo n.º 20
0
//选择头像
bool CFaceSelectControl::GetSelectFaceID(WORD & wFaceID)
{
	//设置资源
	AfxSetResourceHandle(GetModuleHandle(AVATAR_CONTROL_DLL_NAME));

	//显示窗口
	if (DoModal()!=IDOK) return false;

	//设置变量
	wFaceID=m_FaceItemSelectWnd.GetSelectFace();

	return true;
}
Exemplo n.º 21
0
void CMonitorWnd::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
	if ( bActivate )
	{
		HINSTANCE hPrevInst = AfxGetResourceHandle();
		
		HINSTANCE hInstance = m_hInstance ? (HINSTANCE)m_hInstance : NULL;
		if ( hInstance ) AfxSetResourceHandle( hInstance );
		
		ApplyMenu( IDR_MONITORFRAME );
		AfxSetResourceHandle( hPrevInst );
		
		wndPanel.SetParent( this );
		OnSize( SIZE_INTERNAL, 0, 0 );
	}
	else
	{
		DestroyMenu();
	}
	
	CChildWnd::OnMDIActivate( bActivate, pActivateWnd, pDeactivateWnd );
}
Exemplo n.º 22
0
USAGEMODE HRESULT Filter_ShowSelDlg(CWnd* pParent, CMainEntryList* podMainSubList)
{
    //Place this code at the beginning of the export function.
    //Save previous resource handle and switch to current one.
    HINSTANCE hInst = AfxGetResourceHandle();
    AfxSetResourceHandle(FilterDLL.hResource);

    SGUIPARAMS sGuiParams;
    /* Update GUI related information */
    /* 1. Title Name, Main entry combo box name,
            Name of the list controls */
    strcpy_s(sGuiParams.m_acTitleName, MAX_PATH, _("Filter Selection Dialog"));
    strcpy_s(sGuiParams.m_acMainListName, MAX_PATH, _("Bus"));
    strcpy_s(sGuiParams.m_acUnSelListName, MAX_PATH, _("Configured Filters"));
    strcpy_s(sGuiParams.m_acSelListName, MAX_PATH, _("Selected Filters"));
    /* Whether to combine main entry Id with sub entry name or not*/
    sGuiParams.m_bCombine = FALSE;
    /* What image to be loaded */
    sGuiParams.m_pomImageList = new CImageList;
    sGuiParams.m_pomImageList->Create(IDB_BMP_FILTER,
                                      16,
                                      1,
                                      defCOLOR_WHITE);
    //Icon index to unselected list
    sGuiParams.m_unUnSelIconIndex = 2;
    //Icon index to selected list
    sGuiParams.m_unSelIconIndex = 2;

    CMainSubListDlg omDlg(pParent, podMainSubList, sGuiParams);
    INT_PTR nReturn = omDlg.DoModal();
    //delete the created list
    sGuiParams.m_pomImageList->DeleteImageList();
    delete sGuiParams.m_pomImageList;

    //Place this at the end of the export function.
    //switch back to previous resource handle.
    AfxSetResourceHandle(hInst);
    return (HRESULT)nReturn;
}
Exemplo n.º 23
0
void registerAppInfo(HINSTANCE hInstance)
{
    HINSTANCE hPrevInst = AfxGetResourceHandle();
    AfxSetResourceHandle(hInstance);
	USES_CONVERSION;
	HRESULT hRes = S_OK;
	CComPtr<IRegistrar> p;
    hRes = CoCreateInstance(CLSID_Registrar, NULL,
                            CLSCTX_INPROC_SERVER, IID_IRegistrar, (void**)&p);
	if (SUCCEEDED (hRes)) {
        TCHAR szRegKey [MAX_PATH];
        CString strAutoCADRegistryPath = acrxProductKey ();
        _tcscpy (szRegKey, strAutoCADRegistryPath);
        const TCHAR *pszDelimiter = "\\";
        TCHAR *pszToken = _tcstok (szRegKey, pszDelimiter);
        const TCHAR *pszIds[] = 
        {
            "SOFTWARE", "AUTODESK", "AUTOCAD", "RELEASE", "AUTH"
        };
        int nCount = 0;
        while (NULL != pszToken) {
            p->AddReplacement (T2OLE(pszIds[nCount]), T2OLE(pszToken));
            pszToken = _tcstok (NULL, pszDelimiter);
            if (NULL == pszToken)
                break;
            nCount++;
        }

        TCHAR szModule [_MAX_PATH];
        GetModuleFileName (hInstance, szModule, MAX_PATH);
        LPOLESTR pszModule = T2OLE (szModule);
        p->AddReplacement (T2OLE("MODULE"), pszModule);
        LPCOLESTR szType = OLESTR ("REGISTRY");

        p->ResourceRegister (pszModule, IDR_REGISTRY_APP, szType);
    }
    AfxSetResourceHandle(hPrevInst);
}
Exemplo n.º 24
0
VOID Language::SwitchLangResProcess()
{//切换资源
	if(m_hCurrentInstance==NULL||m_hOldInstance==NULL)
	{
		ASSERT(FALSE);
		return;
	}
	else
	{
		m_hCurrentInstance = m_hOldInstance;
		AfxSetResourceHandle(m_hOldInstance);
		m_hOldInstance=m_hCurrentInstance;
	}
}
Exemplo n.º 25
0
int CPIDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  在此添加您专用的创建代码
	CRect rectDummy;
	rectDummy.SetRectEmpty();

	// create child window
	if (m_pChildWnd->GetSafeHwnd() == NULL)
	{
		// save current resource handle
		HINSTANCE hCurrentInstance = AfxGetResourceHandle();
		AfxSetResourceHandle(m_hInstance);
		m_pChildWnd->Create(NULL, NULL, WS_CHILD | WS_VISIBLE, rectDummy, this, 1000);

		// restore resource handle
		AfxSetResourceHandle(hCurrentInstance);
	}

	return 0;
}
Exemplo n.º 26
0
void CExpiredDlg::FillInControls()
{
	// Read the key stuff from the registry.
	CString regName = AfxGetApp()->GetProfileString("Config", "RegName");
	CString regCode = AfxGetApp()->GetProfileString("Config", "RegCode");

	time_t registrationTime;
	bool decoded = ValidateRegistrationCode(regCode, regName, registrationTime);
	if (decoded)
	{
		CTime time(registrationTime);
		CString timeStr = time.Format("%A, %B %d, %Y");

		CString str;
		str.Format("Workspace Whiz is registered to:\n    %s\non:\n    %s", (LPCTSTR)regName, timeStr);
		GetDlgItem(IDC_WWRE_TEXT)->SetWindowText(str);

		SetWindowText("Workspace Whiz Registered Version");
		GetDlgItem(IDC_WWRE_EVALUATE)->SetWindowText("Continue");

		m_timeLeft.ShowWindow(SW_HIDE);
		m_timeLeftBar.ShowWindow(SW_HIDE);
	}
	else
	{
		HINSTANCE oldResourceHandle = AfxGetResourceHandle();
		AfxSetResourceHandle(g_instance);
		CString timeLeftStr;
		timeLeftStr.LoadString(IDS_WWR_TIMELEFT);
		CString timeLeftStr2;
		timeLeftStr2.Format(timeLeftStr, m_numDays);
		m_timeLeft.SetWindowText(timeLeftStr2);
		AfxSetResourceHandle(oldResourceHandle);
		m_timeLeftBar.SetPos(m_numDays);
	}

}
Exemplo n.º 27
0
BOOL CMp3infpApp::InitInstance() 
{
	TRACE(_T("CMp3infpApp::InitInstance(0)\n"));
	
	theApp.m_hResource = NULL;

	CString strLangPath;
	strLangPath = regGetStringEx(HKEY_LOCAL_MACHINE,MP3INFP_REG_ENTRY,_T("path"),_T("c:\\progra~1\\mp3infp"));
	AddTailYenSign(strLangPath);
	strLangPath += _T("language\\");
	
	CString strLanguage = regGetStringEx(HKEY_CURRENT_USER,MP3INFP_REG_ENTRY,_T("Language"),DEF_SETUP_MAIN_LANGUAGE);
	strLanguage += _T(".lng");
	
	strLangPath += strLanguage;
	//theApp.m_hResource = LoadLibraryEx(strLangPath,0,LOAD_LIBRARY_AS_DATAFILE);
	theApp.m_hResource = LoadLibrary(strLangPath);
	if(theApp.m_hResource)
	{
		AfxSetResourceHandle(theApp.m_hResource);
		TCHAR tmp[20];
		if((LoadString(AfxGetResourceHandle(),IDS_LANGUAGE_VER,tmp,sizeof_array(tmp)) == 0) ||
			(_ttoi(tmp) < LANG_VER) )
		{
			FreeLibrary(theApp.m_hResource);
			theApp.m_hResource = NULL;
		}
	}
	if(theApp.m_hResource == NULL)
	{
		// 言語パックがロードできないときは内蔵のリソースを使う
		theApp.m_hResource = theApp.m_hInstance;
		AfxSetResourceHandle(theApp.m_hResource);
	}

	return CWinApp::InitInstance();
}
Exemplo n.º 28
0
void CPlayerWnd::OnUpdateNetworkConnect(CCmdUI* pCmdUI) 
{
	HINSTANCE hPrevInst = AfxGetResourceHandle();
	AfxSetResourceHandle( m_hInstance );

	CCoolBarItem* pItem = m_wndHeaderBar.GetID( ID_NETWORK_CONNECT );
	
	UINT nTextID = 0;
	UINT nTipID = 0;
	
	if ( FALSE )
	{
		if ( pItem ) pItem->SetCheck( TRUE );
		if ( pItem ) pItem->SetTextColour( CoolInterface.m_crCmdText == 0 ? RGB( 255, 0, 0 ) : CoolInterface.m_crCmdText );
		nTextID	= IDS_NETWORK_DISCONNECT;
		nTipID	= ID_NETWORK_DISCONNECT;
	}
	else
	{
		if ( pItem ) pItem->SetCheck( FALSE );
		if ( pItem ) pItem->SetTextColour( CoolInterface.m_crCmdText == 0 ? RGB( 0, 127, 0 ) : CoolInterface.m_crCmdText );
		nTextID	= IDS_NETWORK_CONNECT;
		nTipID	= ID_NETWORK_CONNECT;
	}

	CString strText;
	
	LoadString( strText, nTextID );
	if ( pItem ) pItem->SetText( strText );
	
	LoadString( strText, nTipID );
	if ( pItem ) pItem->SetTip( strText );
	
	if ( pItem ) pItem->SetImage( nTipID );
	
	AfxSetResourceHandle( hPrevInst );
}
CVideoOSCRuleSetDlg::CVideoOSCRuleSetDlg(/*SDK_OSC_RULE_S* pRule,int nChannelNum,CWnd* pParent*/ /*=NULL*/)
	: CDialog(CVideoOSCRuleSetDlg::IDD/*, pParent*/)
{
	OldResourceHanlde= AfxGetResourceHandle();//保存以前的资源搜索模块   
	AfxSetResourceHandle(theApp.m_hInstance);//设置新的模块  
// 	m_nChannelNum = nChannelNum;
// 	if ( pRule!= NULL)
// 	{
// 		memcpy(&m_Rule,pRule,sizeof(m_Rule));
// 	}
// 	else
// 	{
// 		memset(&m_Rule,0,sizeof(m_Rule));
// 	} 
}
Exemplo n.º 30
-1
void CPlayProfilePage::OnMore()
{
	int nItem = m_wndList.GetNextItem( -1, LVNI_SELECTED );
	if ( nItem == -1 ) return;

	CXMLElement* pXML = (CXMLElement*)m_wndList.GetItemData( nItem );
	
	CString strText;
	m_wndClass.GetWindowText( strText );
	
	if ( m_wndClass.FindStringExact( -1, strText ) != CB_ERR &&
		strText.CompareNoCase( "会议类" ) == 0 )
	{
		HINSTANCE hPrevInst = AfxGetResourceHandle();
		if ( m_hInstance ) AfxSetResourceHandle( m_hInstance );
		
		CChatPropertiesDlg dlg( pXML->GetParent(), this );
		dlg.DoModal();
		
		AfxSetResourceHandle( hPrevInst );
	}
}