BOOL CALLBACK TableMakerAdvProperties::DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { TableMakerAdvProperties* pctav = (TableMakerAdvProperties*)GetWindowLong(hwnd, GWL_USERDATA); switch(message) { case WM_INITDIALOG: { SetWindowLong(hwnd, GWL_USERDATA, (LONG)lParam); LocalizeWindow(hwnd); PostMessage(hwnd, UM_INITDLGVALUES, 0, 0); return FALSE; } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: VERIFY(yog_enddialog( hwnd, 0)); break; case IDOK: pctav->FillStructure(); VERIFY(yog_enddialog(hwnd, 1)); break; case IDC_TABCHARSET: if((HIWORD(wParam))== CBN_SELENDOK) { pctav->HandleTabCharset(hwnd); } } break; case UM_INITDLGVALUES: { pctav->m_hwnd = hwnd; pctav->InitDlgValues(); pctav->FillInitialData(); } break; } return 0; }
LRESULT CALLBACK BlobMgmt::TextProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { BlobMgmt *pib = (BlobMgmt*)GetWindowLongPtr(hwnd, GWLP_USERDATA); //FindReplace DialogBox functions if(message == (wyUInt32)pGlobals->m_pcmainwin->m_findmsg) { if(pib->m_findreplace->FindReplace(hwnd, lParam) == wyFalse) { //when we are closing the find dialog, deleting the memory allocated for Find delete(pib->m_findreplace); pib->m_findreplace = NULL; } return 0; } switch(message) { case WM_KEYDOWN: { wyInt32 ctl = GetKeyState(VK_CONTROL) & 0x8000; wyInt32 key = LOWORD(wParam); if(ctl && (key == 'a' || key == 'A' )) { SendMessage(hwnd, EM_SETSEL, 0, -1); } //To implement Find DialogBox else if(ctl && (key == 'f' || key == 'F' )) { pib->FindOrReplace(pib->m_hwndedit, wyFalse); } //To implement Replace DialogBox else if(ctl && (key == 'h' || key == 'H' )) { pib->FindOrReplace(pib->m_hwndedit, wyTrue); } else if(key == VK_F3) { pib->OnAccelFindNext(hwnd); } else if(key == VK_ESCAPE) { if(pib->ProcessCancel() == wyTrue) { VERIFY(yog_enddialog( pib->m_hwnddlg, 0)); } return 0; } } break; case WM_NCDESTROY: return 0; } return CallWindowProc(pib->m_wporigtextproc, hwnd, message, wParam, lParam); }
void BlobMgmt::OnDlgProcWmCommand(WPARAM wparam, LPARAM lparam) { switch(LOWORD(wparam)) { case IDCANCEL: if(ProcessCancel() == wyTrue) VERIFY(yog_enddialog(m_hwnddlg, 0)); break; case IDOK: if(ProcessOK() == wyTrue) VERIFY(yog_enddialog(m_hwnddlg, 1)); else VERIFY(yog_enddialog(m_hwnddlg, 0)); break; case IDC_SAVETOFILE: SaveToFile(); break; case IDC_IMPORT: OpenFromFile(); break; case IDC_SETNULL: { // if a user has selected it then we disable evrything // otherwise enable everything if(Button_GetCheck((HWND)lparam)== BST_CHECKED) DisableAll(wyTrue); else DisableAll(wyFalse); } break; case IDC_COMBO: { if((HIWORD(wparam))== CBN_SELENDOK) OnComboChange(); break; } } return; }
void CImportError::OnWMCommand(HWND hwnd, WPARAM wParam) { switch LOWORD(wParam) { case IDC_OPENFILE: ShellExecute(NULL, L"open", L"notepad", m_errfile, NULL, SW_SHOWNORMAL); break; case IDCANCEL: case IDOK: yog_enddialog(hwnd, 1); break; } }
void ConnectionCommunity::OnAboutWmCommand(HWND hwnd, WPARAM wparam) { switch(LOWORD(wparam)) { case IDCANCEL: case IDOK: VERIFY(yog_enddialog(hwnd, 1)); break; } //If click on url if((HIWORD(wparam) == STN_CLICKED)&&(LOWORD(wparam) == IDC_LINK)) ShellExecute(NULL, L"open", TEXT(HOMEURL_ABOUTUS), NULL, NULL, SW_SHOWNORMAL); return; }
void ImportBatch::OnWMCommand(HWND hwnd, WPARAM wParam) { switch LOWORD(wParam) { case IDC_EXPFILESELECT: SetExpFileName(); break; case IDOK: ImportDump(); break; case IDDONE: case IDCANCEL: yog_enddialog(hwnd, 0); break; } }
void ConnectionCommunity::OnWmCommandConnDialog(HWND hwnd, WPARAM wparam, LPARAM lparam, ConnectionInfo * dbname) { wyInt32 id; if(HIWORD(wparam) == EN_UPDATE) { id = LOWORD(wparam); if(id != IDC_DLGCONNECT_PASSWORD || (id == IDC_DLGCONNECT_PASSWORD && Button_GetCheck(GetDlgItem(hwnd, IDC_DLGCONNECT_STOREPASSWORD))== BST_CHECKED)) { EnableWindow(GetDlgItem(hwnd, IDC_SAVE), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_CLONECONN), FALSE); m_conndetaildirty = wyTrue; return; } } //handle connection name combobox /*else if(LOWORD(wparam) == IDC_DESC) { //if different connection is selected, then save the previous one if((HIWORD(wparam)== CBN_DROPDOWN) && (m_conndetaildirty == wyTrue)) { PostMessage(hwnd, SHOW_CONFIRM, 0, 0); m_conndetaildirty = wyFalse; } else if((HIWORD(wparam) == CBN_CLOSEUP) || (HIWORD(wparam) == CBN_SELENDOK)) { if((m_conndetaildirty == wyTrue) && (m_isnewconnection == wyTrue)) { SendMessage(GetDlgItem(hwnd, IDC_DESC), CB_DELETESTRING, m_newconnid, 0); m_conndetaildirty = wyFalse; m_isnewconnection = wyFalse; m_newconnid = -1; } //if connection is selected using keyboard or mouse, display the contents GetInitialDetails(hwnd); /* we have to change the tab selection to server also */ /*TabCtrl_SetCurSel(GetDlgItem(hwnd, IDC_CONNTAB), 0); ShowServerOptions(hwnd); m_conndetaildirty = wyFalse; return; } else if((HIWORD(wparam)== CBN_SELCHANGE)) { SetFocus(GetDlgItem(hwnd, IDC_DESC)); } }*/ //handle connection color combobox else if(LOWORD(wparam)== IDC_COLORCOMBO||LOWORD(wparam)== IDC_COLORCOMBO3) { if((HIWORD(wparam) == CBN_DROPDOWN) || (HIWORD(wparam)== CBN_SELCHANGE)) { //Command handler for color combo box OnWmCommandColorCombo(hwnd, wparam, lparam); dbname->m_rgbconn = m_rgbconnection; dbname->m_rgbfgconn = m_rgbconnectionfg; m_rgbobbkcolor = m_rgbconnection; m_rgbobfgcolor = m_rgbconnectionfg; //if color is changed in combo, then set m_conndetaildirty to true if((HIWORD(wparam)== CBN_SELCHANGE) && (m_conndetaildirty == wyFalse)) { if(m_changeobcolor == wyFalse) m_conndetaildirty = wyFalse; else m_conndetaildirty = wyTrue; } } if(m_conndetaildirty == wyTrue) { EnableWindow(GetDlgItem(hwnd, IDC_SAVE), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_CLONECONN), FALSE); dbname->m_rgbconn = m_rgbconnection; dbname->m_rgbfgconn = m_rgbconnectionfg; m_rgbobbkcolor = m_rgbconnection; m_rgbobfgcolor = m_rgbconnectionfg; } return; } //Handles the common option in 'MySQL' tab HandleCommonConnectOptions(hwnd, dbname, LOWORD(wparam)); switch(LOWORD(wparam)) { case IDOK: OnConnect(hwnd, dbname); break; case IDCANCEL: yog_enddialog(hwnd, 0); break; case IDC_DELETE: DeleteConnDetail(hwnd); break; case IDC_NEW: if(m_conndetaildirty == wyTrue) { PostMessage(hwnd, SHOW_CONFIRM, 0, 0); } m_conndetaildirty = wyFalse; NewConnection(hwnd); break; case IDC_SAVE: SaveConnection(hwnd); m_conndetaildirty = wyFalse; EnableWindow(GetDlgItem(hwnd, IDC_SAVE), FALSE); //EnableWindow(GetDlgItem(hwnd, IDC_CLONECONN), TRUE); break; case IDC_TESTCONN: OnTestConnection(hwnd); break; case IDC_CLONECONN: CloneConnection(hwnd); break; case IDC_TUNNELHELP: ShowHelp("http://sqlyogkb.webyog.com/article/155-connecting-using-http-tunneling"); break; case IDC_INITCOMMANDHELP: ShowHelp("http://sqlyogkb.webyog.com/article/158-advanced-connection-settings"); break; case IDC_SSHHELP: ShowHelp("http://sqlyogkb.webyog.com/article/154-connecting-using-ssh-tunneling"); break; case IDC_SSLHELP: ShowHelp("http://sqlyogkb.webyog.com/article/157-connecting-using-ssl-encryption"); break; case IDC_TIMEOUTHELP: case IDC_COMPRESSHELP: ShowHelp("http://sqlyogkb.webyog.com/article/153-direct-connection-using-mysql-c-api"); break; } }
void ConnectionCommunity::OnConnect(HWND hwnd, ConnectionInfo * dbname) { Tunnel *tunnel; MYSQL *mysql; HWND lastfocus = GetFocus(); wyString conn, temp, dirnamestr; wyWChar directory[MAX_PATH + 1] = {0}, *lpfileport = 0, pass[MAX_PATH + 1] = {0}; HWND hwndcombo; wyInt32 count, storepwd, ret; // DEBUG_ENTER("clicked ok"); tunnel = CreateTunnel(wyFalse); // DEBUG_LOG("created tunnel"); // Call ConnectToMySQL function to initialize a new mySQL structure and connect to // mySQL server with the connection details. The function will return a valid mysql // pointer if connection successful and if not then it will return NULL. // If null then show the standard mySQL errors given by the mySQL API. /* set correct values for tunnel to use HTTP authentication */ dbname->m_tunnel = tunnel; mysql = ConnectToMySQL(hwnd, dbname); if(mysql == NULL) { delete tunnel; SetFocus(lastfocus); } else if(dbname->m_db.GetLength() ==0 ||(IsDatabaseValid(dbname->m_db, mysql, tunnel) == wyTrue)) { // Successful so write the current details in connection .ini file // so that when the user uses the software again it will show the same details. dbname->m_mysql = mysql; dbname->m_tunnel = tunnel; WriteConnDetails(hwnd); ret = SearchFilePath(L"sqlyog", L".ini", MAX_PATH, directory, &lpfileport); if(ret == 0) { yog_enddialog(hwnd, (wyInt32)1); return; } /* if the user has changed any information then we ask him whether he wants to save */ if(m_conndetaildirty == wyTrue) { if(ConfirmAndSaveConnection(hwnd, wyTrue) == wyFalse) return; } else { /* even if he has not selected to save, we need to check for password thing as the user might diable on the store_password first and then make modification to the password, in that case the state will not be dirty and the value will not be stored */ VERIFY(hwndcombo = GetDlgItem(hwnd, IDC_DESC)); count = SendMessage(hwndcombo, CB_GETCOUNT, 0, 0); if(!count) { yog_enddialog(hwnd,(wyInt32)1); return; } VERIFY ((count = SendMessage(hwndcombo, CB_GETCURSEL, 0, 0))!= CB_ERR); count = SendMessage(hwndcombo, CB_GETITEMDATA, count, 0); conn.Sprintf("Connection %u", count); storepwd = Button_GetCheck(GetDlgItem(hwnd, IDC_DLGCONNECT_STOREPASSWORD)); /* now we only save the password if the user has asked for otherwise we remove it only */ /* feature implemented in v5.0 */ dirnamestr.SetAs(directory); //WritePrivateProfileStringA(conn.GetString(), "Password01", NULL, dirnamestr.GetString()); wyIni::IniDeleteKey(conn.GetString(), "Password01", dirnamestr.GetString()); if(!storepwd) { //WritePrivateProfileStringA(conn.GetString(), "Password", NULL, dirnamestr.GetString()); wyIni::IniDeleteKey(conn.GetString(), "Password", dirnamestr.GetString()); } else { GetWindowText(GetDlgItem(hwnd, IDC_DLGCONNECT_PASSWORD), pass, MAX_PATH); temp.SetAs(pass); EncodePassword(temp); wyIni::IniWriteString(conn.GetString(), "Password", temp.GetString(), dirnamestr.GetString()); } /* write the store password value too */ temp.Sprintf("%d", storepwd); ret = wyIni::IniWriteString (conn.GetString(), "StorePassword", temp.GetString(), dirnamestr.GetString()); } m_rgbobbkcolor = m_rgbconnection; m_rgbobfgcolor = m_rgbconnectionfg; yog_enddialog(hwnd,(wyInt32)1); } else { ShowMySQLError(hwnd, tunnel, &mysql, NULL, wyTrue); //fix a bug, database neme was erasing on error //SendMessage(GetDlgItem(hwnd, IDC_DLGCONNECT_DATABASE), WM_SETTEXT, 0,(LPARAM)L""); SetFocus(GetDlgItem(hwnd,IDC_DLGCONNECT_DATABASE)); return; } }