本文整理匯總了C++中EndDialog函數的典型用法代碼示例。如果您正苦於以下問題:C++ EndDialog函數的具體用法?C++ EndDialog怎麽用?C++ EndDialog使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EndDialog函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: EndDialog
void UninstallOld::OnBnClickedNo()
{
EndDialog(IDIGNORE);
}
示例2: TRACE0
void COptionsDialog::OnOK()
{
if (!UpdateData(TRUE))
{
TRACE0("UpdateData failed during dialog termination.\n");
// the UpdateData routine will set focus to correct item
return;
}
CGeneralManager * m = ((CReportAsistentApp *) AfxGetApp())->m_pGeneralManager;
CString Pom;
int iPom;
CUT_Hint oHint;
CReportAsistentApp * App = ((CReportAsistentApp *) AfxGetApp());
//dedek: WordTemplate
m->WordManager.setWordTemplate(m_strWordTemplate);
//Get Language radio buttons
if (GetCheckedRadioButton(IDC_CZECH_RADIO, IDC_ENGLISH_RADIO) == IDC_ENGLISH_RADIO)
m->setLanguage("en");
else
m->setLanguage("cz");
//Get Tree Items
//Height Edit
m_HeightEdit.GetWindowText(Pom);
iPom = StrToInt((LPCTSTR)Pom);
if ((iPom > 15) && (iPom<= 50))
App->m_iTreeItemHeight = iPom;
//Indent Edit
m_IndentEdit.GetWindowText(Pom);
iPom =StrToInt((LPCTSTR)Pom);
if ((iPom > 15) && (iPom<= 50))
App->m_iTreeItemIndent = iPom;
App->m_bTreeHasLines = m_LinesCheckBox.GetCheck();
App->m_bIdInItemName = m_IdInTreeCheckBox.GetCheck();
App->m_bTreeHasButtons = m_ButtonsCheckBox.GetCheck();
//Name Length Edit
m_NameLengthEdit.GetWindowText(Pom);
iPom =StrToInt((LPCTSTR)Pom);
if ((iPom > 5) && (iPom<= 999))
App->m_iTreeItemNameLength = iPom;
//TextEdit size Edit
m_TextEditSize.GetWindowText(Pom);
iPom =StrToInt((LPCTSTR)Pom);
if ((iPom > 80) && (iPom<= 300))
App->m_iTextEditSize = iPom;
//Get orphans radio buttons:
CString OrphSol = App->FirstDocumentInFirstTemplate()->GetReportSettings("orphans_solution");
switch (GetCheckedRadioButton(IDC_IGNORE_RADIO, IDC_SET_DEFAULT_RADIO))
{
case IDC_IGNORE_RADIO:
App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","ignore");
break;
case IDC_DELETE_RADIO:
App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","delete");
break;
case IDC_SET_DEFAULT_RADIO:
App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","set_default");
break;
}
//get mark orphans
BOOL bChecked = App->m_bMarkOrphans;
App->m_bMarkOrphans = m_MarkOrphansCheckBox.GetCheck();
if (bChecked ==App->m_bMarkOrphans) oHint.iMarkOrphans = 0;
else if (bChecked == 0) oHint.iMarkOrphans = ORP_SIGN;
else oHint.iMarkOrphans = ORP_UNSIGN;
//dedek: jazyk
App->FirstDocumentInFirstTemplate()->SetReportSettings("language", m->getLanguage());
//Apply changes
App->FirstDocumentInFirstTemplate()->SetModifiedFlag();
App->FirstDocumentInFirstTemplate()->UpdateAllViews(NULL, UT_SETTINGS, &oHint);
EndDialog(IDOK);
}
示例3: EndDialog
void WarningDlg::OnBnClickedRefuse()
{
EndDialog(1);
}
示例4: FilterboxDlgHandler
LRESULT CALLBACK FilterboxDlgHandler( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
int t; // ,z;
char newname[25],sztemp[30];
static int acttype;
static int dinit=FALSE;
static FidFilter * tempf=NULL,* newf=NULL;
FILTEROBJ * st;
st = (FILTEROBJ *) actobject;
if ((st==NULL)||(st->type!=OB_FILTER)) return(FALSE);
switch( message )
{
case WM_INITDIALOG:
dinit=TRUE;
SendMessage(GetDlgItem(hDlg, IDC_FILTERTYPECOMBO), CB_RESETCONTENT,0,0);
for (t = 0; t < FILTERTYPES; t++)
SendMessage( GetDlgItem(hDlg, IDC_FILTERTYPECOMBO), CB_ADDSTRING, 0, (LPARAM) (LPSTR) FILTERTYPE[t].tname) ;
SetDlgItemText(hDlg,IDC_FILTERTYPECOMBO, FILTERTYPE[st->filtertype].tname);
SetDlgItemText(hDlg,IDC_FILTERNEWNAME, st->name);
SetDlgItemInt(hDlg,IDC_FROMFREQ, st->dispfrom,0);
SetDlgItemInt(hDlg,IDC_TOFREQ, st->dispto,0);
SetDlgItemInt(hDlg,IDC_FILTERPAR0, st->par0,0);
sprintf(sztemp,"%.5f",st->par1);
SetDlgItemText(hDlg,IDC_FILTERPAR1, sztemp);
sprintf(sztemp,"%.5f",st->par2);
SetDlgItemText(hDlg,IDC_FILTERPAR2, sztemp);
acttype=st->filtertype;
dinit=FALSE;
newf=do_filt_design(hDlg,acttype);
if (newf) tempf=newf;
update_filterdialog(hDlg,st->filtertype);
return TRUE;
case WM_CLOSE:
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_FILTERTYPECOMBO:
acttype=SendMessage( GetDlgItem(hDlg, IDC_FILTERTYPECOMBO), CB_GETCURSEL, 0, 0 ) ;
update_filterdialog(hDlg,acttype);
case IDC_FILTERPAR0:
case IDC_FILTERPAR1:
case IDC_FILTERPAR2:
case IDC_FROMFREQ:
case IDC_TOFREQ:
if (!dinit)
{
newf=do_filt_design(hDlg,acttype);
if (newf) tempf=newf;
InvalidateRect(hDlg,NULL,TRUE);
}
break;
case IDC_FILTERSTORE:
if (newf)
{
GetDlgItemText(hDlg, IDC_FILTERNEWNAME,newname,sizeof(newname));
st->filtertype=acttype;
st->par0=GetDlgItemInt(hDlg,IDC_FILTERPAR0, NULL, 0);
GetDlgItemText(hDlg,IDC_FILTERPAR1,sztemp,sizeof(sztemp));
sscanf(sztemp,"%f",&st->par1);
GetDlgItemText(hDlg,IDC_FILTERPAR2,sztemp,sizeof(sztemp));
st->dispfrom=GetDlgItemInt(hDlg, IDC_FROMFREQ, NULL, 0);
st->dispto=GetDlgItemInt(hDlg, IDC_TOFREQ, NULL, 0);
sscanf(sztemp,"%f",&st->par2);
strcpy(st->name,newname);
st->filt=do_filt_design(hDlg, acttype);
st->run= fid_run_new(st->filt, &(st->funcp));
if (st->fbuf!=NULL)
{
fid_run_freebuf(st->fbuf);
st->fbuf=fid_run_newbuf(st->run);
}
}
break;
}
return(TRUE);
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
HPEN tpen;
HBRUSH tbrush;
int height;
int f1,f2;
float fstep,val,x;
hdc = BeginPaint (hDlg, &ps);
GetClientRect(hDlg, &rect);
tpen = CreatePen (PS_SOLID,1,0);
SelectObject (hdc, tpen);
tbrush = CreateSolidBrush(RGB(240,240,240));
//.........這裏部分代碼省略.........
示例5: pass_proc
NOEXPORT LRESULT CALLBACK pass_proc(HWND dialog_handle, UINT message,
WPARAM wParam, LPARAM lParam) {
char *titlebar;
LPTSTR tstr;
union {
TCHAR txt[PEM_BUFSIZE];
WORD len;
} pass_dialog;
WORD pass_len;
char* pass_txt;
switch(message) {
case WM_INITDIALOG:
/* set the default push button to "Cancel" */
SendMessage(dialog_handle, DM_SETDEFID, (WPARAM)IDCANCEL, (LPARAM)0);
titlebar=str_printf("Private key: %s", ui_data->section->key);
tstr=str2tstr(titlebar);
str_free(titlebar);
SetWindowText(dialog_handle, tstr);
str_free(tstr);
return TRUE;
case WM_COMMAND:
/* set the default push button to "OK" when the user enters text */
if(HIWORD(wParam)==EN_CHANGE && LOWORD(wParam)==IDE_PASSEDIT)
SendMessage(dialog_handle, DM_SETDEFID, (WPARAM)IDOK, (LPARAM)0);
switch(wParam) {
case IDOK:
/* get number of characters */
pass_len=(WORD)SendDlgItemMessage(dialog_handle,
IDE_PASSEDIT, EM_LINELENGTH, (WPARAM)0, (LPARAM)0);
if(!pass_len || pass_len>=PEM_BUFSIZE) {
EndDialog(dialog_handle, FALSE);
return FALSE;
}
/* put the number of characters into first word of buffer */
pass_dialog.len=pass_len;
/* get the characters */
SendDlgItemMessage(dialog_handle, IDE_PASSEDIT, EM_GETLINE,
(WPARAM)0 /* line 0 */, (LPARAM)pass_dialog.txt);
pass_dialog.txt[pass_len]='\0'; /* null-terminate the string */
/* convert input password to ANSI string (as ui_data->pass) */
pass_txt=tstr2str(pass_dialog.txt);
strcpy(ui_data->pass, pass_txt);
str_free(pass_txt);
EndDialog(dialog_handle, TRUE);
return TRUE;
case IDCANCEL:
EndDialog(dialog_handle, FALSE);
return TRUE;
}
return 0;
}
return FALSE;
UNREFERENCED_PARAMETER(lParam);
}
示例6: GetResString
BOOL CHttpDownloadDlg::OnInitDialog()
{
CString cap;
cap = GetResString(IDS_CANCEL);
GetDlgItem(IDCANCEL)->SetWindowText(cap);
if (!m_strTitle.IsEmpty())
SetWindowText(m_strTitle);
//Let the parent class do its thing
CDialog::OnInitDialog();
InitWindowStyles(this);
//Setup the animation control
m_ctrlAnimate.Open(IDR_HTTPDOWNLOAD_ANI);
//Validate the URL
ASSERT(m_sURLToDownload.GetLength()); //Did you forget to specify the file to download
if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort))
{
//Try sticking "http://" before it
m_sURLToDownload = _T("http://") + m_sURLToDownload;
if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort))
{
TRACE(_T("Failed to parse the URL: %s\n"), m_sURLToDownload);
EndDialog(IDCANCEL);
return TRUE;
}
}
//Check to see if the file we are downloading to exists and if
//it does, then ask the user if they were it overwritten
// edited: we always want to overwrite old language dlls and server.mets
/*CFileStatus fs;
ASSERT(m_sFileToDownloadInto.GetLength());
if (CFile::GetStatus(m_sFileToDownloadInto, fs))
{
CString sMsg;
sMsg.Format(GetResString(IDS_HTTPDOWNLOAD_OK_TO_OVERWRITE), m_sFileToDownloadInto);
if (AfxMessageBox(sMsg, MB_YESNO) != IDYES)
{
TRACE(_T("Failed to confirm file overwrite, download aborted\n"));
EndDialog(IDCANCEL);
return TRUE;
}
}*/
//Try and open the file we will download into
if (!m_FileToWrite.Open(m_sFileToDownloadInto, CFile::modeCreate | CFile::modeWrite | CFile::shareDenyWrite))
{
TRACE(_T("Failed to open the file to download into, Error:%d\n"), GetLastError());
CString sError;
sError.Format(_T("%d"), ::GetLastError());
CString sMsg;
sMsg.Format(GetResString(IDS_HTTPDOWNLOAD_FAIL_FILE_OPEN), sError);
AfxMessageBox(sMsg);
EndDialog(IDCANCEL);
return TRUE;
}
//Pull out just the filename component
int nSlash = m_sObject.ReverseFind(_T('/'));
if (nSlash == -1)
nSlash = m_sObject.ReverseFind(_T('\\'));
if (nSlash != -1 && m_sObject.GetLength() > 1)
m_sFilename = m_sObject.Right(m_sObject.GetLength() - nSlash - 1);
else
m_sFilename = m_sObject;
//Set the file status text
CString sFileStatus;
ASSERT(m_sObject.GetLength());
ASSERT(m_sServer.GetLength());
sFileStatus.Format(GetResString(IDS_HTTPDOWNLOAD_FILESTATUS), m_sFilename, m_sServer);
m_ctrlFileStatus.SetWindowText(sFileStatus);
// set labels
SetDlgItemText(IDC_TIMELEFTTEXT,GetResString(IDS_ESTTIMELEFT));
SetDlgItemText(IDC_TRANSFER_RATE_LABEL,GetResString(IDS_TRANSFER_RATE_LABEL));
//Spin off the background thread which will do the actual downloading
m_pThread = AfxBeginThread(_DownloadThread, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
if (m_pThread == NULL)
{
TRACE(_T("Failed to create download thread, dialog is aborting\n"));
EndDialog(IDCANCEL);
return TRUE;
}
m_pThread->m_bAutoDelete = FALSE;
m_pThread->ResumeThread();
return TRUE;
}
示例7: Directories_OnInitDialog
static BOOL Directories_OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam)
{
RECT rectClient;
LVCOLUMN LVCol;
char* token;
char buf[MAX_PATH * MAX_DIRS];
int i;
pDirInfo = (struct tDirInfo*) malloc(sizeof(struct tDirInfo));
if (pDirInfo == NULL) /* bummer */
{
EndDialog(hDlg, -1);
return FALSE;
}
for (i = LASTDIR - 1; i >= 0; i--)
{
ComboBox_InsertString(GetDlgItem(hDlg, IDC_DIR_COMBO), 0, dir_names[i]);
}
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_DIR_COMBO), 0);
GetClientRect(GetDlgItem(hDlg, IDC_DIR_LIST), &rectClient);
memset(&LVCol, 0, sizeof(LVCOLUMN));
LVCol.mask = LVCF_WIDTH;
LVCol.cx = rectClient.right - rectClient.left - GetSystemMetrics(SM_CXHSCROLL);
ListView_InsertColumn(GetDlgItem(hDlg, IDC_DIR_LIST), 0, &LVCol);
/* Keep a temporary copy of the directory strings in pDirInfo. */
memset(pDirInfo, 0, sizeof(struct tDirInfo));
strcpy(buf, GetRomDirs());
pDirInfo->m_Paths[ROM].m_NumDirectories = 0;
token = strtok(buf, ";");
while ((DirInfo_NumDir(pDirInfo, ROM) < MAX_DIRS) && token)
{
strcpy(DirInfo_Path(pDirInfo, ROM, DirInfo_NumDir(pDirInfo, ROM)), token);
DirInfo_NumDir(pDirInfo, ROM)++;
token = strtok(NULL, ";");
}
pDirInfo->m_Paths[ROM].m_bModified = FALSE;
strcpy(buf, GetSampleDirs());
pDirInfo->m_Paths[SAMPLE].m_NumDirectories = 0;
token = strtok(buf, ";");
while ((DirInfo_NumDir(pDirInfo, SAMPLE) < MAX_DIRS) && token)
{
strcpy(DirInfo_Path(pDirInfo, SAMPLE, DirInfo_NumDir(pDirInfo, SAMPLE)), token);
DirInfo_NumDir(pDirInfo, SAMPLE)++;
token = strtok(NULL, ";");
}
pDirInfo->m_Paths[SAMPLE].m_bModified = FALSE;
strcpy(DirInfo_Dir(pDirInfo, CFG), GetCfgDir());
strcpy(DirInfo_Dir(pDirInfo, HI), GetHiDir());
strcpy(DirInfo_Dir(pDirInfo, IMG), GetImgDir());
strcpy(DirInfo_Dir(pDirInfo, INP), GetInpDir());
strcpy(DirInfo_Dir(pDirInfo, STATE), GetStateDir());
strcpy(DirInfo_Dir(pDirInfo, ART), GetArtDir());
strcpy(DirInfo_Dir(pDirInfo, MEMCARD), GetMemcardDir());
strcpy(DirInfo_Dir(pDirInfo, FLYER), GetFlyerDir());
strcpy(DirInfo_Dir(pDirInfo, CABINET), GetCabinetDir());
strcpy(DirInfo_Dir(pDirInfo, NVRAM), GetNvramDir());
UpdateDirectoryList(hDlg);
return TRUE;
}
示例8: MainDlgProcNature
BOOL CALLBACK MainDlgProcNature(HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam)
{
switch (msg) {
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_HUSTOTA:
{
char text[32];
GetDlgItemText(hDlg, IDC_HUSTOTA, text, 32);
p_LevelEnvironment->NatureEffect[iIndex].uiDensity = atoi(text);
}
break;
case IDC_INTEZITA:
{
char text[32];
GetDlgItemText(hDlg, IDC_INTEZITA, text, 32);
p_LevelEnvironment->NatureEffect[iIndex].uiIntensity = atoi(text);
}
break;
case IDC_VZDALENOST:
{
char text[32];
GetDlgItemText(hDlg, IDC_VZDALENOST, text, 32);
p_LevelEnvironment->NatureEffect[iIndex].fRadius =
(float) atof(text);
}
break;
case IDC_SKY:
{
char text[32];
GetDlgItemText(hDlg, IDC_SKY, text, 32);
p_LevelEnvironment->NatureEffect[iIndex].fSky =
(float) atof(text);
}
break;
case IDC_PLANE_LOW:
{
char text[32];
GetDlgItemText(hDlg, IDC_PLANE_LOW, text, 32);
p_LevelEnvironment->NatureEffect[iIndex].fLowPlane =
(float) atof(text);
}
break;
case IDC_NATUREEFFECT:
if (HIWORD(wParam) == CBN_SELCHANGE)
p_LevelEnvironment->NatureEffect[iIndex].EffectID =
(char) SendMessage(GetDlgItem(hDlg, IDC_NATUREEFFECT),
CB_GETCURSEL, 0, 0);
break;
case IDCANCEL:
EndDialog(hDlg, IDCANCEL);
break;
default:
return FALSE; // Neobslouzil message
}
break;
case WM_NOTIFY:
{
}
break;
case WM_INITDIALOG:
OnInitDialogNature(hDlg);
break;
case WM_DESTROY:
EndDialog(hDlg, IDCANCEL);
break;
default:
return FALSE; // Neobslouzil message
}
return TRUE; // Obslouzil message
}
示例9: MainDlgProcWeather
BOOL CALLBACK MainDlgProcWeather(HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam)
{
switch (msg) {
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_HUSTOTA:
{
char text[32];
GetDlgItemText(hDlg, IDC_HUSTOTA, text, 32);
p_LevelEnvironment->Weather[iIndex].uiDensity = atoi(text);
}
break;
case IDC_INTEZITA:
{
char text[32];
GetDlgItemText(hDlg, IDC_INTEZITA, text, 32);
p_LevelEnvironment->Weather[iIndex].uiIntensity = atoi(text);
}
break;
case IDC_ROZPTYL:
{
char text[32];
GetDlgItemText(hDlg, IDC_ROZPTYL, text, 32);
p_LevelEnvironment->Weather[iIndex].fmaxDivergence =
(float) atof(text);
}
break;
case IDC_VZDALENOST:
{
char text[32];
GetDlgItemText(hDlg, IDC_VZDALENOST, text, 32);
p_LevelEnvironment->Weather[iIndex].fDist = (float) atof(text);
}
break;
case IDC_SKY:
{
char text[32];
GetDlgItemText(hDlg, IDC_SKY, text, 32);
p_LevelEnvironment->Weather[iIndex].fSky = (float) atof(text);
}
break;
case IDC_WEATHER:
if (HIWORD(wParam) == CBN_SELCHANGE)
p_LevelEnvironment->Weather[iIndex].iWeather =
(char) SendMessage(GetDlgItem(hDlg, IDC_WEATHER), CB_GETCURSEL,
0, 0);
break;
case IDCANCEL:
EndDialog(hDlg, IDCANCEL);
break;
default:
return FALSE; // Neobslouzil message
}
break;
case WM_NOTIFY:
{
}
break;
case WM_INITDIALOG:
OnInitDialogWeather(hDlg);
break;
case WM_DESTROY:
EndDialog(hDlg, IDCANCEL);
break;
default:
return FALSE; // Neobslouzil message
}
return TRUE; // Obslouzil message
}
示例10: MessageBox
void CPrintersDlg::OnAlterar()
{
CString sPrinter;
POSITION p = m_lstPrinters.GetFirstSelectedItemPosition();
int selected = m_lstPrinters.GetNextSelectedItem(p);
sPrinter = m_lstPrinters.GetItemText(selected, 1);
if(m_lstPrinters.GetSelectedCount() == 0)
{
CString msg;
msg.LoadString(IDS_IMPRESSORA_PADRAO);
MessageBox(msg, L"Mensagem", MB_OK | MB_ICONINFORMATION);
return;
}
Registry reg(HKEY_CURRENT_USER, BT_REG_KEY_APP);
if(!reg.Open())
{
STLOG_WRITE("%s(%d): Open registry: %s", __FUNCTION__, __LINE__,
reg.GetLastErrorString());
CString msg;
msg.LoadString(IDS_ERRO_IMPRESSORA_PADRAO);
MessageBox(msg, L"Erro", MB_OK | MB_ICONERROR);
}
else
{
if(!reg.SetValue(L"DefaultPrinter", sPrinter))
{
STLOG_WRITE("%s(%d): read registry: %s", __FUNCTION__, __LINE__,
reg.GetLastErrorString());
CString msg;
msg.LoadString(IDS_ERRO_IMPRESSORA_PADRAO);
MessageBox(msg, L"Erro", MB_OK | MB_ICONERROR);
}
else
{
#ifdef TESTE_IMPRESSORA
CBTPrinter pp;
pp.SaveDefaultPrinterAddr();
CGetPinDlg gp;
gp.DoModal();
pp.SavePIN(gp.sPin);
#endif
CString msg;
msg.LoadString(IDS_IMPRESSORA_PADRAO_OK);
MessageBox(msg, L"Mensagem", MB_OK | MB_ICONINFORMATION);
}
reg.Close();
}
EndDialog(IDOK);
}
示例11: DefaultWlxWindowProc
static
INT_PTR
CALLBACK
DefaultWlxWindowProc(
IN HWND hwndDlg,
IN UINT uMsg,
IN WPARAM wParam,
IN LPARAM lParam)
{
PDIALOG_LIST_ENTRY ListEntry;
INT_PTR ret;
if (uMsg == WM_INITDIALOG)
{
ListEntry = (PDIALOG_LIST_ENTRY)lParam;
TRACE("Set dialog handle: %p\n", hwndDlg);
ListEntry->hWnd = hwndDlg;
lParam = ListEntry->lParam;
// SetTopTimeout(hWnd);
}
else
{
ListEntry = GetDialogListEntry(hwndDlg);
if (ListEntry == NULL)
return FALSE;
}
if (uMsg == WLX_WM_SAS)
{
EndDialog(hwndDlg, WLX_DLG_SAS);
return 0;
}
ret = ListEntry->DlgProc(hwndDlg, uMsg, wParam, lParam);
return ret;
/*
if (uMsg == WM_TIMER && (UINT_PTR)wParam == IdTimer)
{
EndDialog(hwndDlg, -1);
KillTimer(hwndDlg, IdTimer);
return TRUE;
}
else if (uMsg == WM_INITDIALOG)
{
IdTimer = SetTimer(hwndDlg, 0, WLSession->DialogTimeout * 1000, NULL);
return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
}
else if (uMsg == WM_NCDESTROY)
{
BOOL ret;
ret = PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
PreviousWindowProc = NULL;
return ret;
}
else
{
return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
}
*/
}
示例12: DownloadDialogProc
//.........這裏部分代碼省略.........
if (!advert)
{
ShowWindow(hMain, SW_SHOW);
UpdateWindow(hMain);
}
hDownloadDialog = NULL;
return TRUE;
case BK_TRANSFERSTART:
info->hPostWnd = hDlg;
hThread = (HANDLE)(unsigned long)_beginthread(TransferStart, 0, info);
TransferMessage(GetString(hInst, IDS_CONNECTING), info->machine);
return TRUE;
case BK_FILESIZE: // wParam is file index, lParam is file size
if (wParam == 0)
TransferMessage(GetString(hInst, IDS_RETRIEVING));
SetDlgItemText(hDlg, IDC_FILENAME, info->files[wParam].filename);
total = lParam;
sprintf(temp, format, 0, total);
SetDlgItemText(hDlg, IDC_FILESIZE, temp);
SendDlgItemMessage(hDlg, IDC_GRAPH, GRPH_POSSET, 0, 0);
SendDlgItemMessage(hDlg, IDC_GRAPH, GRPH_RANGESET, 0, total);
return TRUE;
case BK_PROGRESS:
// Update this file's progress indicator.
SendDlgItemMessage(hDlg, IDC_GRAPH, GRPH_POSSET, 0, lParam);
// Update this file's progress text message.
sprintf(temp, format, (int)lParam, (int)total);
SetDlgItemText(hDlg, IDC_FILESIZE, temp);
// Compute the fraction for the overall graph.
fraction = 0;
if (total != 0)
fraction = lParam * 100 / total;
fraction = (fraction + 100 * info->current_file) / info->num_files;
// Update overall progress indicator.
SendDlgItemMessage(hDlg, IDC_FILEGRAPH, GRPH_POSSET, 0, fraction);
return TRUE;
case BK_FILEDONE: /* lParam is index of file in info */
if (abort_download)
{
AbortDownloadDialog();
return TRUE;
}
if (DownloadDone(&info->files[lParam]))
{
if (abort_download)
{
AbortDownloadDialog();
return TRUE;
}
// Set download time
DownloadSetTime(info->files[lParam].time);
// If we're a guest, there may be additional files that we are supposed to skip.
// If so, we should set our download time to the last file, so that we will skip
// the download on the next entry into the game.
if (config.guest)
for (i = lParam + 1; i < info->num_files; i++)
{
if (info->files[i].flags & DF_GUEST)
break;
DownloadSetTime(info->files[i].time);
}
info->current_file++;
// Tell transfer thread to continue
TransferContinue();
TransferMessage(GetString(hInst, IDS_RETRIEVING));
}
else AbortDownloadDialog();
return TRUE;
case BK_TRANSFERDONE:
EndDialog(hDlg, IDOK);
return TRUE;
case WM_COMMAND:
switch(GET_WM_COMMAND_ID(wParam, lParam))
{
case IDCANCEL:
abort_download = True;
EndDialog(hDlg, IDCANCEL);
return TRUE;
}
}
return FALSE;
}
示例13: AskDownloadDialogProc
BOOL CALLBACK AskDownloadDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
char buffer[256];
int i,size;
double hours, minutes, seconds;
double bytes, kb, mb;
switch (message)
{
case WM_INITDIALOG:
CenterWindow(hDlg, hMain);
ShowWindow(hMain, SW_HIDE);
hDownloadDialog = hDlg;
SetWindowText(GetDlgItem(hDlg,IDC_ASK_DOWNLOAD_REASON),info->reason);
size = 0;
for (i = 0; i < (int)info->num_files; i++)
size += info->files[i].size;
bytes = (double)size;
kb = bytes / 1024;
mb = kb / 1024;
if ((int)info->num_files < 2)
sprintf(buffer,"There is one file %d bytes in size.",size);
else if (kb < 1.0)
sprintf(buffer,"There are %d files totaling %d bytes in size.",(int)info->num_files,size);
else if (mb < 1.0)
sprintf(buffer,"There are %d files totaling %.1f Kb in size.",(int)info->num_files,kb);
else
sprintf(buffer,"There are %d files totaling %.1f Mb in size.",(int)info->num_files,mb);
SetWindowText(GetDlgItem(hDlg,IDC_SIZE_UPDATE),buffer);
seconds = floor(bytes / 5600.0 + 10.0);
minutes = seconds / 60.0;
hours = minutes / 60.0;
if (hours > 1.0)
sprintf(buffer,"Estimating %.1f hours with a 56k modem.",hours);
else if (minutes > 1.0)
sprintf(buffer,"Estimating %.1f minutes with a 56k modem.",minutes);
else
sprintf(buffer,"Estimating %.0f seconds with a 56k modem.",seconds);
SetWindowText(GetDlgItem(hDlg,IDC_TIME_UPDATE_566),buffer);
seconds = floor(bytes / 2800.0 + 10.0);
minutes = seconds / 60.0;
hours = minutes / 60.0;
if (hours > 1.0)
sprintf(buffer,"Estimating %.1f hours with a 28k modem.",hours);
else if (minutes > 1.0)
sprintf(buffer,"Estimating %.1f minutes with a 28k modem.",minutes);
else
sprintf(buffer,"Estimating %.0f seconds with a 28k modem.",seconds);
SetWindowText(GetDlgItem(hDlg,IDC_TIME_UPDATE_288),buffer);
//SetWindowText(GetDlgItem(hDlg,IDC_BTN_DEMO),info->demoPath);
break;
case WM_COMMAND:
switch(GET_WM_COMMAND_ID(wParam, lParam))
{
case IDC_BTN_DEMO:
EndDialog(hDlg, 3);
return TRUE;
case IDCANCEL:
abort_download = True;
EndDialog(hDlg, IDCANCEL);
return TRUE;
case IDC_UPDATE:
EndDialog(hDlg, IDOK);
return TRUE;
}
}
return FALSE;
}
示例14: sttEnterStringDlgProc
//.........這裏部分代碼省略.........
return TRUE;
case WM_DESTROY:
Window_FreeIcon_IcoLib(hwndDlg);
break;
case WM_TIMER:
switch (wParam) {
case 1000:
KillTimer(hwndDlg, 1000);
EnableWindow(GetParent(hwndDlg), TRUE);
break;
case 1001:
TCHAR buf[128];
mir_sntprintf(buf, TranslateT("OK (%d)"), --params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
if (params->timeout < 0) {
KillTimer(hwndDlg, 1001);
UIEmulateBtnClick(hwndDlg, IDOK);
}
}
return TRUE;
case WM_SIZE:
Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_ENTER_STRING), sttEnterStringResizer);
break;
case WM_GETMINMAXINFO:
{
LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
if (params && params->height)
lpmmi->ptMaxSize.y = lpmmi->ptMaxTrackSize.y = params->height;
}
break;
case WM_NOTIFY:
{
ENLINK *param = (ENLINK *)lParam;
if (param->nmhdr.idFrom != IDC_TXT_RICHEDIT) break;
if (param->nmhdr.code != EN_LINK) break;
if (param->msg != WM_LBUTTONUP) break;
CHARRANGE sel;
SendMessage(param->nmhdr.hwndFrom, EM_EXGETSEL, 0, (LPARAM)& sel);
if (sel.cpMin != sel.cpMax) break; // allow link selection
TEXTRANGE tr;
tr.chrg = param->chrg;
tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 2));
SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
Utils_OpenUrlT(tr.lpstrText);
mir_free(tr.lpstrText);
}
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_TXT_MULTILINE:
case IDC_TXT_RICHEDIT:
if ((HIWORD(wParam) != EN_SETFOCUS) && (HIWORD(wParam) != EN_KILLFOCUS)) {
SetDlgItemText(hwndDlg, IDOK, TranslateT("OK"));
KillTimer(hwndDlg, 1001);
}
break;
case IDC_TXT_COMBO:
if ((HIWORD(wParam) != CBN_SETFOCUS) && (HIWORD(wParam) != CBN_KILLFOCUS)) {
SetDlgItemText(hwndDlg, IDOK, TranslateT("OK"));
KillTimer(hwndDlg, 1001);
}
break;
case IDCANCEL:
if (params->szDataPrefix)
Utils_SaveWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix);
EndDialog(hwndDlg, 0);
break;
case IDOK:
HWND hWnd = GetDlgItem(hwndDlg, params->idcControl);
int len = GetWindowTextLength(hWnd)+1;
params->ptszResult = (LPTSTR)mir_alloc(sizeof(TCHAR)*len);
GetWindowText(hWnd, params->ptszResult, len);
if ((params->type == ESF_COMBO) && params->szDataPrefix && params->recentCount)
ComboAddRecentString(hwndDlg, params);
if (params->szDataPrefix)
Utils_SaveWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix);
EndDialog(hwndDlg, 1);
break;
}
}
return FALSE;
}
示例15: DialogProc
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG || uMsg == WM_NOTIFY_OUTER_NEXT)
{
page *this_page;
static DLGPROC winprocs[]=
{
#ifdef NSIS_CONFIG_LICENSEPAGE
LicenseProc,
#endif
#ifdef NSIS_CONFIG_COMPONENTPAGE
SelProc,
#endif
DirProc,
InstProc,
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
UninstProc
#endif
};
m_delta = wParam;
if (uMsg == WM_INITDIALOG)
{
g_hwnd=hwndDlg;
m_hwndOK=GetDlgItem(hwndDlg,IDOK);
m_hwndCancel=GetDlgItem(hwndDlg,IDCANCEL);
SetDlgItemTextFromLang(hwndDlg,IDC_VERSTR,LANG_BRANDING);
SetClassLong(hwndDlg,GCL_HICON,(long)g_hIcon);
// use the following line instead of the above, if .rdata needs shirking
//SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)g_hIcon);
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
g_quit_flag = ExecuteCallbackFunction(CB_ONGUIINIT);
#endif
//ShowWindow(hwndDlg, SW_SHOW);
m_delta = 1;
}
this_page=g_pages+m_page;
if (m_page>=0) {
#ifdef NSIS_SUPPORT_CODECALLBACKS
// Call leave function. If Abort used don't move to the next page.
// But if quit called we must exit now
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) {
SendMessage(m_curwnd, WM_IN_UPDATEMSG, 0, 1);
return !g_quit_flag;
}
#endif
// if the last page was a custom page, wait for it to finish by itself.
// if it doesn't, it's a BAD plugin.
// plugins should react to WM_NOTIFY_OUTER_NEXT.
if (!this_page->dlg_id) return 0;
}
NotifyCurWnd(WM_NOTIFY_INIGO_MONTOYA);
nextPage:
m_page+=m_delta;
this_page+=m_delta;
#ifdef NSIS_SUPPORT_CODECALLBACKS
if (m_page==g_blocks[NB_PAGES].num) ExecuteCallbackFunction(CB_ONINSTSUCCESS);
#endif//NSIS_SUPPORT_CODECALLBACKS
if (g_quit_flag || (unsigned int)m_page >= (unsigned int)g_blocks[NB_PAGES].num)
{
DestroyWindow(m_curwnd);
g_hwnd = 0;
EndDialog(hwndDlg,m_retcode);
}
else
{
HWND hwndtmp;
int pflags = this_page->flags;
GetNSISString(state_click_next, this_page->clicknext);
SetDlgItemTextFromLang(hwndDlg, IDOK, this_page->next);
SetDlgItemTextFromLang(hwndDlg, IDC_BACK, this_page->back);
SetDlgItemTextFromLang(hwndDlg, IDCANCEL, this_page->cancel);
hwndtmp = GetDlgItem(hwndDlg, IDC_BACK);
if (g_exec_flags.abort)
{
pflags &= ~(PF_BACK_ENABLE | PF_NEXT_ENABLE);
pflags |= PF_CANCEL_ENABLE;
}
ShowWindow(hwndtmp, pflags & PF_BACK_SHOW);// SW_HIDE = 0, PF_BACK_SHOW = SW_SHOWNA = 8
EnableWindow(hwndtmp, pflags & PF_BACK_ENABLE);
EnableNext(pflags & PF_NEXT_ENABLE);
EnableWindow(m_hwndCancel, pflags & PF_CANCEL_ENABLE);
if (pflags & PF_CANCEL_ENABLE)
EnableMenuItem(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_ENABLED);
else
EnableMenuItem(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
//.........這裏部分代碼省略.........