// // Copyright (c) 2013 _iTo_ // #include #include "iTerm.h" extern TCHAR ipAdressString[32]; INT_PTR CALLBACK ipAdressProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { RECT pRect,rect; UNREFERENCED_PARAMETER(lParam); switch (message){ case WM_INITDIALOG: wsprintf(ipAdressString,"%s","192.168.1.1"); SetDlgItemText(hDlg, IDC_EDIT1,(LPTSTR)ipAdressString); wsprintf(ipPortString,"%s","23"); SetDlgItemText(hDlg, IDC_EDIT2,(LPTSTR)ipPortString); GetWindowRect(GetParent(hDlg) , (LPRECT)&pRect); // メインウインドの表示位置取得 GetClientRect(GetParent(hDlg) , &rect); // 〃 のウインドサイズ取得 SetWindowPos(hDlg, NULL, pRect.left+(rect.right/2)-100, pRect.top+(rect.bottom/2)-30, 0, 0, SWP_NOSIZE|SWP_NOZORDER); return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK){ GetDlgItemText(hDlg, IDC_EDIT1,(LPTSTR)ipAdressString, (int)sizeof(ipAdressString)); GetDlgItemText(hDlg, IDC_EDIT2,(LPTSTR)ipPortString, (int)sizeof(ipPortString)); EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; case WM_CLOSE: EndDialog(hDlg, LOWORD(wParam)); break; } return (INT_PTR)FALSE; } INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { RECT pRect,rect; UNREFERENCED_PARAMETER(lParam); switch (message){ case WM_INITDIALOG: GetWindowRect(GetParent(hDlg) , (LPRECT)&pRect); // メインウインドの表示位置取得 GetClientRect(GetParent(hDlg) , &rect); // 〃 のウインドサイズ取得 SetWindowPos(hDlg, NULL, pRect.left+(rect.right/2)-100, pRect.top+(rect.bottom/2)-30, 0, 0, SWP_NOSIZE|SWP_NOZORDER); return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL){ EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; }