BOOL TAbsenceDlg::EvCreate(LPARAM lParam) { SetDlgIcon(hWnd); if (rect.left == CW_USEDEFAULT) { DWORD val = GetMessagePos(); POINTS pos = MAKEPOINTS(val); GetWindowRect(&rect); int cx = ::GetSystemMetrics(SM_CXFULLSCREEN), cy = ::GetSystemMetrics(SM_CYFULLSCREEN); int xsize = rect.right - rect.left, ysize = rect.bottom - rect.top; int x = pos.x - xsize / 2, y = pos.y - ysize; if (x + xsize > cx) x = cx - xsize; if (y + ysize > cy) y = cy - ysize; MoveWindow(x > 0 ? x : 0, y > 0 ? y : 0, xsize, ysize, FALSE); } else MoveWindow(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, FALSE); typedef char MaxBuf[MAX_PATH_U8]; typedef char MaxHead[MAX_NAMEBUF]; tmpAbsenceStr = new MaxBuf[cfg->AbsenceMax]; tmpAbsenceHead = new MaxHead[cfg->AbsenceMax]; SetData(); return TRUE; }
BOOL THistDlg::EvCreate(LPARAM lParam) { SetDlgIcon(hWnd); SetDlgItem(HISTORY_LIST, XY_FIT); SetDlgItem(IDOK, HMID_FIT); SetDlgItem(CLEAR_BUTTON, LEFT_FIT); SetDlgItem(OPENED_CHECK, RIGHT_FIT); if (rect.left == CW_USEDEFAULT) { GetWindowRect(&rect); orgRect = rect; int xsize = rect.right - rect.left + cfg->HistXdiff; int ysize = rect.bottom - rect.top + cfg->HistYdiff; int cx = ::GetSystemMetrics(SM_CXFULLSCREEN), cy = ::GetSystemMetrics(SM_CYFULLSCREEN); int x = (cx - xsize)/2; int y = (cy - ysize)/2; MoveWindow((x < 0) ? 0 : x % (cx - xsize), (y < 0) ? 0 : y % (cy - ysize), xsize, ysize, FALSE); } else { MoveWindow(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, FALSE); } FitDlgItems(); CheckDlgButton(OPENED_CHECK, openedMode); SetTitle(); return TRUE; }
/* Window 生成時の CallBack */ BOOL TAboutDlg::EvCreate(LPARAM lParam) { SetDlgIcon(hWnd); char buf[512], buf2[512]; GetDlgItemTextU8(ABOUT_TEXT, buf, sizeof(buf)); wsprintf(buf2, buf, GetVersionStr()); SetDlgItemTextU8(ABOUT_TEXT, buf2); if (rect.left == CW_USEDEFAULT) { GetWindowRect(&rect); int xsize = rect.right - rect.left, ysize = rect.bottom - rect.top; int cx = ::GetSystemMetrics(SM_CXFULLSCREEN), cy = ::GetSystemMetrics(SM_CYFULLSCREEN); int x = (cx - xsize)/2; int y = (cy - ysize)/2; MoveWindow((x < 0) ? 0 : x % (cx - xsize), (y < 0) ? 0 : y % (cy - ysize), xsize, ysize, FALSE); } else MoveWindow(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, FALSE); return TRUE; }
BOOL TSetupSheet::EvCreate(LPARAM lParam) { SetData(); RECT rc; POINT pt; ::GetWindowRect(parent->GetDlgItem(SETUP_LIST), &rc); pt.x = rc.right; pt.y = rc.top; ScreenToClient(parent->hWnd, &pt); SetWindowPos(0, pt.x + 10, pt.y - 10, 0, 0, SWP_NOSIZE|SWP_NOZORDER); SetWindowLong(GWL_EXSTYLE, GetWindowLong(GWL_EXSTYLE)|WS_EX_CONTROLPARENT); SetDlgIcon(hWnd); return TRUE; }
/* Window 生成時の CallBack。Screenの中心を起点として、すでに開いている TMsgDlgの枚数 * Caption Sizeを ずらして表示 */ BOOL TMsgDlg::EvCreate(LPARAM lParam) { SetDlgIcon(hWnd); if (rect.left == CW_USEDEFAULT) { GetWindowRect(&rect); int xsize = rect.right - rect.left, ysize = rect.bottom - rect.top; int cx = ::GetSystemMetrics(SM_CXFULLSCREEN), cy = ::GetSystemMetrics(SM_CYFULLSCREEN); int x = (cx - xsize)/2 + createCnt * ::GetSystemMetrics(SM_CYCAPTION); int y = (cy - ysize)/2 + createCnt * ::GetSystemMetrics(SM_CYCAPTION); MoveWindow((x < 0) ? 0 : x % (cx - xsize), (y < 0) ? 0 : y % (cy - ysize), xsize, ysize, FALSE); } createCnt++; return TRUE; }
BOOL TSetupSheet::GetData() { char buf[MAX_PATH_U8]; int i; if (resId == SETUP_SHEET1) { BOOL need_broadcast = FALSE; GetDlgItemTextU8(NICKNAME_EDIT, buf, MAX_NAMEBUF); if (strcmp(cfg->NickNameStr, buf)) { need_broadcast = TRUE; strcpy(cfg->NickNameStr, buf); } GetDlgItemTextU8(GROUP_COMBO, buf, MAX_NAMEBUF); if (strcmp(cfg->GroupNameStr, buf)) { need_broadcast = TRUE; strcpy(cfg->GroupNameStr, buf); } if (need_broadcast) { ::PostMessage(GetMainWnd(), WM_IPMSG_BRNOTIFY, 0, IPMSG_DEFAULT_PORT); } if (SendDlgItemMessage(CLIPMODE_CHECK, BM_GETCHECK, 0, 0)) { cfg->ClipMode |= CLIP_ENABLE; } else { cfg->ClipMode &= ~CLIP_ENABLE; } if (SendDlgItemMessage(CLIPCONFIRM_CHECK, BM_GETCHECK, 0, 0)) { cfg->ClipMode |= CLIP_CONFIRM; } else { cfg->ClipMode &= ~CLIP_CONFIRM; } cfg->brList.Reset(); for (i=0; SendDlgItemMessage(BROADCAST_LIST, LB_GETTEXT, i, (LPARAM)buf) != LB_ERR; i++) cfg->brList.SetHostRaw(buf, ResolveAddr(buf)); cfg->DialUpCheck = (int)SendDlgItemMessage(DIALUP_CHECK, BM_GETCHECK, 0, 0); } else if (resId == SETUP_SHEET2) { cfg->BalloonNotify = (int)SendDlgItemMessage(BALLOONNOTIFY_CHECK, BM_GETCHECK, 0, 0); cfg->OpenCheck = (int)SendDlgItemMessage(OPEN_COMBO, CB_GETCURSEL, 0, 0); // cfg->OpenCheck = (int)SendDlgItemMessage(OPEN_CHECK, BM_GETCHECK, 0, 0); GetDlgItemTextU8(QUOTE_EDIT, cfg->QuoteStr, sizeof(cfg->QuoteStr)); cfg->HotKeyCheck = (int)SendDlgItemMessage(HOTKEY_CHECK, BM_GETCHECK, 0, 0); cfg->AbnormalButton = (int)SendDlgItemMessage(ABNORMALBTN_CHECK, BM_GETCHECK, 0, 0); if (::IsWindowEnabled(GetDlgItem(LCID_CHECK))) { cfg->lcid = IsDlgButtonChecked(LCID_CHECK) ? 0x409 : -1; } cfg->ExtendBroadcast = (int)SendDlgItemMessage(EXTBROADCAST_COMBO, CB_GETCURSEL, 0, 0); GetDlgItemTextU8(MAINICON_EDIT, cfg->IconFile, sizeof(cfg->IconFile)); GetDlgItemTextU8(REVICON_EDIT, cfg->RevIconFile, sizeof(cfg->RevIconFile)); ::SendMessage(GetMainWnd(), WM_IPMSG_INITICON, 0, 0); SetDlgIcon(hWnd); SetHotKey(cfg); } else if (resId == SETUP_SHEET3) { cfg->QuoteCheck = (int)SendDlgItemMessage(QUOTE_CHECK, BM_GETCHECK, 0, 0); cfg->SecretCheck = (int)SendDlgItemMessage(SECRET_CHECK, BM_GETCHECK, 0, 0); cfg->OneClickPopup = (int)SendDlgItemMessage(ONECLICK_CHECK, BM_GETCHECK, 0, 0); GetDlgItemTextU8(LRUUSER_EDIT, buf, sizeof(buf)); cfg->lruUserMax = atoi(buf); // ControlIME ... 0:off, 1:senddlg on (finddlg:off), 2:always on cfg->ControlIME = (int)SendDlgItemMessage(CONTROLIME_CHECK, BM_GETCHECK, 0, 0); if (cfg->ControlIME && SendDlgItemMessage(FINDDLGIME_CHECK, BM_GETCHECK, 0, 0) == 0) { cfg->ControlIME = 2; } cfg->NoPopupCheck = (int)SendDlgItemMessage(NOPOPUP_CHECK, BM_GETCHECK, 0, 0); cfg->NoBeep = (int)SendDlgItemMessage(NOBEEP_CHECK, BM_GETCHECK, 0, 0); cfg->AbsenceNonPopup = (int)SendDlgItemMessage(ABSENCENONPOPUP_CHECK, BM_GETCHECK, 0, 0); cfg->RecvLogonDisp = (int)SendDlgItemMessage(RECVLOGON_CHECK, BM_GETCHECK, 0, 0); cfg->RecvIPAddr = (int)SendDlgItemMessage(RECVIPADDR_CHECK, BM_GETCHECK, 0, 0); cfg->NoErase = (int)SendDlgItemMessage(NOERASE_CHECK, BM_GETCHECK, 0, 0); GetDlgItemTextU8(SOUND_EDIT, cfg->SoundFile, sizeof(cfg->SoundFile)); } else if (resId == SETUP_SHEET4) { cfg->LogCheck = (int)SendDlgItemMessage(LOG_CHECK, BM_GETCHECK, 0, 0); cfg->LogonLog = (int)SendDlgItemMessage(LOGONLOG_CHECK, BM_GETCHECK, 0, 0); cfg->IPAddrCheck = (int)SendDlgItemMessage(IPADDR_CHECK, BM_GETCHECK, 0, 0); if (SendDlgItemMessage(IMAGESAVE_CHECK, BM_GETCHECK, 0, 0)) { cfg->ClipMode |= 2; } else { cfg->ClipMode &= ~2; } cfg->LogUTF8 = (int)SendDlgItemMessage(LOGUTF8_CHECK, BM_GETCHECK, 0, 0); cfg->PasswdLogCheck = (int)SendDlgItemMessage(PASSWDLOG_CHECK, BM_GETCHECK, 0, 0); GetDlgItemTextU8(LOG_EDIT, cfg->LogFile, sizeof(cfg->LogFile)); if (cfg->LogCheck) LogMng::StrictLogFile(cfg->LogFile); } else if (resId == SETUP_SHEET5) { char buf[MAX_NAMEBUF]; GetDlgItemTextU8(OLDPASSWORD_EDIT, buf, sizeof(buf)); if (CheckPassword(cfg->PasswordStr, buf)) { GetDlgItemTextU8(NEWPASSWORD_EDIT, buf, sizeof(buf)); MakePassword(buf, cfg->PasswordStr); } } else if (resId == SETUP_SHEET6) { cfg->DefaultUrl = (int)SendDlgItemMessage(DEFAULTURL_CHECK, BM_GETCHECK, 0, 0); for (UrlObj *tmp_obj = (UrlObj *)tmpUrlList.TopObj(); tmp_obj; tmp_obj = (UrlObj *)tmpUrlList.NextObj(tmp_obj)) { UrlObj *obj = SearchUrlObj(&cfg->urlList, tmp_obj->protocol); if (!obj) { obj = new UrlObj; cfg->urlList.AddObj(obj); strcpy(obj->protocol, tmp_obj->protocol); } strcpy(obj->program, tmp_obj->program); } cfg->ShellExec = (int)SendDlgItemMessage(SHELLEXEC_CHECK, BM_GETCHECK, 0, 0); } return TRUE; }
BOOL TRecvDlg::EvCreate(LPARAM lParam) { editSub.AttachWnd(GetDlgItem(RECV_EDIT)); editSub.SendMessage(EM_AUTOURLDETECT, 1, 0); editSub.SendMessage(EM_SETBKGNDCOLOR, FALSE, ::GetSysColor(COLOR_3DFACE)); editSub.SendMessage(EM_SETTARGETDEVICE, 0, 0); // 折り返し SetDlgIcon(hWnd); SetDlgItemTextU8(RECV_HEAD, head); if (msg.command & IPMSG_BROADCASTOPT) SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_BROADCAST)); else if (msg.command & IPMSG_MULTICASTOPT) SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_MULTICAST)); else SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_UNICAST)); if (msg.command & IPMSG_AUTORETOPT) SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_UNIABSENCE)); char buf[MAX_LISTBUF]; if (msg.command & IPMSG_ENCRYPTOPT) { GetWindowText(buf, sizeof(buf)); strcat(buf, (cryptCapa & IPMSG_BLOWFISH_128) ? " +" : " -"); SetWindowText(buf); } wsprintf(head, "at %s", Ctime(&recvTime)); SetDlgItemTextU8(RECV_HEAD2, head); editSub.ExSetText(msg.msgBuf); if (msg.command & IPMSG_SECRETOPT) editSub.ShowWindow(SW_HIDE), ::ShowWindow(GetDlgItem(QUOTE_CHECK), SW_HIDE); else { ::ShowWindow(GetDlgItem(OPEN_BUTTON), SW_HIDE), openFlg = TRUE; if (shareInfo) SetFileButton(this, FILE_BUTTON, shareInfo); } if (msg.command & IPMSG_FILEATTACHOPT) { GetDlgItemTextU8(OPEN_BUTTON, buf, sizeof(buf)); strcat(buf, " "); strcat(buf, GetLoadStrU8(IDS_FILEATTACH)); SetDlgItemTextU8(OPEN_BUTTON, buf); } if (msg.command & IPMSG_PASSWORDOPT) { GetDlgItemTextU8(OPEN_BUTTON, buf, sizeof(buf)); strcat(buf, GetLoadStrU8(IDS_KEYOPEN)); SetDlgItemTextU8(OPEN_BUTTON, buf); } if (cfg->QuoteCheck) SendDlgItemMessage(QUOTE_CHECK, BM_SETCHECK, cfg->QuoteCheck, 0); if (cfg->AbnormalButton) SetDlgItemTextU8(IDOK, GetLoadStrU8(IDS_INTERCEPT)); SetFont(); SetSize(); HMENU hMenu = ::GetSystemMenu(hWnd, FALSE); AppendMenuU8(hMenu, MF_SEPARATOR, NULL, NULL); SetMainMenu(hMenu); if (IsNewShell() != TRUE) { ULONG style = GetWindowLong(GWL_STYLE); style &= 0xffffff0f; style |= 0x00000080; SetWindowLong(GWL_STYLE, style); } SetForegroundWindow(); if (msg.command & IPMSG_NOADDLISTOPT) ::EnableWindow(GetDlgItem(IDOK), FALSE); EvSize(SIZE_RESTORED, 0, 0); return TRUE; }