/* create_directx_window: * Creates the Allegro window. */ static HWND create_directx_window(void) { static int first = 1; WNDCLASS wnd_class; char fname[1024]; HWND wnd; if (first) { /* setup the window class */ wnd_class.style = CS_HREDRAW | CS_VREDRAW; wnd_class.lpfnWndProc = directx_wnd_proc; wnd_class.cbClsExtra = 0; wnd_class.cbWndExtra = 0; wnd_class.hInstance = allegro_inst; wnd_class.hIcon = LoadIcon(allegro_inst, "allegro_icon"); if (!wnd_class.hIcon) wnd_class.hIcon = LoadIcon(NULL, IDI_APPLICATION); wnd_class.hCursor = LoadCursor(NULL, IDC_ARROW); wnd_class.hbrBackground = NULL; wnd_class.lpszMenuName = NULL; wnd_class.lpszClassName = ALLEGRO_WND_CLASS; RegisterClass(&wnd_class); /* what are we called? */ get_executable_name(fname, sizeof(fname)); ustrlwr(fname); usetc(get_extension(fname), 0); if (ugetat(fname, -1) == '.') usetat(fname, -1, 0); do_uconvert(get_filename(fname), U_CURRENT, wnd_title, U_ASCII, WND_TITLE_SIZE); first = 0; } /* create the window now */ wnd = CreateWindowEx(WS_EX_APPWINDOW, ALLEGRO_WND_CLASS, wnd_title, WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX, -100, -100, 0, 0, NULL, NULL, allegro_inst, NULL); if (!wnd) { _TRACE(PREFIX_E "CreateWindowEx() failed (%s)\n", win_err_str(GetLastError())); return NULL; } ShowWindow(wnd, SW_SHOWNORMAL); SetForegroundWindow(wnd); UpdateWindow(wnd); return wnd; }
int d_seltext_proc(int msg, DIALOG *d, int c) { int acolor = makecol(0,255,0); int icolor = makecol(0,100,0); int ret = D_O_K; if (msg != MSG_DRAW) ret = d_radio_proc(msg, d, c); // if (msg == MSG_GOTFOCUS) // { // ret = d_radio_proc(MSG_KEY, d, c); // } switch (msg) { case MSG_START: d->w = text_length(fnt_andrus_4, ((char *)d->dp)); d->h = text_height(fnt_andrus_4); break; case MSG_DRAW: if (d->flags & D_SELECTED) { char *t = strdup((char *)d->dp); dialog_textout(ustrupr(t),d->x, d->y , acolor); free(t); } else { char *t = strdup((char *)d->dp); dialog_textout(ustrlwr(t),d->x, d->y , icolor); free(t); } break; } return ret; }