本文整理汇总了C++中CLanguage::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ CLanguage::GetString方法的具体用法?C++ CLanguage::GetString怎么用?C++ CLanguage::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLanguage
的用法示例。
在下文中一共展示了CLanguage::GetString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q4_ConnectToMasterServer
DWORD Q4_ConnectToMasterServer(GAME_INFO *pGI, int iMasterIdx)
{
size_t packetlen=0;
char sendbuf[40];
ZeroMemory(sendbuf,sizeof(sendbuf));
int len = 0;
len = UTILZ_ConvertEscapeCodes(pGI->szMasterQueryString,sendbuf,sizeof(sendbuf));
char szIP[260];
strcpy(szIP,pGI->szMasterServerIP[iMasterIdx]);
SplitIPandPORT(szIP,pGI->dwMasterServerPORT);
dbg_print("Master server %s:%d",szIP,(unsigned short)pGI->dwMasterServerPORT);
SOCKET ConnectSocket = getsockudp(szIP,(unsigned short)pGI->dwMasterServerPORT);
if(INVALID_SOCKET==ConnectSocket)
{
dbg_print("Error connecting to socket!");
return 1001;
}
dbg_print("Sending command %s Len: %d",sendbuf,len);
if(send(ConnectSocket, sendbuf, len, 0)==SOCKET_ERROR)
{
closesocket(ConnectSocket);
dbg_print("Error sending packet!");
return 1002;
}
int i = 0;
unsigned char *packet[iMAX_PACKETS];
size_t packlen[iMAX_PACKETS];
DWORD Q4_dwNewTotalServers=0;
// Let's retrieve all packets as fast as possible, that's the reason for splitting up int two for loop.
for(i=0; i<iMAX_PACKETS;i++)
{
packet[i] = NULL;
packet[i]=(unsigned char*)getpacket(ConnectSocket, &packlen[i]);
if(packet[i]==NULL) //End of transfer
break;
}
//Now parse all server IP's from recieved packets
for(i=0; i<iMAX_PACKETS;i++)
{
if(packet[i]==NULL) //End of packets
break;
Q4_dwNewTotalServers += Q4_ParseServers((char*)packet[i],packlen[i],pGI,Q4_InsertServerItem);
SetStatusText(pGI->iIconIndex,g_lang.GetString("StatusReceivingMaster"),Q4_dwNewTotalServers,pGI->szGAME_NAME);
free(packet[i]);
}
closesocket(ConnectSocket);
pGI->dwTotalServers = pGI->vSI.size();
return 0;
}
示例2: Buddy_ListViewSubclassProc
LRESULT APIENTRY Buddy_ListViewSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HMENU hPopMenu;
if(uMsg == WM_COMMAND)
{
DWORD wmId;
DWORD wmEvent;
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EDIT_BUDDY:
{
//pEditBuddy = Buddy_GetBuddyInfoBySelection();
itBuddyEdit = bm.FindBuddyInfoByID(bm.GetBuddyIDBySelection());
if(itBuddyEdit!=bm.BuddyList.end())
{
DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_ADD_BUDDY, g_hWnd, (DLGPROC)Buddy_AddBuddyProc,TRUE);
}
bm.UpdateList();
}
break;
case IDM_REFRESH:
break;
case IDM_ADD:
bm.Buddy_Add(g_hInst,g_hWnd,true);
break;
case IDM_DELETE:
bm.Remove();
break;
case IDM_COPYIP:
{
int n=-1;
char szIP[40];
n = ListView_GetSelectionMark(g_hwndListBuddy);
ListView_GetItemText(g_hwndListBuddy,n,2,szIP,sizeof(szIP)-1);
if(n!=-1)
{
EditCopy(szIP);
}
else
MessageBox(hwnd,g_lang.GetString("ErrorServerCopyToClipBoard"),NULL,MB_OK);
}
break;
case IDM_CONNECT:
StartGame_ConnectToServer(true);
break;
}
}
else if(uMsg==WM_LBUTTONDBLCLK)
{
PostMessage(hwnd,WM_COMMAND,LOWORD(IDM_CONNECT),0);
}
else if(uMsg == WM_RBUTTONDOWN)
{
//get mouse cursor position x and y as lParam has the message itself
POINT lpClickPoint;
GetCursorPos(&lpClickPoint);
hPopMenu = CreatePopupMenu();
int n=-1;
n = ListView_GetSelectionMark(g_hwndListBuddy);
if(n!=-1)
{
//place the window/menu there if needed
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_CONNECT,g_lang.GetString("MenuConnect"));
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_DELETE,g_lang.GetString("Remove"));
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_EDIT_BUDDY,g_lang.GetString("Edit"));
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_COPYIP,g_lang.GetString("MenuCopyIP"));
}
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_ADD,g_lang.GetString("Add"));
//InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_REFRESH,"&Refresh");
//workaround for microsoft bug, to hide menu w/o selecting
SetForegroundWindow(hwnd);
TrackPopupMenu(hPopMenu,TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_BOTTOMALIGN,lpClickPoint.x, lpClickPoint.y,0,hwnd,NULL);
SendMessage(hwnd,WM_NULL,0,0);
DestroyMenu(hPopMenu);
return 0;
}
return CallWindowProc((WNDPROC)g_wpOrigListBuddyProc, hwnd, uMsg, wParam, lParam);
}
示例3: Buddy_AddBuddyProc
LRESULT CALLBACK Buddy_AddBuddyProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static BOOL bEditBuddyname = FALSE;
switch (message)
{
case WM_INITDIALOG:
{
SetDlgItemText(hDlg,IDC_STATIC_BUDDY_NAME,g_lang.GetString("BuddyName"));
CenterWindow(hDlg);
bEditBuddyname = (BOOL) lParam;
if(bEditBuddyname) //Edit mode
{
// if(pEditBuddy!=NULL)
{
if(itBuddyEdit->cMatchOnColorEncoded)
CheckDlgButton(hDlg,IDC_CHECK_NO_COLOR_MATCH,BST_CHECKED);
else
CheckDlgButton(hDlg,IDC_CHECK_NO_COLOR_MATCH,BST_UNCHECKED);
if(itBuddyEdit->cMatchExact)
CheckDlgButton(hDlg,IDC_CHECK_EXACT_MATCH,BST_CHECKED);
else
CheckDlgButton(hDlg,IDC_CHECK_EXACT_MATCH,BST_UNCHECKED);
PostMessage(GetDlgItem(hDlg,IDC_EDIT_NICKNAME_FILTER),EM_SETSEL,0,strlen(itBuddyEdit->szPlayerName));
PostMessage(GetDlgItem(hDlg,IDC_EDIT_NICKNAME_FILTER),EM_SETSEL,(WPARAM)-1,-1);
}
SetWindowText(hDlg,g_lang.GetString("TitleEditBuddy"));
SetDlgItemText(hDlg,IDC_EDIT_NICKNAME_FILTER,(TCHAR*)itBuddyEdit->szPlayerName);
}
else
{
SetWindowText(hDlg,g_lang.GetString("TitleAddBuddy"));
}
SetFocus(GetDlgItem(hDlg,IDC_EDIT_NICKNAME_FILTER));
//return TRUE;
}
break;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
if(LOWORD(wParam) == IDOK)
{
char szBuddy[100];
GetDlgItemText(hDlg,IDC_EDIT_NICKNAME_FILTER,szBuddy,sizeof(szBuddy)-1);
if(!bEditBuddyname)
{
bm.Add(szBuddy,NULL);
bm.UpdateList();
}else if(bEditBuddyname)
{
strcpy_s(itBuddyEdit->szPlayerName,szBuddy);
itBuddyEdit->cMatchOnColorEncoded = IsDlgButtonChecked(hDlg,IDC_CHECK_NO_COLOR_MATCH);
itBuddyEdit->cMatchExact = IsDlgButtonChecked(hDlg,IDC_CHECK_EXACT_MATCH);
}
}
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
示例4: OnInitDialog
BOOL CCloseApplicationDlg::OnInitDialog()
{
// Declare variables
CString sTemp;
CLanguage * pLanguage = CLanguage::Instance();
// Call original function
CDialog::OnInitDialog();
// Set icon
m_icoApplication.SetSize(40, 40);
m_icoApplication.SetTransparentColor(RGB(0, 0, 0));
m_icoApplication.LoadIcon(m_hIcon);
// Set window text
sTemp.Format(pLanguage->GetString(IDS_CLOSEAPPLICATION_TITLE), m_sApplicationTitle);
SetWindowText(sTemp);
m_lblTitle.SetWindowText(sTemp);
// Set explanation text
sTemp.Format(pLanguage->GetString(IDS_CLOSEAPPLICATION_EXPLANATION), m_sApplicationTitle,
m_iCountDown, m_sApplicationTitle);
m_lblExplanation.SetWindowText(sTemp);
// Set button text
m_btnCancel.SetWindowText(pLanguage->GetString(IDS_GENERAL_CANCEL));
m_btnEndNow.SetWindowText(pLanguage->GetString(IDS_CLOSEAPPLICATION_ENDNOW));
// Create and set font
m_fntTitle.DeleteObject();
m_fntTitle.CreateFont(
20, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_BOLD, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
DEFAULT_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
PROOF_QUALITY, // nQuality
DEFAULT_PITCH | FF_DONTCARE, // nPitchAndFamily
NULL);
m_lblTitle.SetFont(&m_fntTitle);
// Auto resize controls
AutoResizeControls();
// Set control properties
m_prgEnd.SetRange32(0, CLOSEAPPLICATION_TIME);
m_prgEnd.SetPos(0);
// Start timer
SetTimer(TIMER_COUNTDOWN, 1000, NULL);
// Try to close application in a nice way
std::string strVersion;
UINT uWinPlatform;
UINT uVersion = getWinVersion(strVersion, uWinPlatform);
CString sProcess = CPath::Instance()->ExtractFileName(m_sApplicationPath);
if ((uVersion == WINDOWS_NT3) || (uVersion == WINDOWS_NT4))
{
CloseNTApplication(sProcess.GetBuffer(sProcess.GetLength()));
}
else
{
CloseAllWinApplication(sProcess.GetBuffer(sProcess.GetLength()));
}
// Return TRUE unless you want to set focus to a control
return TRUE;
}
示例5: WaitForSingleObject
DWORD WINAPI Get_ServerStatusThread2(LPVOID lpParam)
{
GAME_INFO *pGI = (GAME_INFO *)lpParam;
SERVER_INFO *pSI=NULL;
DWORD idx=0;
DWORD size = pGI->vRefScanSI.size();
char szScanStatus[256]; //cache local language status text
strcpy(szScanStatus,g_lang.GetString("ScanStatus"));
while(pGI->dwScanIdx<size)
{
if(SCANNER_bCloseApp)
{
dbg_print("Stop scanning SIGNALED!");
break;
}
pSI=NULL;
EnterCriticalSection(&SCANNER_cs);
if(pGI->dwScanIdx<size)
{
SetStatusText(pGI->iIconIndex,szScanStatus,pGI->dwScanIdx,size);
pSI = pGI->vRefScanSI.at(pGI->dwScanIdx).pServerInfo; //pGI->vSI.at(pGI->vRefScanSI.at(pGI->dwScanIdx).dwIndex);
pGI->dwScanIdx++;
}
LeaveCriticalSection(&SCANNER_cs);
//Is there any more server to scan?
if(pSI==NULL) //if(pSI->usPort==0) //if the port is zero then no equal empty SERVER_INFO structure, (Ugly hack but it works :))
{
//OutputDebugString(">>>>ERROR? Breaked scanning thread\n");
break;
}
//Do non-filtered scan of all servers
Get_ServerStatus(pSI,NULL,NULL);
UpdateServerItem(size-pGI->dwScanIdx);
if(g_hwndProgressBar!=NULL)
SendMessage(g_hwndProgressBar, PBM_STEPIT, (WPARAM) 0, 0);
Sleep(AppCFG.dwSleep);
}
SetStatusText(pGI->iIconIndex, g_lang.GetString("ScanWaitingForThreads") );
//This ensures that all threads has been created properly and thread count critical sections works correctly
//dbg_print("Waiting for all threads to finish the loop!\n");
DWORD dwWaitResult = WaitForSingleObject(SCAN_hContinueEvent,INFINITE); // infinite wait
switch (dwWaitResult)
{
// Both event objects were signaled.
case WAIT_OBJECT_0:
// dbg_print("WAIT_OBJECT_0:\n");
break;
case WAIT_ABANDONED:
dbg_print("WAIT_ABANDONED: \n");
break;
case WAIT_TIMEOUT:
dbg_print("WAIT_TIMEOUT:\n");
break;
case WAIT_FAILED:
dbg_print("WAIT_FAILED:\n");
break;
// An error occurred.
default:
dbg_print("WaitForSingleObject error: \n");
}
DWORD id=0;
//Decrease thread counter....
EnterCriticalSection( &SCANNER_CSthreadcounter );
id = SCANNER_dwThreadCounter;
SCANNER_dwThreadCounter--;
LeaveCriticalSection( &SCANNER_CSthreadcounter );
// ExitThread(id);
return id;
}
示例6: Q3_ConnectToMasterServer
//.........这里部分代码省略.........
break;
}
//
// Figure out what happened
//
//g_log.AddLogInfo(0,"\nWSAEnumNetworkEvents()");
nRet = WSAEnumNetworkEvents(ConnectSocket, hEvent, &events);
if (nRet == SOCKET_ERROR)
{
g_log.AddLogInfo(GS_LOG_ERROR,"WSAEnumNetworkEvents() = SOCKET_ERROR");
break;
}
// //
// Handle events //
// //
// Connect event?
if (events.lNetworkEvents & FD_CONNECT)
{
//g_log.AddLogInfo(0,"\nFD_CONNECT: %d", events.iErrorCode[FD_CONNECT_BIT]);
g_log.AddLogInfo(0,"Master server %s",pGI->szMasterServerIP[0]);
g_log.AddLogInfo(0,"Sending packet string: [%s] Length: %d",sendbuf,len);
g_log.AddLogInfo(0,"xml config: %s ",pGI->szMasterQueryString);
if(send(ConnectSocket, sendbuf, len , 0)==SOCKET_ERROR)
{
KillTimer(g_hWnd,IDT_1SECOND);
WSACloseEvent(hEvent);
closesocket(ConnectSocket);
g_log.AddLogInfo(GS_LOG_ERROR,"Error sending master query packet!");
return 2;
}
}
// Read event?
if (events.lNetworkEvents & FD_READ)
{
//g_log.AddLogInfo(0,"\nFD_READ: %d, %d",events.iErrorCode[FD_READ_BIT],i);
// Read the data and write it to stdout
packet[i]=(unsigned char*)ReadPacket(ConnectSocket, &packetlen);
packet_len[i] = packetlen;
i++;
if(i>=MAX_PACKETS)
break;
}
// Close event?
if (events.lNetworkEvents & FD_CLOSE)
{
g_log.AddLogInfo(0,"\nFD_CLOSE: %d",events.iErrorCode[FD_CLOSE_BIT]);
break;
}
/*
// Write event?
if (events.lNetworkEvents & FD_WRITE)
{
g_log.AddLogInfo(0,"\nFD_WRITE: %d",events.iErrorCode[FD_WRITE_BIT]);
}
*/
}
closesocket(ConnectSocket);
WSACloseEvent(hEvent);
DWORD Q3_dwNewTotalServers=0;
for(i=0; i<MAX_PACKETS;i++)
{
if(packet[i] != NULL)
{
Q3_dwNewTotalServers += Q3_ParseServers((char*)packet[i],packet_len[i],pGI);
free(packet[i]);
packet[i]=NULL;
SetStatusText(pGI->iIconIndex,g_lang.GetString("StatusReceivingMaster"),Q3_dwNewTotalServers,pGI->szGAME_NAME);
if(g_bCancel)
{
//ensure to clean up
for(i=0; i<MAX_PACKETS;i++)
{
if(packet[i] != NULL)
{
free(packet[i]);
packet[i]=NULL;
}
}
break;
}
Sleep(50); //give cpu sometime to breath
}
}
// KillTimer(g_hWnd,IDT_TIMER_1SECOND);
pGI->dwTotalServers += Q3_dwNewTotalServers;
return 0;
}
示例7: CFG_OnSelChangedProc
LRESULT CALLBACK CFG_OnSelChangedProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TCHAR szText[256];
TCHAR tmp[20];
TCHAR szFile[260];
hwndConfDialog = hDlg;
switch(uMsg)
{
case WM_INITDIALOG:
{
g_bChanged = false;
CFG_OnChildDialogInit(hDlg);
SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_ADDSTRING, 0, (LPARAM)"ALT");
SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_ADDSTRING, 0 ,(LPARAM)"CONTROL");
SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_ADDSTRING, 0, (LPARAM)"SHIFT");
if(AppCFGtemp.dwMinimizeMODKey == MOD_ALT)
SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_SETCURSEL, 0, 0);
else if(AppCFGtemp.dwMinimizeMODKey == MOD_CONTROL)
SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_SETCURSEL, 1, 0);
else if(AppCFGtemp.dwMinimizeMODKey == MOD_SHIFT)
SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_SETCURSEL, 2, 0);
sprintf(tmp,"%c",AppCFGtemp.cMinimizeKey);
SetDlgItemText(hDlg,IDC_EDIT_KEY,tmp);
SendDlgItemMessage (hDlg,IDC_EDIT_KEY, EM_SETLIMITTEXT,1, 0);
CheckDlgButton(hDlg,IDC_CHECK_CONNECT_CLOSE,AppCFGtemp.bCloseOnConnect);
CheckDlgButton(hDlg,IDC_CHECK1,AppCFGtemp.bAutostart);
CheckDlgButton(hDlg,IDC_CHECK_SHORTNAME,AppCFGtemp.bUseShortCountry);
CheckDlgButton(hDlg,IDC_CHECK_REG_WEB_PROTOCOLS,AppCFGtemp.bRegisterWebProtocols);
CheckDlgButton(hDlg,IDC_CHECK_NO_MAP_RESIZE,AppCFGtemp.bNoMapResize);
CheckDlgButton(hDlg,IDC_CHECK_REFRESH_AT_START_UP,AppCFGtemp.bAutoRefreshServerlist);
LVCOLUMN lvColumn;
//initialize the columns
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
lvColumn.fmt = LVCFMT_LEFT;
HWND hwndLVexes;
hwndLVexes = GetDlgItem(hDlg,IDC_LIST_CFG_EXES);
lvColumn.cx = 80;
lvColumn.pszText = (LPSTR)g_lang.GetString("ColumnName");
ListView_InsertColumn(hwndLVexes, 0, &lvColumn);
lvColumn.cx = 120;
lvColumn.pszText = (LPSTR)g_lang.GetString("LaunchByScript");
ListView_InsertColumn(hwndLVexes, 1, &lvColumn);
lvColumn.cx = 180;
lvColumn.pszText = (LPSTR)g_lang.GetString("ColumnExePath");
ListView_InsertColumn(hwndLVexes, 3, &lvColumn);
lvColumn.pszText = (LPSTR)g_lang.GetString("ColumnCommand");
ListView_InsertColumn(hwndLVexes, 4, &lvColumn);
DWORD dwExStyle=0;
dwExStyle = ListView_GetExtendedListViewStyle(hwndLVexes);
dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP ;
ListView_SetExtendedListViewStyle(hwndLVexes,dwExStyle);
CheckDlgButton(hDlg,IDC_CHECK2,AppCFGtemp.bUse_minimize);
CheckDlgButton(hDlg,IDC_CHECK_SCR_RESTORE,AppCFGtemp.bUSE_SCREEN_RESTORE );
sprintf(szText,"%d",AppCFGtemp.iAutoRefreshEveryMinuteInterval);
SetDlgItemText(hDlg,IDC_EDIT_AUTO_REFRESH_INTERVAL,szText);
sprintf(szText,"%d",(AppCFGtemp.socktimeout.tv_sec*1000)+AppCFGtemp.socktimeout.tv_usec);
SetDlgItemText(hDlg,IDC_EDIT_SOCK_TIMEOUT_S,szText);
sprintf(szText,"%d",AppCFGtemp.dwRetries);
SetDlgItemText(hDlg,IDC_EDIT_CFG_RETRIES,szText);
CheckDlgButton(hDlg,IDC_CHECK_XMPP_ACTIVE,AppCFGtemp.bXMPP_Active);
SetDlgItemText(hDlg,IDC_EDIT_XMPP_USERNAME,AppCFGtemp.szXMPP_USERNAME);
SetDlgItemText(hDlg,IDC_EDIT_XMPP_PASSWORD,AppCFGtemp.szXMPP_PASSWORD);
SetDlgItemText(hDlg,IDC_EDIT_XMPP_SERVER,AppCFGtemp.szXMPP_SERVER);
CheckDlgButton(hDlg,IDC_CHECK_BUDDY_NOTIFY,AppCFGtemp.bBuddyNotify);
CheckDlgButton(hDlg,IDC_CHECK_USE_WAV_FILE,AppCFGtemp.bUseBuddySndNotify);
SetDlgItemText(hDlg,IDC_EDIT_WAV_FILE,AppCFGtemp.szNotifySoundWAVfile);
SetDlgItemText(hDlg,IDC_EDIT_MIRC,g_sMIRCoutput.c_str());
CheckDlgButton(hDlg,IDC_CHECK_EXT_ACTIVE,AppCFGtemp.bUse_EXT_APP);
CheckDlgButton(hDlg,IDC_CHECK_EXT_ACTIVE2,AppCFGtemp.bUse_EXT_APP2);
CheckDlgButton(hDlg,IDC_CHECK_MIRC,AppCFGtemp.bUseMIRC);
g_lang.EnumerateLanguage();
for( map<string,string>::iterator ii=g_lang.m_Languages.begin(); ii!=g_lang.m_Languages.end(); ++ii)
{
//.........这里部分代码省略.........
示例8: CFG_AddNewInstall_Proc
LRESULT CALLBACK CFG_AddNewInstall_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TCHAR szFile[360];
switch(uMsg)
{
case WM_INITDIALOG:
{
g_cfgScriptTmp.clear();
g_cfgFilterNameTmp.clear();
SetWindowText(hDlg,g_lang.GetString("TitleNewInstall"));
SetDlgItemText(hDlg,IDC_BUTTON_EXE_CFG_OK,g_lang.GetString("Save"));
SetDlgItemText(hDlg,IDC_BUTTON_CFG_EXE_CANCEL,g_lang.GetString("Cancel"));
SetDlgItemText(hDlg,IDC_STATIC_ADDNEWINSTALL,g_lang.GetString("AddNewInstall"));
SetDlgItemText(hDlg,IDC_STATIC_EXE,g_lang.GetString("ColumnExePath"));
SetDlgItemText(hDlg,IDC_STATIC_COMMAND,g_lang.GetString("ColumnCommand"));
SetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,"Default");
int gameID = CFG_GetGameID(g_currSelCfg);
if(gm.GamesInfo[gameID].vGAME_INST_DEFAULT.size()>0)
{
SetDlgItemText(hDlg,IDC_EDIT_CMD,gm.GamesInfo[gameID].vGAME_INST_DEFAULT.at(0).szGAME_CMD.c_str());
}
break;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_BUTTON_EDIT_SCRIPT:
DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_EDIT_FILTER, hDlg, (DLGPROC)FilterEditor_Dlg,-1);
g_cfgScriptTmp = g_EditorTI.sScript;
g_cfgFilterNameTmp = g_EditorTI.sName;
SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,g_cfgFilterNameTmp.c_str());
break;
case IDC_BUTTON_CFG_EXE_CANCEL:
EndDialog(hDlg,0);
break;
case IDC_BUTTON_EXE_CFG_OK:
{
int gameID = CFG_GetGameID(g_currSelCfg);
TCHAR szTemp[MAX_PATH*2];
GAME_INSTALLATIONS gi;
GetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,szTemp,MAX_PATH);
if(strlen(szTemp)==0)
{
MessageBox(hDlg,g_lang.GetString("NoName"),"Error saving",MB_OK);
return TRUE;
}
if(IsDlgButtonChecked(hDlg,IDC_CHECK_CONDITION)==BST_CHECKED)
gi.bActiveScript=TRUE;
else
gi.bActiveScript=FALSE;
gi.sFilterName = g_cfgFilterNameTmp;
gi.sScript = g_cfgScriptTmp;
gi.sName = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_PATH,szTemp,MAX_PATH*2);
gi.szGAME_PATH = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_CMD,szTemp,MAX_PATH*2);
gi.szGAME_CMD = szTemp;
//USE below function for above code!!!
//GetDlgItemTextToString(HWND hWnd,int nID, string &pOutString)
GamesInfoCFG[gameID].vGAME_INST.push_back(gi);
EndDialog(hDlg,0);
}
break;
case IDC_BUTTON_ET_PATH:
{
OPENFILENAME ofn;
memset(&ofn,0,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Executable\0*.exe\0";
ofn.nFilterIndex = 2;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
int gameID=-1;
gameID = CFG_GetGameID(g_currSelCfg);
if(gameID!=-1)
{
if(GamesInfoCFG[gameID].vGAME_INST.size()>0)
ofn.lpstrInitialDir = GamesInfoCFG[gameID].vGAME_INST[CFG_editexeIdx].szGAME_PATH.c_str();
}
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if(GetOpenFileName(&ofn))
//.........这里部分代码省略.........
示例9: CFG_EditInstall_Proc
LRESULT CALLBACK CFG_EditInstall_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TCHAR szFile[260];
switch(uMsg)
{
case WM_INITDIALOG:
{
CFG_editexeIdx = lParam;
int gameID = CFG_GetGameID(g_currSelCfg);
GAME_INSTALLATIONS gi;
gi = GamesInfoCFG[gameID].vGAME_INST.at(lParam);
g_cfgScriptTmp.clear();
g_cfgFilterNameTmp.clear();
g_EditorTI.sScript = gi.sScript;
g_EditorTI.sName = gi.sFilterName;
CheckDlgButton(hDlg,IDC_CHECK_CONDITION,gi.bActiveScript);
SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,gi.sFilterName.c_str());
SetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,gi.sName.c_str());
SetDlgItemText(hDlg,IDC_EDIT_PATH,gi.szGAME_PATH.c_str());
SetDlgItemText(hDlg,IDC_EDIT_CMD,gi.szGAME_CMD.c_str());
// SetDlgItemText(hDlg,IDC_EDIT_CFG_MOD,gi.sMod.c_str());
// SetDlgItemText(hDlg,IDC_EDIT_CFG_VERSION,gi.sVersion.c_str());
break;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_BUTTON_EDIT_SCRIPT:
DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_EDIT_FILTER, hDlg, (DLGPROC)FilterEditor_Dlg,-2);
g_cfgScriptTmp = g_EditorTI.sScript;
g_cfgFilterNameTmp = g_EditorTI.sName;
SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,g_cfgFilterNameTmp.c_str());
break;
case IDC_BUTTON_CFG_EXE_CANCEL:
EndDialog(hDlg,0);
break;
case IDC_BUTTON_EXE_CFG_OK:
{
int gameID = CFG_GetGameID(g_currSelCfg);
TCHAR szTemp[MAX_PATH*2];
GAME_INSTALLATIONS gi;
GetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,szTemp,MAX_PATH);
if(strlen(szTemp)==0)
{
MessageBox(hDlg,g_lang.GetString("NoName"),"Error saving",MB_OK);
return TRUE;
}
if(IsDlgButtonChecked(hDlg,IDC_CHECK_CONDITION)==BST_CHECKED)
gi.bActiveScript=TRUE;
else
gi.bActiveScript=FALSE;
gi.sFilterName = g_cfgFilterNameTmp;
gi.sScript = g_cfgScriptTmp;
gi.sName = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_PATH,szTemp,MAX_PATH);
gi.szGAME_PATH = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_CMD,szTemp,MAX_PATH*2);
gi.szGAME_CMD = szTemp;
GamesInfoCFG[gameID].vGAME_INST.at(CFG_editexeIdx) = gi;
EndDialog(hDlg,0);
}
break;
case IDC_BUTTON_ET_PATH:
{
OPENFILENAME ofn;
memset(&ofn,0,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Executable\0*.exe\0";
ofn.nFilterIndex = 2;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
int gameID=-1;
gameID = CFG_GetGameID(g_currSelCfg);
if(gameID!=-1)
{
if(GamesInfoCFG[gameID].vGAME_INST.size()>0)
ofn.lpstrInitialDir = GamesInfoCFG[gameID].vGAME_INST[CFG_editexeIdx].szGAME_PATH.c_str();
}
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
//.........这里部分代码省略.........
示例10: CFG_MainProc
LRESULT CALLBACK CFG_MainProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
g_tvIndexCFG = 0;
g_hwndTree = GetDlgItem(hDlg,IDC_TREE_CONF);
SendMessage(g_hwndTree, TVM_SETIMAGELIST , TVSIL_NORMAL, (LPARAM)g_hImageListIcons);
SendMessage(g_hwndTree, TVM_SETIMAGELIST , TVSIL_STATE, (LPARAM)g_hImageListStates);
HTREEITEM hNewItem;
hNewItem = TreeView_AddItem(27,g_lang.GetString("ConfigGeneral"));
hNewItem = TreeView_AddItem(15,g_lang.GetString("ConfigMinimizer"));
hNewItem = TreeView_AddItem(28,"mIRC");
hNewItem = TreeView_AddItem(3,"Account (XMPP)");
hNewItem = TreeView_AddItem(16,g_lang.GetString("ConfigExtExe"));
hNewItem = TreeView_AddItem(25,g_lang.GetString("ConfigGraphic"));
hNewItem = TreeView_AddItem(13,g_lang.GetString("ConfigNetwork"));
hNewItem = TreeView_AddItem(20 ,g_lang.GetString("ConfigGames"));
if (hNewItem)
TreeView_Select(g_hwndTree, hNewItem, TVGN_CARET);
for(UINT i=0;i<gm.GamesInfo.size();i++)
hNewItem = TreeView_AddItem(gm.GamesInfo[i].iIconIndex,gm.GamesInfo[i].szGAME_SHORTNAME);
TreeView_Select(g_hwndTree, NULL, TVGN_CARET);
for(UINT i=0; i<gm.GamesInfo.size();i++)
{
GamesInfoCFG[i].bActive = gm.GamesInfo[i].bActive;
GamesInfoCFG[i].bUseHTTPServerList[0] = gm.GamesInfo[i].bUseHTTPServerList[0];
GamesInfoCFG[i].dwMasterServerPORT = gm.GamesInfo[i].dwMasterServerPORT;
strcpy(GamesInfoCFG[i].szGAME_NAME, gm.GamesInfo[i].szGAME_NAME);
strcpy(GamesInfoCFG[i].szMasterServerIP[0], gm.GamesInfo[i].szMasterServerIP[0]);
GamesInfoCFG[i].vGAME_INST = gm.GamesInfo[i].vGAME_INST;
}
memcpy(&AppCFGtemp,&AppCFG,sizeof(APP_SETTINGS_NEW));
CFG_g_sMIRCoutputTemp = g_sMIRCoutput;
SetDlgItemText(hDlg,IDOK,g_lang.GetString("Ok"));
SetDlgItemText(hDlg,IDC_BUTTON_DEFAULT,g_lang.GetString("SetDefault"));
SetDlgItemText(hDlg,IDCANCEL,g_lang.GetString("Cancel"));
CenterWindow(hDlg);
CFG_OnTabbedDialogInit(hDlg) ;
return TRUE;
}
case WM_NOTIFY:
{
NMTREEVIEW *lpnmtv;
lpnmtv = (LPNMTREEVIEW)lParam;
switch (wParam)
{
case IDC_TREE_CONF:
{
NMTREEVIEW *pnmtv;
pnmtv = (LPNMTREEVIEW) lParam;
if((lpnmtv->hdr.code == TVN_SELCHANGED) )
{
if((g_bChanged==true) && (pnmtv->action == TVC_BYMOUSE))
CFG_ApplySettings();
CFG_OnSelChanged(hDlg);
}
}
break;
}
break;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
LocalFree(g_pHdr);
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
case IDOK:
{
CFG_ApplySettings();
if(AppCFGtemp.bAutostart)
AddAutoRun(EXE_PATH);
else
RemoveAutoRun();
if(AppCFGtemp.bUse_minimize)
{
UnregisterHotKey(NULL, HOTKEY_ID);
if (!RegisterHotKey(NULL, HOTKEY_ID, AppCFGtemp.dwMinimizeMODKey ,AppCFGtemp.cMinimizeKey))
{
//probably already registred
MessageBox(NULL,g_lang.GetString("ErrorRegHotkey"),"Hotkey error",NULL);
}
//.........这里部分代码省略.........