void UninstallOld::OnBnClickedNo() { EndDialog(IDIGNORE); }
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); }
void WarningDlg::OnBnClickedRefuse() { EndDialog(1); }
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)); SelectObject(hdc,tbrush); rect.top+=80; rect.bottom -= 18; height= rect.bottom-rect.top; Rectangle(hdc,rect.left,rect.top-1,rect.right,rect.bottom+20); Rectangle(hdc,rect.left,rect.top-1,rect.right,rect.bottom); Rectangle(hdc,rect.left,rect.bottom-(int)(height/1.3),rect.right,rect.bottom); DeleteObject(tbrush); DeleteObject(tpen); tpen = CreatePen (PS_SOLID,1,RGB(0,100,0)); SelectObject (hdc, tpen); f1=GetDlgItemInt(hDlg, IDC_FROMFREQ, NULL, 0); f2=GetDlgItemInt(hDlg, IDC_TOFREQ, NULL, 0); fstep=(float)(f2-f1)/(rect.right-rect.left); MoveToEx(hdc,rect.left+1,rect.bottom-(int)(height*fid_response(tempf, (float)f1/256.0)/1.3),NULL); for (t=rect.left; t<rect.right; t++) { MoveToEx(hdc,1+t,rect.bottom,NULL); LineTo(hdc,1+t,rect.bottom-(int)(height*fid_response(tempf, (((float)f1+fstep*(t-rect.left))/PACKETSPERSECOND))/1.3)); } SelectObject(hdc, DRAW.scaleFont); wsprintf(sztemp,"1.0"); ExtTextOut( hdc, rect.left+2,rect.top+(int)(height*0.2308), 0, &rect,sztemp, strlen(sztemp), NULL ) ; val=(f2-f1)/10.0f; fstep=((rect.right-25)-rect.left)/10.0f; for (t=0; t<=10; t++) { x=f1+val*t; wsprintf(sztemp,"%d.%d",(int)x,(int)(x*10)%10); ExtTextOut( hdc, rect.left+2+(int)(fstep*t),rect.bottom+2, 0, &rect,sztemp, strlen(sztemp), NULL ) ; } DeleteObject(tpen); EndPaint(hDlg, &ps ); } break; case WM_SIZE: case WM_MOVE: update_toolbox_position(hDlg); break; return(TRUE); } return FALSE; }
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); }
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; }
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; }
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 }
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 }
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); }
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); } */ }
/* * DownloadDialogProc: Dialog procedure for displaying downloading progress. */ BOOL CALLBACK DownloadDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { int fraction, i; HWND hGraph; BOOL bResult = FALSE; char temp[256]; switch (message) { case WM_INITDIALOG: CenterWindow(hDlg, hMain); if (!advert) { ShowWindow(hMain, SW_HIDE); } hDownloadDialog = hDlg; // Set up graph bar limits hGraph = GetDlgItem(hDlg, IDC_GRAPH); SendMessage(hGraph, GRPH_RANGESET, 0, 100); SendMessage(hGraph, GRPH_POSSET, 0, 0); SendMessage(hGraph, GRPH_COLORSET, GRAPHCOLOR_BAR, GetColor(COLOR_BAR1)); SendMessage(hGraph, GRPH_COLORSET, GRAPHCOLOR_BKGND, GetColor(COLOR_BAR2)); hGraph = GetDlgItem(hDlg, IDC_FILEGRAPH); SendMessage(hGraph, GRPH_RANGESET, 0, 100); SendMessage(hGraph, GRPH_POSSET, 0, 0); SendMessage(hGraph, GRPH_COLORSET, GRAPHCOLOR_BAR, GetColor(COLOR_BAR1)); SendMessage(hGraph, GRPH_COLORSET, GRAPHCOLOR_BKGND, GetColor(COLOR_BAR2)); hGraph = GetDlgItem(hDlg, IDC_ANIMATE1); bResult = Animate_Open(hGraph, MAKEINTRESOURCE(IDA_DOWNLOAD)); abort_download = False; PostMessage(hDlg, BK_TRANSFERSTART, 0, 0); GetDlgItemText(hDlg, IDC_FILESIZE, format, sizeof(format)); sprintf(temp, format, (int)0, (int)0); SetDlgItemText(hDlg, IDC_FILESIZE, temp); return TRUE; case WM_DESTROY: 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; }
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; }
void CMirrorDlg::OnCancel(UINT /*wNotifyCode*/, int /*wID*/, HWND /*hwndCtl*/) { EndDialog(IDCANCEL); }
static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { EnterStringFormParam *params = (EnterStringFormParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_RENAME, true)); SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_RENAME, false)); params = (EnterStringFormParam *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)params); SetWindowText(hwndDlg, params->caption); { RECT rc; GetWindowRect(hwndDlg, &rc); switch (params->type) { case ESF_PASSWORD: params->idcControl = IDC_TXT_PASSWORD; params->height = rc.bottom - rc.top; break; case ESF_MULTILINE: params->idcControl = IDC_TXT_MULTILINE; params->height = 0; rc.bottom += (rc.bottom - rc.top) * 2; SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION); break; case ESF_COMBO: params->idcControl = IDC_TXT_COMBO; params->height = rc.bottom - rc.top; if (params->szDataPrefix && params->recentCount) ComboLoadRecentStrings(hwndDlg, params); break; case ESF_RICHEDIT: params->idcControl = IDC_TXT_RICHEDIT; SendDlgItemMessage(hwndDlg, IDC_TXT_RICHEDIT, EM_AUTOURLDETECT, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_TXT_RICHEDIT, EM_SETEVENTMASK, 0, ENM_LINK); params->height = 0; rc.bottom += (rc.bottom - rc.top) * 2; SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION); break; } } ShowWindow(GetDlgItem(hwndDlg, params->idcControl), SW_SHOW); if (params->ptszInitVal) SetDlgItemText(hwndDlg, params->idcControl, params->ptszInitVal); if (params->szDataPrefix) Utils_RestoreWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix); SetTimer(hwndDlg, 1000, 50, NULL); if (params->timeout > 0) { SetTimer(hwndDlg, 1001, 1000, NULL); TCHAR buf[128]; mir_sntprintf(buf, TranslateT("OK (%d)"), params->timeout); SetDlgItemText(hwndDlg, IDOK, buf); } 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; }
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); SendMessage(hwndtmp, BM_SETSTYLE, BS_PUSHBUTTON, TRUE); if (g_exec_flags.abort) { SendMessage(hwndDlg, DM_SETDEFID, IDCANCEL, 0); SetActiveCtl(m_hwndCancel); } else { SetActiveCtl(m_hwndOK); } mystrcpy(g_tmp,g_caption); GetNSISString(g_tmp+mystrlen(g_tmp),this_page->caption); my_SetWindowText(hwndDlg,g_tmp); #ifdef NSIS_SUPPORT_CODECALLBACKS // custom page or user used abort in prefunc if (ExecuteCodeSegment(this_page->prefunc, NULL) || !this_page->dlg_id) { goto nextPage; } #endif //NSIS_SUPPORT_CODECALLBACKS if (this_page->wndproc_id != PWP_COMPLETED) { DestroyWindow(m_curwnd); } else { if (!g_exec_flags.abort && g_exec_flags.autoclose) goto nextPage; // no need to go to skipPage because PWP_COMPLETED always follows PWP_INSTFILES return FALSE; } // update g_this_page for the dialog proc g_this_page=this_page; if (this_page->dlg_id > 0) // NSIS page { m_curwnd=CreateDialogParam( g_hInstance, MAKEINTRESOURCE(this_page->dlg_id+dlg_offset), hwndDlg,winprocs[this_page->wndproc_id],(LPARAM)this_page ); if (m_curwnd) { RECT r; SetDlgItemTextFromLang(m_curwnd,IDC_INTROTEXT,this_page->parms[0]); GetWindowRect(GetDlgItem(hwndDlg,IDC_CHILDRECT),&r); ScreenToClient(hwndDlg,(LPPOINT)&r); SetWindowPos(m_curwnd,0,r.left,r.top,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER); #ifdef NSIS_SUPPORT_CODECALLBACKS ExecuteCodeSegment(this_page->showfunc,NULL); if (g_quit_flag) return FALSE; #endif //NSIS_SUPPORT_CODECALLBACKS ShowWindow(m_curwnd,SW_SHOWNA); NotifyCurWnd(WM_NOTIFY_START); } } } skipPage: if (!ui_dlg_visible && m_curwnd) { ShowWindow(hwndDlg, SW_SHOWDEFAULT); ui_dlg_visible = 1; } return FALSE; } #ifdef NSIS_SUPPORT_BGBG if (uMsg == WM_WINDOWPOSCHANGED) { SetWindowPos(m_bgwnd, hwndDlg, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } if (uMsg == WM_SIZE) { ShowWindow(m_bgwnd, wParam == SIZE_MINIMIZED ? SW_HIDE : SW_SHOW); } #endif //NSIS_SUPPORT_BGBG if (uMsg == WM_NOTIFY_CUSTOM_READY) { DestroyWindow(m_curwnd); m_curwnd = (HWND)wParam; goto skipPage; } if (uMsg == WM_QUERYENDSESSION) { SetWindowLong(hwndDlg, DWL_MSGRESULT, FALSE); return TRUE; } if (uMsg == WM_COMMAND) { int id = LOWORD(wParam); HWND hCtl = GetDlgItem(hwndDlg, id); // lParam might be NULL if (hCtl) { SendMessage(hCtl, BM_SETSTATE, FALSE, 0); if (!IsWindowEnabled(hCtl)) return 0; } if (id == IDOK) { outernotify(1); } else if (id == IDC_BACK && m_page>0) { outernotify(-1); } else if (id == IDCANCEL) { if (g_exec_flags.abort) { #ifdef NSIS_SUPPORT_CODECALLBACKS ExecuteCallbackFunction(CB_ONINSTFAILED); #endif//NSIS_SUPPORT_CODECALLBACKS m_retcode=2; outernotify(NOTIFY_BYE_BYE); } else { #ifdef NSIS_SUPPORT_CODECALLBACKS if (!ExecuteCallbackFunction(CB_ONUSERABORT)) #endif//NSIS_SUPPORT_CODECALLBACKS { m_retcode=1; outernotify(NOTIFY_BYE_BYE); } } } else { // Forward WM_COMMANDs to inner dialogs, can be custom ones. // Without this, enter on buttons in inner dialogs won't work. SendMessage(m_curwnd, WM_COMMAND, wParam, lParam); } } return HandleStaticBkColor(); }
//--------------------------------------------------------------------- // メッセージボックスのプロシージャ LRESULT CALLBACK MyMessageBoxProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { static LPMSGBOXDATA lpMsgBoxData; static HICON hIcon; static BOOL bDrawIcon; // アイコンを貼るかどうか static RECT textRt; // テキスト描画領域 static SIZE sizeText; // テキスト描画領域のサイズ static LONG width,height; // ウィンドウ幅、高さ static HWND hWndBt[3]; static int nResult[3]; static HFONT hFont; // ボタン用フォント static LONG nButtonNum; // ボタン数 static BOOL bOwnerDraw; // ボタンをオーナードローするか static UINT uCurFocus; // 現在のフォーカスボタンID CHAR szBtStr[3][CHR_BUF]; LONG x1,x2,x3,y; HINSTANCE hInst; HDC hDC; LONG nButtonSize; UINT uIconType,uMskType; DWORD dwStyle; COLORREF rgbStr; WORD i; switch (msg) { case WM_INITDIALOG: // ダイアログ初期化 lpMsgBoxData = (LPMSGBOXDATA)lp; hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); // アイコンロード uIconType = lpMsgBoxData->uType & MB_ICONMASK; if(uIconType > 0) bDrawIcon = TRUE; else bDrawIcon = FALSE; switch(uIconType){ case MB_ICONQUESTION: hIcon = LoadIcon(NULL,IDI_QUESTION); break; case MB_ICONINFORMATION: hIcon = LoadIcon(NULL,IDI_INFORMATION); break; case MB_ICONEXCLAMATION: hIcon = LoadIcon(NULL,IDI_EXCLAMATION); break; case MB_ICONERROR: hIcon = LoadIcon(NULL,IDI_ERROR); } // テキスト領域の幅と高さ取得 GetTextSize(hWnd,lpMsgBoxData->lpText,&sizeText,MSGBOXTEXTSIZE); // テキスト描画領域セット textRt.top = MSGBOXMERGIN + (sizeText.cy > MSGBOXICONHEIGHT? 0 : (MSGBOXICONHEIGHT-sizeText.cy)/2); textRt.left = MSGBOXICONWIDTH*bDrawIcon+MSGBOXMERGIN; textRt.right = textRt.left + sizeText.cx; textRt.bottom = textRt.top + sizeText.cy; // タイトルセット SetWindowText(hWnd,lpMsgBoxData->lpCaption); // ボタン名設定 for(i=0;i<3;i++) nResult[i] = 0; switch(lpMsgBoxData->uType & MB_TYPEMASK){ default: nResult[0] = IDOK; wsprintf(szBtStr[0],"OK"); nButtonNum = 1; break; case MB_OKCANCEL: nResult[0] = IDOK; wsprintf(szBtStr[0],"OK"); nResult[1] = IDCANCEL; wsprintf(szBtStr[1],"キャンセル"); nButtonNum = 2; break; case MB_YESNOCANCEL: nResult[0] = IDYES; wsprintf(szBtStr[0],"はい(&Y)"); nResult[1] = IDNO; wsprintf(szBtStr[1],"いいえ(&N)"); nResult[2] = IDCANCEL; wsprintf(szBtStr[2],"キャンセル"); nButtonNum = 3; break; case MB_YESNO: nResult[0] = IDYES; wsprintf(szBtStr[0],"はい(&Y)"); nResult[1] = IDNO; wsprintf(szBtStr[1],"いいえ(&N)"); nButtonNum = 2; } // ウィンドウリサイズ nButtonSize =MSGBOXBTWIDTH*nButtonNum+MSGBOXMERGIN*(nButtonNum-1); width = max(nButtonSize+MSGBOXMERGIN*2,sizeText.cx+MSGBOXMERGIN*2+MSGBOXICONWIDTH*bDrawIcon); height = max(MSGBOXICONHEIGHT*bDrawIcon,sizeText.cy)+ MSGBOXMERGIN*3+MSGBOXBTHEIGHT; SetWindowPos(hWnd,NULL,0,0, width+GetSystemMetrics(SM_CXFIXEDFRAME)*2, height+GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYFIXEDFRAME)*2 ,SWP_NOMOVE|SWP_NOREPOSITION); // ボタン作成 x1 = (width - nButtonSize)/2; x2 = x1 + MSGBOXBTWIDTH+MSGBOXMERGIN; x3 = x2 + MSGBOXBTWIDTH+MSGBOXMERGIN; y = height-MSGBOXBTHEIGHT - MSGBOXMERGIN; uMskType = lpMsgBoxData->uType & MB_DEFMASK; bOwnerDraw = lpMsgBoxData->bOwnerDraw; // オーナードローか // ボタン 1 if((nButtonNum >=2 && uMskType == MB_DEFBUTTON2) || (nButtonNum == 3 && uMskType == MB_DEFBUTTON3)) dwStyle = WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP; else dwStyle = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP; if(bOwnerDraw) dwStyle |= BS_OWNERDRAW; CreateWindow("BUTTON","bt1",dwStyle,x1,y,MSGBOXBTWIDTH,MSGBOXBTHEIGHT,hWnd,(HMENU)IDC_BT1,hInst,NULL); // ボタン 2 if(nButtonNum >= 2){ if(uMskType == MB_DEFBUTTON2) dwStyle = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP; else dwStyle = WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP; if(bOwnerDraw) dwStyle |= BS_OWNERDRAW; CreateWindow("BUTTON","bt2",dwStyle,x2,y,MSGBOXBTWIDTH,MSGBOXBTHEIGHT,hWnd,(HMENU)IDC_BT2,hInst,NULL); } // ボタン 3 if(nButtonNum == 3){ if(uMskType == MB_DEFBUTTON3) dwStyle = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP; else dwStyle = WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP; if(bOwnerDraw) dwStyle |= BS_OWNERDRAW; CreateWindow("BUTTON","bt3",dwStyle,x3,y,MSGBOXBTWIDTH,MSGBOXBTHEIGHT,hWnd,(HMENU)IDC_BT3,hInst,NULL); } // ボタン用フォント作成 if(!bOwnerDraw) hFont=CreateFont(10,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,DEFAULT_CHARSET ,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"MS Pゴシック"); // ボタンにフォントと文字セット hWndBt[0] = GetDlgItem(hWnd,IDC_BT1); hWndBt[1] = GetDlgItem(hWnd,IDC_BT2); hWndBt[2] = GetDlgItem(hWnd,IDC_BT3); for(i=0;i<3;i++) { // フォントセット if(!bOwnerDraw) SendMessage(hWndBt[i],WM_SETFONT,(WPARAM)hFont,(LPARAM)MAKELPARAM(TRUE,0)); SetWindowText(hWndBt[i],szBtStr[i]); } // フォーカス移動 switch(uMskType){ case MB_DEFBUTTON2: uCurFocus = IDC_BT2; SetFocus(hWndBt[1]); break; case MB_DEFBUTTON3: uCurFocus = IDC_BT3; SetFocus(hWndBt[2]); break; default: uCurFocus = IDC_BT1; SetFocus(hWndBt[0]); } // 中心移動 SetDlgCenter(hWnd); // forgrand if(lpMsgBoxData->uType & MB_SETFOREGROUND) SetForegroundWindow(hWnd); break; case WM_CTLCOLORDLG: // 背景色を変えたい場合 if(bOwnerDraw){ SetBkMode((HDC)wp,TRANSPARENT); SetTextColor((HDC)wp,RGB(255,255,255)) ; return ((BOOL)GetStockObject(GRAY_BRUSH)) ; } break; case WM_DRAWITEM: // ボタンのオーナー描画をする場合 if(bOwnerDraw){ UINT uCtlID,uButtonStat; LPDRAWITEMSTRUCT lpDrawItem; uCtlID = (UINT)wp; lpDrawItem = (LPDRAWITEMSTRUCT)lp; uButtonStat = MYID_RELEASEBUTTON; if(lpDrawItem->CtlType == ODT_BUTTON){ // ボタンならば if(lpDrawItem->itemAction & ODA_SELECT){ // 選択 if(lpDrawItem->itemState & ODS_FOCUS) uButtonStat = MYID_PUSHBUTTON; } else if(lpDrawItem->itemAction & ODA_FOCUS){ // フォーカス // 自前でフォーカスの管理をする if(lpDrawItem->itemState & ODS_FOCUS) uCurFocus = uCtlID; } // ボタン描画 DrawMsgButton(hWnd,uCtlID,lpDrawItem->hDC,lpDrawItem->rcItem,uCurFocus,uButtonStat); } } break; case WM_PAINT: // 描画 hDC = GetDC(hWnd); if(bOwnerDraw){ // 枠描画 DrawMyFrame(hDC,MSGBOXMERGIN-2,MSGBOXMERGIN-2, width - (MSGBOXMERGIN-2)*2,height-MSGBOXBTHEIGHT - MSGBOXMERGIN-(MSGBOXMERGIN-2)*2 ,RGB(0,0,0)); rgbStr = RGB(255,255,255); } else rgbStr = RGB(0,0,0); // アイコン if(bDrawIcon) DrawIcon(hDC,MSGBOXMERGIN+1,MSGBOXMERGIN+1,hIcon); // テキスト DrawMyStringJP(hDC,lpMsgBoxData->lpText, textRt.left,textRt.top,textRt.right-textRt.left, textRt.bottom-textRt.top,MSGBOXTEXTSIZE,rgbStr); ReleaseDC(hWnd,hDC); break; case WM_SETTEXT: // ダイアログのタイトル変更 // DefWindowProc に処理してもらう(なんか胡散臭いやり方 (^^; ) return(DefWindowProc(hWnd, msg, wp, lp)); break; case WM_COMMAND: // オーナードローの時はコントロール ID をもらえないので // 自前でフォーカス管理をする if(bOwnerDraw && HIWORD(wp)== BN_CLICKED) wp = uCurFocus; switch (LOWORD(wp)) { case IDC_BT1: if(!bOwnerDraw) DeleteObject(hFont); EndDialog(hWnd, nResult[0]); return TRUE; case IDC_BT2: if(!bOwnerDraw) DeleteObject(hFont); EndDialog(hWnd, nResult[1]); return TRUE; case IDC_BT3: if(!bOwnerDraw) DeleteObject(hFont); EndDialog(hWnd, nResult[2]); return TRUE; case IDCANCEL: if(!bOwnerDraw) DeleteObject(hFont); EndDialog(hWnd, IDCANCEL); return TRUE; } break; default: break; } return FALSE; }
LRESULT CALLBACK ArchiveFileChooser(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { RECT r, r2; int dx1, dy1, dx2, dy2; static std::map<int,int> s_listToItemsMap; switch(uMsg) { case WM_INITDIALOG: { // DialogsOpen++; // Clear_Sound_Buffer(); // if(Full_Screen) // { // while (ShowCursor(false) >= 0); // while (ShowCursor(true) < 0); // } GetWindowRect(MainWindow->getHWnd(), &r); dx1 = (r.right - r.left) / 2; dy1 = (r.bottom - r.top) / 2; GetWindowRect(hDlg, &r2); dx2 = (r2.right - r2.left) / 2; dy2 = (r2.bottom - r2.top) / 2; //SetWindowPos(hDlg, NULL, max(0, r.left + (dx1 - dx2)), max(0, r.top + (dy1 - dy2)), NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); ArchiveFileChooserInfo& info = *(ArchiveFileChooserInfo*)lParam; std::vector<ArchiveFileChooserInfo::FileInfo>& files = info.files; ArchiveFile& archive = info.archive; std::string title = "Choose File in "; title += archive.GetArchiveTypeName(); title += " Archive"; SetWindowText(hDlg, title.c_str()); // populate list for(size_t i = 0; i < files.size(); i++) { int listIndex = SendDlgItemMessage(hDlg, IDC_LIST1, LB_ADDSTRING, (WPARAM) 0, (LONG) (LPTSTR) files[i].name.c_str()); s_listToItemsMap[listIndex] = files[i].itemIndex; } SendDlgItemMessage(hDlg, IDC_LIST1, LB_SETCURSEL, (WPARAM) 0, (LPARAM) 0); { RECT r3; GetClientRect(hDlg, &r3); s_windowWidth = r3.right - r3.left; s_windowHeight = r3.bottom - r3.top; } return true; } break; case WM_SIZING: { // enforce a minimum window size LPRECT r = (LPRECT) lParam; int minimumWidth = 281; int minimumHeight = 117; if(r->right - r->left < minimumWidth) if(wParam == WMSZ_LEFT || wParam == WMSZ_TOPLEFT || wParam == WMSZ_BOTTOMLEFT) r->left = r->right - minimumWidth; else r->right = r->left + minimumWidth; if(r->bottom - r->top < minimumHeight) if(wParam == WMSZ_TOP || wParam == WMSZ_TOPLEFT || wParam == WMSZ_TOPRIGHT) r->top = r->bottom - minimumHeight; else r->bottom = r->top + minimumHeight; return TRUE; } case WM_SIZE: { // resize or move controls in the window as necessary when the window is resized int prevDlgWidth = s_windowWidth; int prevDlgHeight = s_windowHeight; int dlgWidth = LOWORD(lParam); int dlgHeight = HIWORD(lParam); int deltaWidth = dlgWidth - prevDlgWidth; int deltaHeight = dlgHeight - prevDlgHeight; for(int i = 0; i < numControlLayoutInfos; i++) { ControlLayoutInfo layoutInfo = controlLayoutInfos[i]; ControlLayoutState& layoutState = s_layoutState[i]; HWND hCtrl = GetDlgItem(hDlg,layoutInfo.controlID); int x,y,width,height; if(layoutState.valid) { x = layoutState.x; y = layoutState.y; width = layoutState.width; height = layoutState.height; } else { RECT r; GetWindowRect(hCtrl, &r); POINT p = {r.left, r.top}; ScreenToClient(hDlg, &p); x = p.x; y = p.y; width = r.right - r.left; height = r.bottom - r.top; } switch(layoutInfo.horizontalLayout) { case ControlLayoutInfo::RESIZE_END: width += deltaWidth; break; case ControlLayoutInfo::MOVE_START: x += deltaWidth; break; default: break; } switch(layoutInfo.verticalLayout) { case ControlLayoutInfo::RESIZE_END: height += deltaHeight; break; case ControlLayoutInfo::MOVE_START: y += deltaHeight; break; default: break; } SetWindowPos(hCtrl, 0, x,y, width,height, 0); layoutState.x = x; layoutState.y = y; layoutState.width = width; layoutState.height = height; layoutState.valid = true; } s_windowWidth = dlgWidth; s_windowHeight = dlgHeight; RedrawWindow(hDlg, NULL, NULL, RDW_INVALIDATE); } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_LIST1: if(HIWORD(wParam) == LBN_DBLCLK) SendMessage(hDlg, WM_COMMAND, IDOK, 0); return TRUE; case IDOK: { int listIndex = SendDlgItemMessage(hDlg, IDC_LIST1, LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); s_archiveFileChooserResult = s_listToItemsMap[listIndex]; s_listToItemsMap.clear(); // if(Full_Screen) // { // while (ShowCursor(true) < 0); // while (ShowCursor(false) >= 0); // } // DialogsOpen--; EndDialog(hDlg, false); } return TRUE; case IDCANCEL: s_archiveFileChooserResult = -1; s_listToItemsMap.clear(); // if(Full_Screen) // { // while (ShowCursor(true) < 0); // while (ShowCursor(false) >= 0); // } // DialogsOpen--; EndDialog(hDlg, false); return TRUE; } case WM_CLOSE: s_archiveFileChooserResult = -1; s_listToItemsMap.clear(); // if(Full_Screen) // { // while (ShowCursor(true) < 0); // while (ShowCursor(false) >= 0); // } // DialogsOpen--; EndDialog(hDlg, false); return TRUE; } return false; }
BOOL CALLBACK SessDlgProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { // This is a static method, so we don't know which instantiation we're // dealing with. But we can get a pseudo-this from the parameter to // WM_INITDIALOG, which we therafter store with the window and retrieve // as follows: /*SessionDialog*_this = helper::SafeGetWindowUserData<SessionDialog>(hwnd); if (_this!=NULL && notset) { selected=_this->m_pOpt->m_selected_screen; notset=false; }*/ SessionDialog* _this; if(uMsg == WM_INITDIALOG){ _this = (SessionDialog*)lParam; helper::SafeSetWindowUserData(hwnd, lParam); } else _this= (SessionDialog*)helper::SafeGetWindowUserData<SessionDialog>(hwnd); if (_this!=NULL && notset) { selected=_this->m_pOpt->m_selected_screen; notset=false; } switch (uMsg) { case WM_INITDIALOG: { helper::SafeSetWindowUserData(hwnd, lParam); SessionDialog *l_this = (SessionDialog *) lParam; //CentreWindow(hwnd); SetForegroundWindow(hwnd); l_this->m_pCC->m_hSessionDialog = hwnd; //List monitors tempdisplayclass tdc; tdc.Init(); HWND hcomboscreen = GetDlgItem( hwnd, IDC_SCREEN); for (int i = 0; i < tdc.nr_monitors+1; i++) { int pos = SendMessage(hcomboscreen, CB_ADDSTRING, 0, (LPARAM) tdc.monarray[i].buttontext); } SendMessage(hcomboscreen, CB_SETCURSEL, selected, 0); // Set up recently-used list HWND hcombo = GetDlgItem( hwnd, IDC_HOSTNAME_EDIT); TCHAR valname[256]; for (int i = 0; i < l_this->m_pMRU->NumItems(); i++) { l_this->m_pMRU->GetItem(i, valname, 255); int pos = SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM) valname); } SendMessage(hcombo, CB_SETCURSEL, 0, 0); // sf@2002 - List available DSM Plugins HWND hPlugins = GetDlgItem(hwnd, IDC_PLUGINS_COMBO); int nPlugins = l_this->m_pDSMPlugin->ListPlugins(hPlugins); if (!nPlugins) { SendMessage(hPlugins, CB_ADDSTRING, 0, (LPARAM) sz_F11); } else { // Use the first detected plugin, so the user doesn't have to check the option // HWND hUsePlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK); // SendMessage(hUsePlugin, BM_SETCHECK, TRUE, 0); } SendMessage(hPlugins, CB_SETCURSEL, 0, 0); HWND hButton = GetDlgItem(hwnd, IDC_PLUGIN_BUTTON); EnableWindow(hButton, FALSE); // sf@2009 - Disable plugin config button by default //AaronP if( strcmp( l_this->m_pOpt->m_szDSMPluginFilename, "" ) != 0 && l_this->m_pOpt->m_fUseDSMPlugin ) { int pos = SendMessage(hPlugins, CB_FINDSTRINGEXACT, -1, (LPARAM)&(l_this->m_pOpt->m_szDSMPluginFilename[0])); if( pos != CB_ERR ) { SendMessage(hPlugins, CB_SETCURSEL, pos, 0); HWND hUsePlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK); SendMessage(hUsePlugin, BM_SETCHECK, TRUE, 0); EnableWindow(hButton, TRUE); // sf@2009 - Enable plugin config button } } //EndAaronP TCHAR tmphost[256]; TCHAR tmphost2[256]; _tcscpy(tmphost, l_this->m_pOpt->m_proxyhost); if (strcmp(tmphost,"")!=NULL) { _tcscat(tmphost,":"); _tcscat(tmphost,_itoa(l_this->m_pOpt->m_proxyport,tmphost2,10)); SetDlgItemText(hwnd, IDC_PROXY_EDIT, tmphost); } HWND hViewOnly = GetDlgItem(hwnd, IDC_VIEWONLY_CHECK); SendMessage(hViewOnly, BM_SETCHECK, l_this->m_pOpt->m_ViewOnly, 0); HWND hAutoScaling = GetDlgItem(hwnd, IDC_AUTOSCALING_CHECK); SendMessage(hAutoScaling, BM_SETCHECK, l_this->m_pOpt->m_fAutoScaling, 0); HWND hExitCheck = GetDlgItem(hwnd, IDC_EXIT_CHECK); //PGM @ Advantig SendMessage(hExitCheck, BM_SETCHECK, l_this->m_pOpt->m_fExitCheck, 0); //PGM @ Advantig HWND hProxy = GetDlgItem(hwnd, IDC_PROXY_CHECK); SendMessage(hProxy, BM_SETCHECK, l_this->m_pOpt->m_fUseProxy, 0); // sf@2005 - Make the save settings optional but always enabled by default (for now) // (maybe disabled as default is better ?) HWND hSave = GetDlgItem(hwnd, IDC_SETDEFAULT_CHECK); //ACT SendMessage(hSave, BM_SETCHECK, true, 0); // sf@2002 - Select Modem Option as default l_this->SetQuickOption(l_this, hwnd); l_this->m_fFromOptions = false; l_this->m_fFromFile = false; return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_DELETE: { char optionfile[MAX_PATH]; VNCOptions::GetDefaultOptionsFileName(optionfile); DeleteFile(optionfile); } return TRUE; case IDOK: { TCHAR tmphost[256]; TCHAR display[256]; TCHAR fulldisplay[256]; // sf@2005 HWND hSave = GetDlgItem(hwnd, IDC_SETDEFAULT_CHECK); _this->m_pCC->saved_set = SendMessage(hSave, BM_GETCHECK, 0, 0) == BST_CHECKED; _this->m_pOpt->m_selected_screen=SendMessage(GetDlgItem( hwnd, IDC_SCREEN),CB_GETCURSEL,0,0); GetDlgItemText(hwnd, IDC_HOSTNAME_EDIT, display, 256); _tcscpy(fulldisplay, display); if (!ParseDisplay(display, tmphost, 255, &_this->m_port)) { MessageBox(hwnd, sz_F8, sz_F10, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); } else { for (size_t i = 0, len = strlen(tmphost); i < len; i++) { tmphost[i] = toupper(tmphost[i]); } _tcscpy(_this->m_host_dialog, tmphost); _this->m_pMRU->AddItem(fulldisplay); // _tcscpy(_this->m_remotehost, fulldisplay); EndDialog(hwnd, TRUE); } _tcscpy(_this->m_proxyhost, ""); GetDlgItemText(hwnd, IDC_PROXY_EDIT, display, 256); _tcscpy(fulldisplay, display); //adzm 2010-02-15 if (strlen(display) > 0) { TCHAR actualProxy[256]; strcpy(actualProxy, display); if (strncmp(tmphost, "ID", 2) == 0) { int numericId = _this->m_port; int numberOfHosts = 1; for (int i = 0; i < (int)strlen(display); i++) { if (display[i] == ';') { numberOfHosts++; } } if (numberOfHosts <= 1) { // then hostname == actualhostname } else { int modulo = numericId % numberOfHosts; char* szToken = strtok(display, ";"); while (szToken) { if (modulo == 0) { strcpy(actualProxy, szToken); break; } modulo--; szToken = strtok(NULL, ";"); } } } if (!ParseDisplay(actualProxy, tmphost, 255, &_this->m_proxyport)) { MessageBox(hwnd, sz_F8, sz_F10, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); } else { _tcscpy(_this->m_proxyhost, tmphost); EndDialog(hwnd, TRUE); } } HWND hProxy = GetDlgItem(hwnd, IDC_PROXY_CHECK); if (SendMessage(hProxy, BM_GETCHECK, 0, 0) == BST_CHECKED) { _this->m_pOpt->m_fUseProxy = true; _this->m_fUseProxy = true; } else { _this->m_pOpt->m_fUseProxy = false; _this->m_fUseProxy = false; } // sf@2002 - DSMPlugin loading // If Use plugin is checked, load the plugin if necessary HWND hPlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK); if (SendMessage(hPlugin, BM_GETCHECK, 0, 0) == BST_CHECKED) { TCHAR szPlugin[MAX_PATH]; GetDlgItemText(hwnd, IDC_PLUGINS_COMBO, szPlugin, MAX_PATH); _this->m_pOpt->m_fUseDSMPlugin = true; strcpy(_this->m_pOpt->m_szDSMPluginFilename, szPlugin); if (!_this->m_pDSMPlugin->IsLoaded()) { _this->m_pDSMPlugin->LoadPlugin(szPlugin, _this->m_pOpt->m_listening); if (_this->m_pDSMPlugin->IsLoaded()) { if (_this->m_pDSMPlugin->InitPlugin()) { if (!_this->m_pDSMPlugin->SupportsMultithreaded()) _this->m_pOpt->m_oldplugin=true; //PGM else //PGM _this->m_pOpt->m_oldplugin=false; _this->m_pDSMPlugin->SetEnabled(true); _this->m_pDSMPlugin->DescribePlugin(); } else { _this->m_pDSMPlugin->SetEnabled(false); MessageBox(hwnd, sz_F7, sz_F6, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); return TRUE; } } else { _this->m_pDSMPlugin->SetEnabled(false); MessageBox(hwnd, sz_F5, sz_F6, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); return TRUE; } } else { // sf@2003 - If the plugin is already loaded here it has been loaded // by clicking on the config button: we need to init it ! // But we must first check that the loaded plugin is the same that // the one currently selected... _this->m_pDSMPlugin->DescribePlugin(); if (_stricmp(_this->m_pDSMPlugin->GetPluginFileName(), szPlugin)) { // Unload the previous plugin _this->m_pDSMPlugin->UnloadPlugin(); // Load the new selected one _this->m_pDSMPlugin->LoadPlugin(szPlugin, _this->m_pOpt->m_listening); } if (_this->m_pDSMPlugin->IsLoaded()) { if (_this->m_pDSMPlugin->InitPlugin()) { if (!_this->m_pDSMPlugin->SupportsMultithreaded()) _this->m_pOpt->m_oldplugin=true; //PGM else //PGM _this->m_pOpt->m_oldplugin=false; _this->m_pDSMPlugin->SetEnabled(true); _this->m_pDSMPlugin->DescribePlugin(); } else { _this->m_pDSMPlugin->SetEnabled(false); MessageBox(hwnd, sz_F7, sz_F6, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); return TRUE; } } else { _this->m_pDSMPlugin->SetEnabled(false); MessageBox(hwnd, sz_F5, sz_F6, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); return TRUE; } } } else // If Use plugin unchecked but the plugin is loaded, unload it { _this->m_pOpt->m_fUseDSMPlugin = false; if (_this->m_pDSMPlugin->IsEnabled()) { _this->m_pDSMPlugin->UnloadPlugin(); _this->m_pDSMPlugin->SetEnabled(false); } } if (_this->m_fFromOptions || _this->m_fFromFile) { EndDialog(hwnd, TRUE); return TRUE; } // sf@2002 - Quick options handling _this->ManageQuickOptions(_this, hwnd); HWND hViewOnly = GetDlgItem(hwnd, IDC_VIEWONLY_CHECK); _this->m_pOpt->m_ViewOnly = (SendMessage(hViewOnly, BM_GETCHECK, 0, 0) == BST_CHECKED); HWND hAutoScaling = GetDlgItem(hwnd, IDC_AUTOSCALING_CHECK); _this->m_pOpt->m_fAutoScaling = (SendMessage(hAutoScaling, BM_GETCHECK, 0, 0) == BST_CHECKED); HWND hExitCheck = GetDlgItem(hwnd, IDC_EXIT_CHECK); //PGM @ Advantig _this->m_pOpt->m_fExitCheck = (SendMessage(hExitCheck, BM_GETCHECK, 0, 0) == BST_CHECKED); //PGM @ Advantig EndDialog(hwnd, TRUE); return TRUE; } case IDCANCEL: EndDialog(hwnd, FALSE); return TRUE; case IDC_OPTIONBUTTON: { if (!_this->m_fFromFile) { _this->ManageQuickOptions(_this, hwnd); HWND hViewOnly = GetDlgItem(hwnd, IDC_VIEWONLY_CHECK); _this->m_pOpt->m_ViewOnly = (SendMessage(hViewOnly, BM_GETCHECK, 0, 0) == BST_CHECKED); HWND hAutoScaling = GetDlgItem(hwnd, IDC_AUTOSCALING_CHECK); _this->m_pOpt->m_fAutoScaling = (SendMessage(hAutoScaling, BM_GETCHECK, 0, 0) == BST_CHECKED); HWND hExitCheck = GetDlgItem(hwnd, IDC_EXIT_CHECK); //PGM @ Advantig _this->m_pOpt->m_fExitCheck = (SendMessage(hExitCheck, BM_GETCHECK, 0, 0) == BST_CHECKED); //PGM @ Advantig } if (_this->m_pOpt->DoDialog()) { _this->m_fFromOptions = true; HWND hDyn = GetDlgItem(hwnd, IDC_DYNAMIC); SendMessage(hDyn, BM_SETCHECK, false, 0); HWND hLan = GetDlgItem(hwnd, IDC_LAN_RB); SendMessage(hLan, BM_SETCHECK, false, 0); HWND hUltraLan = GetDlgItem(hwnd, IDC_ULTRA_LAN_RB); SendMessage(hUltraLan, BM_SETCHECK, false, 0); HWND hMedium = GetDlgItem(hwnd, IDC_MEDIUM_RB); SendMessage(hMedium, BM_SETCHECK, false, 0); HWND hModem = GetDlgItem(hwnd, IDC_MODEM_RB); SendMessage(hModem, BM_SETCHECK, false, 0); HWND hSlow = GetDlgItem(hwnd, IDC_SLOW_RB); SendMessage(hSlow, BM_SETCHECK, false, 0); HWND hManual = GetDlgItem(hwnd, IDC_MANUAL); SendMessage(hManual, BM_SETCHECK, true, 0); _this->m_pOpt->m_quickoption = 8; } return TRUE; } // sf@2002 case IDC_PLUGIN_CHECK: { HWND hUse = GetDlgItem(hwnd, IDC_PLUGIN_CHECK); BOOL enable = SendMessage(hUse, BM_GETCHECK, 0, 0) == BST_CHECKED; HWND hButton = GetDlgItem(hwnd, IDC_PLUGIN_BUTTON); EnableWindow(hButton, enable); } return TRUE; case IDC_PLUGIN_BUTTON: { HWND hPlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK); if (SendMessage(hPlugin, BM_GETCHECK, 0, 0) == BST_CHECKED) { TCHAR szPlugin[MAX_PATH]; GetDlgItemText(hwnd, IDC_PLUGINS_COMBO, szPlugin, MAX_PATH); // sf@2003 - The config button can be clicked several times with // different selected plugins... bool fLoadIt = true; char szParams[64]; strcpy(szParams, sz_F4); // If a plugin is already loaded, check if it is the same that the one // we want to load. if (_this->m_pDSMPlugin->IsLoaded()) { _this->m_pDSMPlugin->DescribePlugin(); if (!_stricmp(_this->m_pDSMPlugin->GetPluginFileName(), szPlugin)) { fLoadIt = false; _this->m_pDSMPlugin->SetPluginParams(hwnd, szParams); } else { // Unload the previous plugin _this->m_pDSMPlugin->UnloadPlugin(); fLoadIt = true; } } if (!fLoadIt) return TRUE; if (_this->m_pDSMPlugin->LoadPlugin(szPlugin, _this->m_pOpt->m_listening)) { // We don't know the password yet... no matter the plugin requires // it or not, we will provide it later (at plugin "real" startup) // Knowing the environnement ("viewer") right now can be usefull or // even mandatory for the plugin (specific params saving and so on...) // The plugin receives environnement info but isn't inited at this point _this->m_pDSMPlugin->SetPluginParams(hwnd, szParams); } else { MessageBox(hwnd, sz_F1, sz_F3, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); } } return TRUE; } case IDC_LOADPROFILE_B: { TCHAR szFileName[MAX_PATH]; memset(szFileName, '\0', MAX_PATH); if (_this->m_pCC->LoadConnection(szFileName, true) != -1) { TCHAR szHost[250]; if (_this->m_pCC->m_port == 5900) _tcscpy(szHost, _this->m_pCC->m_host); else if (_this->m_pCC->m_port > 5900 && _this->m_pCC->m_port <= 5999) _stprintf(szHost, TEXT("%s:%d"), _this->m_pCC->m_host, _this->m_pCC->m_port - 5900); else _stprintf(szHost, TEXT("%s::%d"), _this->m_pCC->m_host, _this->m_pCC->m_port); SetDlgItemText(hwnd, IDC_HOSTNAME_EDIT, szHost); //AaronP HWND hPlugins = GetDlgItem(hwnd, IDC_PLUGINS_COMBO); if( strcmp( _this->m_pOpt->m_szDSMPluginFilename, "" ) != 0 && _this->m_pOpt->m_fUseDSMPlugin ) { int pos = SendMessage(hPlugins, CB_FINDSTRINGEXACT, -1, (LPARAM)&(_this->m_pOpt->m_szDSMPluginFilename[0])); if( pos != CB_ERR ) { SendMessage(hPlugins, CB_SETCURSEL, pos, 0); HWND hUsePlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK); SendMessage(hUsePlugin, BM_SETCHECK, TRUE, 0); } } //EndAaronP } SetFocus(GetDlgItem(hwnd, IDC_HOSTNAME_EDIT)); _this->SetQuickOption(_this, hwnd); HWND hViewOnly = GetDlgItem(hwnd, IDC_VIEWONLY_CHECK); SendMessage(hViewOnly, BM_SETCHECK, _this->m_pOpt->m_ViewOnly, 0); HWND hAutoScaling = GetDlgItem(hwnd, IDC_AUTOSCALING_CHECK); SendMessage(hAutoScaling, BM_SETCHECK, _this->m_pOpt->m_fAutoScaling, 0); HWND hExitCheck = GetDlgItem(hwnd, IDC_EXIT_CHECK); //PGM @ Advantig SendMessage(hExitCheck, BM_SETCHECK, _this->m_pOpt->m_fExitCheck, 0); //PGM @ Advantig _this->m_fFromOptions = true; _this->m_fFromFile = true; return TRUE; } // [v1.0.2-jp1 fix] case IDC_HOSTNAME_DEL: HWND hcombo = GetDlgItem( hwnd, IDC_HOSTNAME_EDIT); int sel = SendMessage(hcombo, CB_GETCURSEL, 0, 0); if(sel != CB_ERR){ SendMessage(hcombo, CB_DELETESTRING, sel, 0); _this->m_pMRU->RemoveItem(sel); } return TRUE; } break; case WM_CLOSE: EndDialog(hwnd, FALSE); return FALSE; case WM_DESTROY: EndDialog(hwnd, FALSE); return TRUE; } return 0; }
LONG MissypDlgProcPopUp( HWND hwnd, UINT wMsg, DWORD wParam, LONG lParam ) /*++ Routine Description: This function is the dialog process for popup messages. Arguments Return Values: TRUE - the message was handled. FALSE - the message was not handled. --*/ { HWND Button; int Index; PMISSYP_POPUP_CONTROL PopupControl; TCHAR Message[MISSYP_MAX_RESOURCE_STRING_LENGTH]; PopupControl = (PMISSYP_POPUP_CONTROL)((PVOID)lParam); switch (wMsg) { case WM_INITDIALOG: // // Retrieve and set the message // LoadString( MissyphInstance, PopupControl->MessageId, &Message[0], MISSYP_MAX_RESOURCE_STRING_LENGTH ); SetDlgItemText( hwnd, MISSYP_ID_TEXT_POPUP_MESSAGE, Message ); // // If a title id was provided, retrieve and set that too // if (PopupControl->TitleId != 0) { LoadString( MissyphInstance, PopupControl->TitleId, &Message[0], 100 ); SetWindowText( hwnd, Message ); } // // Set the cursor // Button = GetDlgItem(hwnd, IDOK); Index = (int)SendMessage(Button, CB_GETCURSEL, 0, 0); SetForegroundWindow(hwnd); ShowWindow(hwnd, SW_NORMAL); return(TRUE); case WM_SYSCOMMAND: switch (wParam & 0xfff0) { case SC_CLOSE: EndDialog(hwnd, 0); return(TRUE); } return(FALSE); case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: case IDOK: EndDialog(hwnd, 0); return(TRUE); break; default: return FALSE; } default: break; } return FALSE; }
static void Directories_OnCancel(HWND hDlg) { EndDialog(hDlg, IDCANCEL); }
LONG MissypDlgProcYesNoPopUp( HWND hwnd, UINT wMsg, DWORD wParam, LONG lParam ) /*++ Routine Description: This function is the dialog process for yes/no popup messages. Arguments lParam is really a pointer to a PopupControl structure. The Result field of this parameter will be filled in before the dialog is dismissed. Return Values: TRUE - the message was handled and YES was selected. FALSE - the message was not handled or NO was selected. --*/ { HWND Button; int Result, Index; PMISSYP_POPUP_CONTROL PopupControl; TCHAR Message[MISSYP_MAX_RESOURCE_STRING_LENGTH]; switch (wMsg) { case WM_INITDIALOG: // // This is passed in during dialog init only // PopupControl = (PMISSYP_POPUP_CONTROL)((PVOID)lParam); // // Retrieve and set the message // LoadString( MissyphInstance, PopupControl->MessageId, &Message[0], MISSYP_MAX_RESOURCE_STRING_LENGTH ); SetDlgItemText( hwnd, MISSYP_ID_TEXT_YES_NO_POPUP_MESSAGE, Message ); // // If a title id was provided, retrieve and set that too // if (PopupControl->TitleId != 0) { LoadString( MissyphInstance, PopupControl->TitleId, &Message[0], 100 ); SetWindowText( hwnd, Message ); } // // Set the cursor // Button = GetDlgItem(hwnd, MISSYP_ID_BUTTON_NO); Index = (int)SendMessage(Button, CB_GETCURSEL, 0, 0); SetForegroundWindow(hwnd); ShowWindow(hwnd, SW_NORMAL); return(TRUE); case WM_SYSCOMMAND: switch (wParam & 0xfff0) { case SC_CLOSE: EndDialog(hwnd, (int)FALSE); return(TRUE); } return(FALSE); case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: case MISSYP_ID_BUTTON_NO: Result = (int)FALSE; break; case MISSYP_ID_BUTTON_YES: Result = (int)TRUE; break; default: return(FALSE); } EndDialog(hwnd, Result); return(TRUE); default: break; } return FALSE; }
static BOOL CALLBACK DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { int wmId; //wchar_t temp[384]={0}; switch(uMsg) { case WM_PAINT: return FALSE; case WM_INITDIALOG: { EnableControls( hWnd ); // Debugging / Logging Flags: SET_CHECK(IDC_DEBUG, DebugEnabled); SET_CHECK(IDC_MSGSHOW, _MsgToConsole); SET_CHECK(IDC_MSGKEY, _MsgKeyOnOff); SET_CHECK(IDC_MSGVOICE,_MsgVoiceOff); SET_CHECK(IDC_MSGDMA, _MsgDMA); SET_CHECK(IDC_MSGADMA, _MsgAutoDMA); SET_CHECK(IDC_DBG_OVERRUNS, _MsgOverruns ); SET_CHECK(IDC_DBG_CACHE, _MsgCache ); SET_CHECK(IDC_LOGREGS, _AccessLog); SET_CHECK(IDC_LOGDMA, _DMALog); SET_CHECK(IDC_LOGWAVE, _WaveLog); SET_CHECK(IDC_DUMPCORE,_CoresDump); SET_CHECK(IDC_DUMPMEM, _MemDump); SET_CHECK(IDC_DUMPREGS,_RegDump); SET_CHECK(IDC_DEBUG_VISUAL,_visual_debug_enabled); ShowWindow( GetDlgItem( hWnd, IDC_MSG_PUBLIC_BUILD ), !IsDevBuild ); } break; case WM_COMMAND: wmId = LOWORD(wParam); // Parse the menu selections: switch (wmId) { case IDOK: WriteSettings(); EndDialog(hWnd,0); break; case IDCANCEL: EndDialog(hWnd,0); break; HANDLE_CHECKNB(IDC_MSGSHOW,_MsgToConsole); EnableMessages( hWnd ); break; HANDLE_CHECK(IDC_MSGKEY,_MsgKeyOnOff); HANDLE_CHECK(IDC_MSGVOICE,_MsgVoiceOff); HANDLE_CHECK(IDC_MSGDMA,_MsgDMA); HANDLE_CHECK(IDC_MSGADMA,_MsgAutoDMA); break; HANDLE_CHECK(IDC_DBG_OVERRUNS,_MsgOverruns); HANDLE_CHECK(IDC_DBG_CACHE,_MsgCache); HANDLE_CHECK(IDC_LOGREGS,_AccessLog); HANDLE_CHECK(IDC_LOGDMA, _DMALog); HANDLE_CHECK(IDC_LOGWAVE,_WaveLog); HANDLE_CHECK(IDC_DUMPCORE,_CoresDump); HANDLE_CHECK(IDC_DUMPMEM, _MemDump); HANDLE_CHECK(IDC_DUMPREGS,_RegDump); HANDLE_CHECK(IDC_DEBUG_VISUAL,_visual_debug_enabled); default: return FALSE; } break; default: return FALSE; } return TRUE; }
LONG MissypDlgProcHint( HWND hwnd, UINT wMsg, DWORD wParam, LONG lParam ) /*++ Routine Description: This function is the dialog process for Hint messages that have only an IDOK button. Arguments Return Values: --*/ { HWND OkButton; int Index; switch (wMsg) { case WM_INITDIALOG: // // Set the cursor // OkButton = GetDlgItem(hwnd, IDOK); Index = (int)SendMessage(OkButton, CB_GETCURSEL, 0, 0); SetForegroundWindow(hwnd); ShowWindow(hwnd, SW_NORMAL); return(TRUE); case WM_SYSCOMMAND: switch (wParam & 0xfff0) { case SC_CLOSE: EndDialog(hwnd, 0); return(TRUE); } return(FALSE); case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: case IDOK: EndDialog(hwnd, 0); return(TRUE); break; default: return FALSE; } default: break; } return FALSE; }
static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { PACMFORMATCHOOSEW afc = (PACMFORMATCHOOSEW)GetPropW(hWnd, fmt_prop); TRACE("hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam); switch (msg) { case WM_INITDIALOG: afc = (PACMFORMATCHOOSEW)lParam; SetPropW(hWnd, fmt_prop, (HANDLE)afc); MSACM_FillFormatTags(hWnd); MSACM_FillFormat(hWnd); if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP| ACMFORMATCHOOSE_STYLEF_SHOWHELP| ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE| ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE)) != 0) FIXME("Unsupported style %08x\n", afc->fdwStyle); if (!(afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP)) ShowWindow(GetDlgItem(hWnd, IDD_ACMFORMATCHOOSE_BTN_HELP), SW_HIDE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: EndDialog(hWnd, MSACM_GetWFX(hWnd, afc)); return TRUE; case IDCANCEL: EndDialog(hWnd, ACMERR_CANCELED); return TRUE; case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG: switch (HIWORD(wParam)) { case CBN_SELCHANGE: MSACM_FillFormat(hWnd); break; default: TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n", HIWORD(wParam), lParam); break; } break; case IDD_ACMFORMATCHOOSE_BTN_HELP: if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP) SendMessageW(afc->hwndOwner, RegisterWindowMessageW(ACMHELPMSGSTRINGW), 0L, 0L); break; default: TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n", LOWORD(wParam), HIWORD(wParam), lParam); break; } break; case WM_CONTEXTMENU: if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP) SendMessageW(afc->hwndOwner, RegisterWindowMessageW(ACMHELPMSGCONTEXTMENUW), wParam, lParam); break; #if defined(WM_CONTEXTHELP) case WM_CONTEXTHELP: if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP) SendMessageW(afc->hwndOwner, RegisterWindowMessageW(ACMHELPMSGCONTEXTHELPW), wParam, lParam); break; #endif default: TRACE("Dropped dlgMsg: hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam ); break; } return FALSE; }
BOOL CALLBACK vncPropertiesPoll::DialogProcPoll(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { // We use the dialog-box's USERDATA to store a _this pointer // This is set only once WM_INITDIALOG has been recieved, though! vncPropertiesPoll *_this = helper::SafeGetWindowUserData<vncPropertiesPoll>(hwnd); switch (uMsg) { case WM_INITDIALOG: { // Retrieve the Dialog box parameter and use it as a pointer // to the calling vncPropertiesPoll object helper::SafeSetWindowUserData(hwnd, lParam); _this = (vncPropertiesPoll *) lParam; _this->m_dlgvisible = TRUE; if (_this->m_fUseRegistry) { _this->Load(_this->m_usersettings); // Set the dialog box's title to indicate which Properties we're editting if (_this->m_usersettings) { SetWindowText(hwnd, sz_ID_CURRENT_USER_PROP); } else { SetWindowText(hwnd, sz_ID_DEFAULT_SYST_PROP); } } else { //LoadFromIniFile(); } // Modif sf@2002 SetDlgItemInt(hwnd, IDC_MAXCPU, _this->m_server->MaxCpu(), false); HWND hTurboMode = GetDlgItem(hwnd, IDC_TURBOMODE); SendMessage(hTurboMode, BM_SETCHECK, _this->m_server->TurboMode(), 0); // Set the polling options HWND hDriver = GetDlgItem(hwnd, IDC_DRIVER); SendMessage(hDriver, BM_SETCHECK, _this->m_server->Driver(),0); HWND hHook = GetDlgItem(hwnd, IDC_HOOK); SendMessage(hHook, BM_SETCHECK, _this->m_server->Hook(), 0); HWND hPollFullScreen = GetDlgItem(hwnd, IDC_POLL_FULLSCREEN); SendMessage(hPollFullScreen, BM_SETCHECK, _this->m_server->PollFullScreen(), 0); HWND hPollForeground = GetDlgItem(hwnd, IDC_POLL_FOREGROUND); SendMessage(hPollForeground, BM_SETCHECK, _this->m_server->PollForeground(), 0); HWND hPollUnderCursor = GetDlgItem(hwnd, IDC_POLL_UNDER_CURSOR); SendMessage(hPollUnderCursor, BM_SETCHECK, _this->m_server->PollUnderCursor(), 0); HWND hPollConsoleOnly = GetDlgItem(hwnd, IDC_CONSOLE_ONLY); SendMessage(hPollConsoleOnly, BM_SETCHECK, _this->m_server->PollConsoleOnly(), 0); EnableWindow(hPollConsoleOnly, _this->m_server->PollUnderCursor() || _this->m_server->PollForeground() ); HWND hPollOnEventOnly = GetDlgItem(hwnd, IDC_ONEVENT_ONLY); SendMessage(hPollOnEventOnly, BM_SETCHECK, _this->m_server->PollOnEventOnly(), 0); EnableWindow(hPollOnEventOnly, _this->m_server->PollUnderCursor() || _this->m_server->PollForeground() ); // [v1.0.2-jp2 fix-->] HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW); SendMessage(hSingleWindow, BM_SETCHECK, _this->m_server->SingleWindow(), 0); HWND hWindowName = GetDlgItem(hwnd, IDC_NAME_APPLI); if ( _this->m_server->GetWindowName() != NULL){ SetDlgItemText(hwnd, IDC_NAME_APPLI,_this->m_server->GetWindowName()); } EnableWindow(hWindowName, _this->m_server->SingleWindow()); // [<--v1.0.2-jp2 fix] SetForegroundWindow(hwnd); return FALSE; // Because we've set the focus } case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case IDC_APPLY: { int maxcpu = GetDlgItemInt(hwnd, IDC_MAXCPU, NULL, FALSE); _this->m_server->MaxCpu(maxcpu); // Modif sf@2002 HWND hTurboMode = GetDlgItem(hwnd, IDC_TURBOMODE); _this->m_server->TurboMode(SendMessage(hTurboMode, BM_GETCHECK, 0, 0) == BST_CHECKED); // Handle the polling stuff HWND hDriver = GetDlgItem(hwnd, IDC_DRIVER); bool result=(SendMessage(hDriver, BM_GETCHECK, 0, 0) == BST_CHECKED); if (result) { _this->m_server->Driver(CheckVideoDriver(0)); } else _this->m_server->Driver(false); HWND hHook = GetDlgItem(hwnd, IDC_HOOK); _this->m_server->Hook( SendMessage(hHook, BM_GETCHECK, 0, 0) == BST_CHECKED ); HWND hPollFullScreen = GetDlgItem(hwnd, IDC_POLL_FULLSCREEN); _this->m_server->PollFullScreen( SendMessage(hPollFullScreen, BM_GETCHECK, 0, 0) == BST_CHECKED ); HWND hPollForeground = GetDlgItem(hwnd, IDC_POLL_FOREGROUND); _this->m_server->PollForeground( SendMessage(hPollForeground, BM_GETCHECK, 0, 0) == BST_CHECKED ); HWND hPollUnderCursor = GetDlgItem(hwnd, IDC_POLL_UNDER_CURSOR); _this->m_server->PollUnderCursor( SendMessage(hPollUnderCursor, BM_GETCHECK, 0, 0) == BST_CHECKED ); HWND hPollConsoleOnly = GetDlgItem(hwnd, IDC_CONSOLE_ONLY); _this->m_server->PollConsoleOnly( SendMessage(hPollConsoleOnly, BM_GETCHECK, 0, 0) == BST_CHECKED ); HWND hPollOnEventOnly = GetDlgItem(hwnd, IDC_ONEVENT_ONLY); _this->m_server->PollOnEventOnly( SendMessage(hPollOnEventOnly, BM_GETCHECK, 0, 0) == BST_CHECKED ); // [v1.0.2-jp2 fix-->] Move to vncpropertiesPoll.cpp HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW); _this->m_server->SingleWindow(SendMessage(hSingleWindow, BM_GETCHECK, 0, 0) == BST_CHECKED); char szName[32]; if (GetDlgItemText(hwnd, IDC_NAME_APPLI, (LPSTR) szName, 32) == 0){ vnclog.Print(LL_INTINFO,VNCLOG("Error while reading Window Name %d \n"), GetLastError()); } else{ _this->m_server->SetSingleWindowName(szName); } // [<--v1.0.2-jp2 fix] Move to vncpropertiesPoll.cpp // Save the settings if (_this->m_fUseRegistry) _this->Save(); else _this->SaveToIniFile(); // Was ok pressed? if (LOWORD(wParam) == IDOK) { // Yes, so close the dialog vnclog.Print(LL_INTINFO, VNCLOG("enddialog (OK)\n")); _this->m_returncode_valid = TRUE; EndDialog(hwnd, IDOK); _this->m_dlgvisible = FALSE; } _this->m_server->SetHookings(); return TRUE; } // [v1.0.2-jp2 fix-->] Move to vncpropertiesPoll.cpp case IDC_SINGLE_WINDOW: { HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW); BOOL fSingleWindow = (SendMessage(hSingleWindow, BM_GETCHECK,0, 0) == BST_CHECKED); HWND hWindowName = GetDlgItem(hwnd, IDC_NAME_APPLI); EnableWindow(hWindowName, fSingleWindow); } return TRUE; // [<--v1.0.2-jp2 fix] Move to vncpropertiesPoll.cpp case IDCANCEL: vnclog.Print(LL_INTINFO, VNCLOG("enddialog (CANCEL)\n")); _this->m_returncode_valid = TRUE; EndDialog(hwnd, IDCANCEL); _this->m_dlgvisible = FALSE; return TRUE; case IDC_POLL_FOREGROUND: case IDC_POLL_UNDER_CURSOR: // User has clicked on one of the polling mode buttons // affected by the pollconsole and pollonevent options { // Get the poll-mode buttons HWND hPollForeground = GetDlgItem(hwnd, IDC_POLL_FOREGROUND); HWND hPollUnderCursor = GetDlgItem(hwnd, IDC_POLL_UNDER_CURSOR); // Determine whether to enable the modifier options BOOL enabled = (SendMessage(hPollForeground, BM_GETCHECK, 0, 0) == BST_CHECKED) || (SendMessage(hPollUnderCursor, BM_GETCHECK, 0, 0) == BST_CHECKED); HWND hPollConsoleOnly = GetDlgItem(hwnd, IDC_CONSOLE_ONLY); EnableWindow(hPollConsoleOnly, enabled); HWND hPollOnEventOnly = GetDlgItem(hwnd, IDC_ONEVENT_ONLY); EnableWindow(hPollOnEventOnly, enabled); } return TRUE; case IDC_CHECKDRIVER: { CheckVideoDriver(1); } return TRUE; } break; } return 0; }
void WarningDlg::OnBnClickedAccepct() { EndDialog(0); }
/** \brief Fecha esta janela com a opção OK \param void \return void */ void CIdentificacaoDlg::OnOK() { EndDialog(IDOK); }
BOOL CALLBACK TextChat::TextChatDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { TextChat* _this = (TextChat *) GetWindowLong(hWnd, GWL_USERDATA); switch (uMsg) { case WM_INITDIALOG: { SetWindowLong(hWnd, GWL_USERDATA, lParam); TextChat *_this = (TextChat *) lParam; if (_this->m_szLocalText == NULL || _this->m_szRemoteText == NULL) EndDialog(hWnd, FALSE); // Window always on top if Fullscreen On if (_this->m_pCC->InFullScreenMode()) { RECT Rect; GetWindowRect(hWnd, &Rect); SetWindowPos(hWnd, HWND_TOPMOST, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, SWP_SHOWWINDOW); } // CentreWindow(hWnd); _this->m_hWnd = hWnd; _this->m_hDlg = hWnd; if (_snprintf(_this->m_szRemoteName,MAXNAMESIZE-1,"%s", _this->m_pCC->m_desktopName) < 0 ) { _this->m_szRemoteName[MAXNAMESIZE-4]='.'; _this->m_szRemoteName[MAXNAMESIZE-3]='.'; _this->m_szRemoteName[MAXNAMESIZE-2]='.'; _this->m_szRemoteName[MAXNAMESIZE-1]=0x00; } const long lTitleBufSize=256; char szTitle[lTitleBufSize]; _snprintf(szTitle,lTitleBufSize-1," Chat with <%s> - Ultr@VNC",_this->m_szRemoteName); SetWindowText(hWnd, szTitle); // Trunc the remote name for display in Chat Area before the first parenthesis, if any. char *p = strchr(_this->m_szRemoteName, '('); if (p != NULL) *(p - 1) = '\0'; // Chat area _this->SetTextFormat(); // Set character formatting and background color SendDlgItemMessage( hWnd, IDC_CHATAREA_EDIT, EM_SETBKGNDCOLOR, FALSE, 0xFFFFFF ); memset(_this->m_szLocalText, 0, TEXTMAXSIZE); // if (!_this->m_fPersistentTexts) { memset(_this->m_szLastLocalText, 0, TEXTMAXSIZE); memset(_this->m_szTextBoxBuffer, 0, TEXTMAXSIZE); // Clear Chat area // Load and display diclaimer message // sf@2005 - Only if the DSMplugin is used if (!_this->m_pCC->m_fUsePlugin) { if (LoadString(_this->m_pApp->m_instance, IDS_WARNING, _this->m_szRemoteText, TEXTMAXSIZE -1) ) _this->PrintMessage(_this->m_szRemoteText, NULL ,GREY); } } SetDlgItemText(hWnd, IDC_INPUTAREA_EDIT, _this->m_szLocalText); SetDlgItemText(hWnd, IDC_CHATAREA_EDIT, _this->m_szTextBoxBuffer); // Chat area // Scroll down the chat window // The following seems necessary under W9x & Me if we want the Edit to scroll to bottom... SCROLLINFO si; ZeroMemory(&si, sizeof(SCROLLINFO)); si.cbSize = sizeof(SCROLLINFO); si.fMask = SIF_RANGE|SIF_PAGE; GetScrollInfo(GetDlgItem(hWnd, IDC_CHATAREA_EDIT), SB_VERT, &si); si.nPos = si.nMax - max(si.nPage - 1, 0); SendDlgItemMessage(hWnd, IDC_CHATAREA_EDIT, WM_VSCROLL, MAKELONG(SB_THUMBPOSITION, si.nPos), 0L); // This line does the bottom scrolling correctly under NT4,W2K, XP... // SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT, WM_VSCROLL, SB_BOTTOM, 0L); // SendDlgItemMessage(hWnd, IDC_PERSISTENT_CHECK, BM_SETCHECK, _this->m_fPersistentTexts, 0); // Tell the other side to open the TextChat Window _this->SendTextChatRequest(CHAT_OPEN); SetForegroundWindow(hWnd); return TRUE; } // break; case WM_COMMAND: switch (LOWORD(wParam)) { /* case IDC_PERSISTENT_CHECK: _this->m_fPersistentTexts = (SendDlgItemMessage(hWnd, IDC_PERSISTENT_CHECK, BM_GETCHECK, 0, 0) == BST_CHECKED); return TRUE; */ case IDOK: // Server orders to close TextChat EndDialog(hWnd, FALSE); return TRUE; case IDCANCEL: _this->SendTextChatRequest(CHAT_CLOSE); // Server must close TextChat EndDialog(hWnd, FALSE); return TRUE; case IDC_SEND_B: { memset(_this->m_szLocalText,0,TEXTMAXSIZE); UINT nRes = GetDlgItemText( hWnd, IDC_INPUTAREA_EDIT, _this->m_szLocalText, TEXTMAXSIZE-1); strcat(_this->m_szLocalText, "\n"); _this->SendLocalText(); SetFocus(GetDlgItem(hWnd, IDC_INPUTAREA_EDIT)); } return TRUE; case IDC_HIDE_B: _this->ShowChatWindow(false); return TRUE; case IDC_INPUTAREA_EDIT: if(HIWORD(wParam) == EN_UPDATE) { memset(_this->m_szLocalText,0,TEXTMAXSIZE); UINT nRes = GetDlgItemText( hWnd, IDC_INPUTAREA_EDIT, _this->m_szLocalText, TEXTMAXSIZE); if (strstr(_this->m_szLocalText,"\n") >0 ) { _this->SendLocalText(); } } return TRUE; } break; case WM_SYSCOMMAND: switch (LOWORD(wParam)) { case SC_RESTORE: _this->ShowChatWindow(true); //SetFocus(GetDlgItem(hWnd, IDC_INPUTAREA_EDIT)); return TRUE; } break; case WM_DESTROY: // _this->SendTextChatRequest(_this, CHAT_FINISHED); EndDialog(hWnd, FALSE); return TRUE; } return 0; }
void UninstallOld::OnCancel() { EndDialog(IDCANCEL); }