int WatchIconProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2) { int rtn; switch (msg) { case CREATE_WINDOW: rtn = DefaultWndProc(wnd, msg, p1, p2); SendMessage(wnd, CAPTURE_MOUSE, 0, 0); SendMessage(wnd, HIDE_MOUSE, 0, 0); SendMessage(wnd, CAPTURE_KEYBOARD, 0, 0); return rtn; case PAINT: SetStandardColor(wnd); writeline(wnd, " À ", 1, 1, FALSE); return TRUE; case BORDER: rtn = DefaultWndProc(wnd, msg, p1, p2); writeline(wnd, "Í", 2, 0, FALSE); return rtn; case MOUSE_MOVED: SendMessage(wnd, HIDE_WINDOW, 0, 0); SendMessage(wnd, MOVE, p1, p2); SendMessage(wnd, SHOW_WINDOW, 0, 0); return TRUE; case CLOSE_WINDOW: SendMessage(wnd, RELEASE_MOUSE, 0, 0); SendMessage(wnd, RELEASE_KEYBOARD, 0, 0); SendMessage(wnd, SHOW_MOUSE, 0, 0); break; default: break; } return DefaultWndProc(wnd, msg, p1, p2); }
static int AsciitabProc(WINDOW wnd,MESSAGE msg, PARAM p1,PARAM p2) { switch (msg) { case CREATE_WINDOW: DefaultWndProc(wnd, msg, p1, p2); CreateWindowMsg(wnd); return TRUE; case KEYBOARD: if (KeyboardMsg(wnd, p1)) return TRUE; break; case PAINT: DefaultWndProc(wnd, msg, p1, p2); DisplayAsciitab(wnd); return TRUE; case COMMAND: if ((int)p1 == ID_HELP) { DisplayHelp(wnd, "ASCII Table"); return TRUE; } break; case CLOSE_WINDOW: ATwnd = NULL; break; default: break; } return DefaultWndProc(wnd, msg, p1, p2); }
static int LogProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2) { WINDOW cwnd = ControlWindow(&Log, ID_LOGLIST); char **mn = message; switch (msg) { case INITIATE_DIALOG: AddAttribute(cwnd, MULTILINE | VSCROLLBAR); while (*mn) { SendMessage(cwnd, ADDTEXT, (PARAM) (*mn), 0); mn++; } SendMessage(cwnd, SHOW_WINDOW, 0, 0); break; case COMMAND: if ((int) p1 == ID_OK) { int item; int tl = GetTextLines(cwnd); for (item = 0; item < tl; item++) if (ItemSelected(cwnd, item)) mn[item][0] = LISTSELECTOR; } break; default: break; } return DefaultWndProc(wnd, msg, p1, p2); }
int WatchIconProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2) { int rtn, i; static int tick = 0; static char *hands[] = { " À ", " Ú ", " ¿ ", " Ù " }; switch (msg) { case CREATE_WINDOW: tick = 0; rtn = DefaultWndProc(wnd, msg, p1, p2); SendMessage(wnd, CAPTURE_MOUSE, 0, 0); SendMessage(wnd, HIDE_MOUSE, 0, 0); SendMessage(wnd, CAPTURE_KEYBOARD, 0, 0); SendMessage(wnd, CAPTURE_CLOCK, 0, 0); return rtn; case CLOCKTICK: ++tick; tick &= 3; SendMessage(wnd->PrevClock, msg, p1, p2); /* (fall through and paint) */ case PAINT: SetStandardColor(wnd); writeline(wnd, hands[tick], 1, 1, FALSE); return TRUE; case BORDER: rtn = DefaultWndProc(wnd, msg, p1, p2); writeline(wnd, "Í", 2, 0, FALSE); return rtn; case MOUSE_MOVED: SendMessage(wnd, HIDE_WINDOW, 0, 0); SendMessage(wnd, MOVE, p1, p2); SendMessage(wnd, SHOW_WINDOW, 0, 0); return TRUE; case CLOSE_WINDOW: SendMessage(wnd, RELEASE_CLOCK, 0, 0); SendMessage(wnd, RELEASE_MOUSE, 0, 0); SendMessage(wnd, RELEASE_KEYBOARD, 0, 0); SendMessage(wnd, SHOW_MOUSE, 0, 0); break; default: break; } return DefaultWndProc(wnd, msg, p1, p2); }
int InputBoxProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2) { int rtn; switch (msg) { case CREATE_WINDOW: rtn = DefaultWndProc(wnd, msg, p1, p2); SendMessage(ControlWindow(&InputBoxDB,ID_INPUTTEXT), SETTEXTLENGTH, TextLength, 0); SendMessage(ControlWindow(&InputBoxDB,ID_INPUTTEXT), ADDTEXT, (PARAM) InputText, 0); return rtn; case COMMAND: if ((int) p1 == ID_OK && (int) p2 == 0) GetItemText(wnd, ID_INPUTTEXT, InputText, TextLength); break; default: break; } return DefaultWndProc(wnd, msg, p1, p2); }
bool MainDlg::HandleSysCommand( UINT uCmdType, POINTS pt ) { BOOL bZoomed = ::IsZoomed(m_hWnd); LRESULT lRes = DefaultWndProc(WM_SYSCOMMAND, uCmdType, MAKELPARAM(pt.x, pt.y)); if (::IsZoomed(m_hWnd) != bZoomed) { JuiControl *pMaxCtrl = FindControl("max"); JuiControl *pRestoreCtrl = FindControl("restore"); if(bZoomed) { pRestoreCtrl->SetVisible(false); pMaxCtrl->SetVisible(true); } else { pMaxCtrl->SetVisible(false); pRestoreCtrl->SetVisible(true); } } return true; }
int SystemMenuProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2) { int mx, my; WINDOW wnd1; switch (msg) { case CREATE_WINDOW: wnd->holdmenu = ActiveMenuBar; ActiveMenuBar = &SystemMenu; SystemMenu.PullDown[0].Selection = 0; break; case LEFT_BUTTON: wnd1 = GetParent(wnd); mx = (int) p1 - GetLeft(wnd1); my = (int) p2 - GetTop(wnd1); if (HitControlBox(wnd1, mx, my)) return TRUE; break; case LB_CHOOSE: PostMessage(wnd, CLOSE_WINDOW, 0, 0); break; case DOUBLE_CLICK: if (p2 == GetTop(GetParent(wnd))) { PostMessage(GetParent(wnd), msg, p1, p2); SendMessage(wnd, CLOSE_WINDOW, TRUE, 0); } return TRUE; case SHIFT_CHANGED: return TRUE; case CLOSE_WINDOW: ActiveMenuBar = wnd->holdmenu; break; default: break; } return DefaultWndProc(wnd, msg, p1, p2); }
/* * Process dialog box messages */ static int DlgFnOpen(WINDOW wnd,MESSAGE msg,PARAM p1,PARAM p2) { switch (msg) { case CREATE_WINDOW: { int rtn = DefaultWndProc(wnd, msg, p1, p2); DBOX *db = wnd->extension; WINDOW cwnd = ControlWindow(db, ID_FILENAME); SendMessage(cwnd, SETTEXTLENGTH, 64, 0); return rtn; } case INITIATE_DIALOG: InitDlgBox(wnd); break; case COMMAND: switch ((int) p1) { case ID_OK: { if ((int)p2 == 0) { char fn[MAXPATH+1]; char nm[MAXFILE]; char ext[MAXEXT]; GetItemText(wnd, ID_FILENAME, fn, MAXPATH); fnsplit(fn, NULL, NULL, nm, ext); strcpy(FileName, nm); strcat(FileName, ext); CreatePath(NULL, fn, FALSE, TRUE); if (IncompleteFilename(FileName)) { /* --- no file name yet --- */ DBOX *db = wnd->extension; WINDOW cwnd = ControlWindow(db, ID_FILENAME); strcpy(FileSpec, FileName); strcpy(SrchSpec, FileName); InitDlgBox(wnd); SendMessage(cwnd, SETFOCUS, TRUE, 0); return TRUE; } } break; } case ID_FILES: switch ((int) p2) { case ENTERFOCUS: case LB_SELECTION: /* selected a different filename */ GetDlgListText(wnd, FileName, ID_FILES); PutItemText(wnd, ID_FILENAME, FileName); break; case LB_CHOOSE: /* chose a file name */ GetDlgListText(wnd, FileName, ID_FILES); SendMessage(wnd, COMMAND, ID_OK, 0); break; default: break; } return TRUE; case ID_DIRECTORY: switch ((int) p2) { case ENTERFOCUS: PutItemText(wnd, ID_FILENAME, FileSpec); break; case LB_CHOOSE: { /* chose dir */ char dd[15]; GetDlgListText(wnd, dd, ID_DIRECTORY); chdir(dd); InitDlgBox(wnd); SendMessage(wnd, COMMAND, ID_OK, 0); break; } default: break; } return TRUE; case ID_DRIVE: switch ((int) p2) { case ENTERFOCUS: PutItemText(wnd, ID_FILENAME, FileSpec); break; case LB_CHOOSE: { /* chose dir */ char dr[15]; GetDlgListText(wnd, dr, ID_DRIVE); setdisk(*dr - 'A'); InitDlgBox(wnd); SendMessage(wnd, COMMAND, ID_OK, 0); } default: break; } return TRUE; default: break; } default: break; } return DefaultWndProc(wnd, msg, p1, p2); }