static void MakeControls(int boxes, char **labels, DWORD fixedFontMask) { int i; HDC hdc = GetDC(SimpleDialog); SelectObject(hdc, MyNiceFont); SIZE si; int maxLen = 0; for(i = 0; i < boxes; i++) { GetTextExtentPoint32(hdc, labels[i], strlen(labels[i]), &si); if(si.cx > maxLen) maxLen = si.cx; } int adj; if(maxLen > 70) { adj = maxLen - 70; } else { adj = 0; } for(i = 0; i < boxes; i++) { GetTextExtentPoint32(hdc, labels[i], strlen(labels[i]), &si); Labels[i] = CreateWindowEx(0, WC_STATIC, labels[i], WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, (80 + adj) - si.cx - 4, 13 + i*30, si.cx, 21, SimpleDialog, NULL, Instance, NULL); NiceFont(Labels[i]); Textboxes[i] = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 80 + adj, 12 + 30*i, 120 - adj, 21, SimpleDialog, NULL, Instance, NULL); if(fixedFontMask & (1 << i)) { FixedFont(Textboxes[i]); } else { NiceFont(Textboxes[i]); } } ReleaseDC(SimpleDialog, hdc); OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, 218, 11, 70, 23, SimpleDialog, NULL, Instance, NULL); NiceFont(OkButton); CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 218, 41, 70, 23, SimpleDialog, NULL, Instance, NULL); NiceFont(CancelButton); }
static void MakeControls(RECT r) { CommentTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN, 7, 10, r.right-137, 38, CommentDialog, NULL, Instance, NULL); FixedFont(CommentTextbox); OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, r.right-120, 6, 70, 23, CommentDialog, NULL, Instance, NULL); NiceFont(OkButton); CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, r.right-120, 36, 70, 23, CommentDialog, NULL, Instance, NULL); NiceFont(CancelButton); }
//----------------------------------------------------------------------------- // Make the controls that are guaranteed not to move around as the count/ // as string settings change. This is different for the piecewise linear, // because in that case we should not provide a checkbox to change whether // the table is edited as a string or table. //----------------------------------------------------------------------------- static void MakeFixedControls(BOOL forPwl) { Labels[0] = CreateWindowEx(0, WC_STATIC, _("Destination:"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 0, 10, 78, 21, LutDialog, NULL, Instance, NULL); NiceFont(Labels[0]); DestTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 85, 10, 120, 21, LutDialog, NULL, Instance, NULL); FixedFont(DestTextbox); Labels[1] = CreateWindowEx(0, WC_STATIC, _("Index:"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 10, 40, 68, 21, LutDialog, NULL, Instance, NULL); NiceFont(Labels[1]); IndexTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 85, 40, 120, 21, LutDialog, NULL, Instance, NULL); FixedFont(IndexTextbox); Labels[2] = CreateWindowEx(0,WC_STATIC, forPwl ? _("Points:") : _("Count:"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 0, 70, 78, 21, LutDialog, NULL, Instance, NULL); NiceFont(Labels[2]); CountTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 85, 70, 120, 21, LutDialog, NULL, Instance, NULL); NiceFont(CountTextbox); if(!forPwl) { AsStringCheckbox = CreateWindowEx(0, WC_BUTTON, _("Edit table of ASCII values like a string"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_AUTOCHECKBOX, 10, 100, 300, 21, LutDialog, NULL, Instance, NULL); NiceFont(AsStringCheckbox); } OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, 231, 10, 70, 23, LutDialog, NULL, Instance, NULL); NiceFont(OkButton); CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 231, 40, 70, 23, LutDialog, NULL, Instance, NULL); NiceFont(CancelButton); PrevDestProc = SetWindowLongPtr(DestTextbox, GWLP_WNDPROC, (LONG_PTR)MyNameProc); PrevIndexProc = SetWindowLongPtr(IndexTextbox, GWLP_WNDPROC, (LONG_PTR)MyNameProc); PrevCountProc = SetWindowLongPtr(CountTextbox, GWLP_WNDPROC, (LONG_PTR)MyDigitsProc); }
static void MakeControls(void) { HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Assign:"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, 6, 1, 80, 17, IoDialog, NULL, Instance, NULL); NiceFont(textLabel); PinList = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTBOX, "", WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | WS_VSCROLL | LBS_NOTIFY, 6, 18, 95, 320, IoDialog, NULL, Instance, NULL); FixedFont(PinList); OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, 6, 325, 95, 23, IoDialog, NULL, Instance, NULL); NiceFont(OkButton); CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 6, 356, 95, 23, IoDialog, NULL, Instance, NULL); NiceFont(CancelButton); }
//----------------------------------------------------------------------------- // Make the controls that hold the LUT. The exact configuration of the dialog // will depend on (a) whether the user chose table-type or string-type entry, // and for table-type entry, on (b) the number of entries, and on (c) // whether we are editing a PWL table (list of points) or a straight LUT. //----------------------------------------------------------------------------- static void MakeLutControls(BOOL asString, int count, BOOL forPwl) { // Remember these, so that we know from where to cache stuff if we have // to destroy these textboxes and make something new later. WasAsString = asString; WasCount = count; if(forPwl && asString) oops(); if(asString) { char str[3*MAX_LOOK_UP_TABLE_LEN+1]; int i, j; j = 0; for(i = 0; i < count; i++) { int c = ValuesCache[i]; if(c >= 32 && c <= 127 && c != '\\') { str[j++] = c; } else if(c == '\\') { str[j++] = '\\'; str[j++] = '\\'; } else if(c == '\r') { str[j++] = '\\'; str[j++] = 'r'; } else if(c == '\b') { str[j++] = '\\'; str[j++] = 'b'; } else if(c == '\f') { str[j++] = '\\'; str[j++] = 'f'; } else if(c == '\n') { str[j++] = '\\'; str[j++] = 'n'; } else { str[j++] = 'X'; } } str[j++] = '\0'; StringTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, str, WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 10, 130, 294, 21, LutDialog, NULL, Instance, NULL); FixedFont(StringTextbox); SendMessage(CountTextbox, EM_SETREADONLY, (WPARAM)TRUE, 0); MoveWindow(LutDialog, 100, 30, 320, 185, TRUE); } else { int i; int base; if(forPwl) { base = 100; } else { base = 140; } for(i = 0; i < count; i++) { int x, y; if(i < 16) { x = 10; y = base+30*i; } else { x = 160; y = base+30*(i-16); } char buf[20]; sprintf(buf, "%d", ValuesCache[i]); ValuesTextbox[i] = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, buf, WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, x+30, y, 80, 21, LutDialog, NULL, Instance, NULL); NiceFont(ValuesTextbox[i]); if(forPwl) { sprintf(buf, "%c%d:", (i & 1) ? 'y' : 'x', i/2); } else { sprintf(buf, "%2d:", i); } ValuesLabel[i] = CreateWindowEx(0, WC_STATIC, buf, WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, x, y+3, 100, 21, LutDialog, NULL, Instance, NULL); FixedFont(ValuesLabel[i]); PrevValuesProc[i] = SetWindowLongPtr(ValuesTextbox[i], GWLP_WNDPROC, (LONG_PTR)MyNumberProc); } if(count > 16) count = 16; SendMessage(CountTextbox, EM_SETREADONLY, (WPARAM)FALSE, 0); MoveWindow(LutDialog, 100, 30, 320, base + 30 + count*30, TRUE); } }
static void MakeControls(void) { HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Cycle Time (ms):"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 5, 13, 145, 21, ConfDialog, NULL, Instance, NULL); NiceFont(textLabel); CycleTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 155, 12, 85, 21, ConfDialog, NULL, Instance, NULL); NiceFont(CycleTextbox); HWND textLabel2 = CreateWindowEx(0, WC_STATIC, _("Crystal Frequency (MHz):"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 0, 43, 150, 21, ConfDialog, NULL, Instance, NULL); NiceFont(textLabel2); CrystalTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 155, 42, 85, 21, ConfDialog, NULL, Instance, NULL); NiceFont(CrystalTextbox); HWND textLabel3 = CreateWindowEx(0, WC_STATIC, _("UART Baud Rate (bps):"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 5, 73, 145, 21, ConfDialog, NULL, Instance, NULL); NiceFont(textLabel3); BaudTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 155, 72, 85, 21, ConfDialog, NULL, Instance, NULL); NiceFont(BaudTextbox); if(!UartFunctionUsed()) { EnableWindow(BaudTextbox, FALSE); EnableWindow(textLabel3, FALSE); } if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || Prog.mcu->whichIsa == ISA_INTERPRETED)) { EnableWindow(CrystalTextbox, FALSE); EnableWindow(textLabel2, FALSE); } OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, 258, 11, 70, 23, ConfDialog, NULL, Instance, NULL); NiceFont(OkButton); CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 258, 41, 70, 23, ConfDialog, NULL, Instance, NULL); NiceFont(CancelButton); char explanation[1024] = ""; if(UartFunctionUsed()) { if(Prog.mcu && Prog.mcu->uartNeeds.rxPin != 0) { sprintf(explanation, _("Serial (UART) will use pins %d and %d.\r\n\r\n"), Prog.mcu->uartNeeds.rxPin, Prog.mcu->uartNeeds.txPin); } else { strcpy(explanation, _("Please select a micro with a UART.\r\n\r\n")); } } else { strcpy(explanation, _("No serial instructions (UART Send/UART Receive) " "are in use; add one to program before setting baud rate.\r\n\r\n") ); } strcat(explanation, _("The cycle time for the 'PLC' runtime generated by LDmicro is user-" "configurable. Very short cycle times may not be achievable due " "to processor speed constraints, and very long cycle times may not " "be achievable due to hardware overflows. Cycle times between 10 ms " "and 100 ms will usually be practical.\r\n\r\n" "The compiler must know what speed crystal you are using with the " "micro to convert between timing in clock cycles and timing in " "seconds. A 4 MHz to 20 MHz crystal is typical; check the speed " "grade of the part you are using to determine the maximum allowable " "clock speed before choosing a crystal.")); HWND textLabel4 = CreateWindowEx(0, WC_STATIC, explanation, WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, 11, 104, 310, 400, ConfDialog, NULL, Instance, NULL); NiceFont(textLabel4); // Measure the explanation string, so that we know how to size our window RECT tr, cr; HDC hdc = CreateCompatibleDC(NULL); SelectObject(hdc, MyNiceFont); SetRect(&tr, 0, 0, 310, 400); DrawText(hdc, explanation, -1, &tr, DT_CALCRECT | DT_LEFT | DT_TOP | DT_WORDBREAK); DeleteDC(hdc); int h = 104 + tr.bottom + 10; SetWindowPos(ConfDialog, NULL, 0, 0, 344, h, SWP_NOMOVE); // h is the desired client height, but SetWindowPos includes title bar; // so fix it up by hand GetClientRect(ConfDialog, &cr); int nh = h + (h - (cr.bottom - cr.top)); SetWindowPos(ConfDialog, NULL, 0, 0, 344, nh, SWP_NOMOVE); PrevCycleProc = SetWindowLongPtr(CycleTextbox, GWLP_WNDPROC, (LONG_PTR)MyNumberProc); PrevCrystalProc = SetWindowLongPtr(CrystalTextbox, GWLP_WNDPROC, (LONG_PTR)MyNumberProc); PrevBaudProc = SetWindowLongPtr(BaudTextbox, GWLP_WNDPROC, (LONG_PTR)MyNumberProc); }
static void MakeControls(void) { HWND grouper = CreateWindowEx(0, WC_BUTTON, _("Type"), WS_CHILD | BS_GROUPBOX | WS_VISIBLE | WS_TABSTOP, 7, 3, 120, 125, CoilDialog, NULL, Instance, NULL); NiceFont(grouper); NormalRadio = CreateWindowEx(0, WC_BUTTON, _("( ) Normal"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE | WS_GROUP, 16, 21, 100, 20, CoilDialog, NULL, Instance, NULL); NiceFont(NormalRadio); NegatedRadio = CreateWindowEx(0, WC_BUTTON, _("(/) Negated"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 41, 100, 20, CoilDialog, NULL, Instance, NULL); NiceFont(NegatedRadio); SetOnlyRadio = CreateWindowEx(0, WC_BUTTON, _("(S) Set-Only"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 61, 100, 20, CoilDialog, NULL, Instance, NULL); NiceFont(SetOnlyRadio); ResetOnlyRadio = CreateWindowEx(0, WC_BUTTON, _("(R) Reset-Only"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 81, 105, 20, CoilDialog, NULL, Instance, NULL); NiceFont(ResetOnlyRadio); TtriggerRadio = CreateWindowEx(0, WC_BUTTON, _("(T) T-trigger"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 101, 105, 20, CoilDialog, NULL, Instance, NULL); NiceFont(TtriggerRadio); HWND grouper2 = CreateWindowEx(0, WC_BUTTON, _("Source"), WS_CHILD | BS_GROUPBOX | WS_VISIBLE, 135, 3, 150, 85, CoilDialog, NULL, Instance, NULL); NiceFont(grouper2); SourceInternalRelayRadio = CreateWindowEx(0, WC_BUTTON, _("Internal Relay"), WS_CHILD | BS_AUTORADIOBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 144, 21, 125, 20, CoilDialog, NULL, Instance, NULL); NiceFont(SourceInternalRelayRadio); SourceMcuPinRadio = CreateWindowEx(0, WC_BUTTON, _("Output Pin on MCU"), WS_CHILD | BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP, 144, 41, 125, 20, CoilDialog, NULL, Instance, NULL); NiceFont(SourceMcuPinRadio); SourceModbusRadio = CreateWindowEx(0, WC_BUTTON, _("Modbus"), WS_CHILD | BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP, 144, 61, 125, 20, CoilDialog, NULL, Instance, NULL); NiceFont(SourceModbusRadio); HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Name:"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 135, 90, 50, 21, CoilDialog, NULL, Instance, NULL); NiceFont(textLabel); NameTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 190, 90, 175, 21, CoilDialog, NULL, Instance, NULL); FixedFont(NameTextbox); OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, 295, 10, 70, 23, CoilDialog, NULL, Instance, NULL); NiceFont(OkButton); CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 295, 40, 70, 23, CoilDialog, NULL, Instance, NULL); NiceFont(CancelButton); PrevNameProc = SetWindowLongPtr(NameTextbox, GWLP_WNDPROC, (LONG_PTR)MyNameProc); }
static void MakeControls(void) { HWND grouper = CreateWindowEx(0, WC_BUTTON, _("Source"), WS_CHILD | BS_GROUPBOX | WS_VISIBLE, 7, 3, 140, 125, ContactsDialog, NULL, Instance, NULL); NiceFont(grouper); SourceInternalRelayRadio = CreateWindowEx(0, WC_BUTTON, _("Internal Relay"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 21, 125, 20, ContactsDialog, NULL, Instance, NULL); NiceFont(SourceInternalRelayRadio); SourceInputPinRadio = CreateWindowEx(0, WC_BUTTON, _("Input Pin on MCU"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 41, 125, 20, ContactsDialog, NULL, Instance, NULL); NiceFont(SourceInputPinRadio); SourceOutputPinRadio = CreateWindowEx(0, WC_BUTTON, _("Output Pin on MCU"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 61, 125, 20, ContactsDialog, NULL, Instance, NULL); NiceFont(SourceOutputPinRadio); SourceModbusContactRadio = CreateWindowEx(0, WC_BUTTON, _("Modbus Contact"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 81, 125, 20, ContactsDialog, NULL, Instance, NULL); NiceFont(SourceModbusContactRadio); SourceModbusCoilRadio = CreateWindowEx(0, WC_BUTTON, _("Modbus Coil"), WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE, 16, 101, 125, 20, ContactsDialog, NULL, Instance, NULL); NiceFont(SourceModbusCoilRadio); HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Name:"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, 145, 16, 50, 21, ContactsDialog, NULL, Instance, NULL); NiceFont(textLabel); NameTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 200, 16, 115, 21, ContactsDialog, NULL, Instance, NULL); FixedFont(NameTextbox); NegatedCheckbox = CreateWindowEx(0, WC_BUTTON, _("|/| Negated"), WS_CHILD | BS_AUTOCHECKBOX | WS_TABSTOP | WS_VISIBLE, 155, 44, 160, 20, ContactsDialog, NULL, Instance, NULL); NiceFont(NegatedCheckbox); Set1Checkbox = CreateWindowEx(0, WC_BUTTON, _("Set HI input level before simulation"), WS_CHILD | BS_AUTOCHECKBOX | WS_TABSTOP | WS_VISIBLE, 155, 72, 260, 20, ContactsDialog, NULL, Instance, NULL); NiceFont(Set1Checkbox); OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, 325, 10, 70, 23, ContactsDialog, NULL, Instance, NULL); NiceFont(OkButton); CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, 325, 40, 70, 23, ContactsDialog, NULL, Instance, NULL); NiceFont(CancelButton); PrevNameProc = SetWindowLongPtr(NameTextbox, GWLP_WNDPROC, (LONG_PTR)MyNameProc); }