Window::Window() : handle(0) { create_window_class(); handle = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, TEXT("WindowClass"), TEXT("My Window"), WS_OVERLAPPEDWINDOW|WS_VISIBLE, 0, 0, 1024, 768, 0, 0, GetModuleHandle(0), this); if (handle == 0) throw Exception("Failed to create window"); }
void winoutput_init(running_machine &machine) { int result; // ensure we get cleaned up machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winoutput_exit), &machine)); // reset globals clientlist = NULL; // create our window class result = create_window_class(); assert(result == 0); (void)result; // to silence gcc 4.6 // create a window output_hwnd = CreateWindowEx( WINDOW_STYLE_EX, OUTPUT_WINDOW_CLASS, OUTPUT_WINDOW_NAME, WINDOW_STYLE, 0, 0, 1, 1, NULL, NULL, GetModuleHandle(NULL), NULL); assert(output_hwnd != NULL); // set a pointer to the running machine SetWindowLongPtr(output_hwnd, GWLP_USERDATA, (LONG_PTR)&machine); // allocate message ids om_mame_start = RegisterWindowMessage(OM_MAME_START); assert(om_mame_start != 0); om_mame_stop = RegisterWindowMessage(OM_MAME_STOP); assert(om_mame_stop != 0); om_mame_update_state = RegisterWindowMessage(OM_MAME_UPDATE_STATE); assert(om_mame_update_state != 0); om_mame_register_client = RegisterWindowMessage(OM_MAME_REGISTER_CLIENT); assert(om_mame_register_client != 0); om_mame_unregister_client = RegisterWindowMessage(OM_MAME_UNREGISTER_CLIENT); assert(om_mame_unregister_client != 0); om_mame_get_id_string = RegisterWindowMessage(OM_MAME_GET_ID_STRING); assert(om_mame_get_id_string != 0); // broadcast a startup message PostMessage(HWND_BROADCAST, om_mame_start, (WPARAM)output_hwnd, 0); // register a notifier for output changes output_set_notifier(NULL, notifier_callback, NULL); }
bool windows_osd_interface::output_init() { int result; // reset globals clientlist = nullptr; // create our window class result = create_window_class(); assert(result == 0); (void)result; // to silence gcc 4.6 // create a window output_hwnd = CreateWindowEx( WINDOW_STYLE_EX, OUTPUT_WINDOW_CLASS, OUTPUT_WINDOW_NAME, WINDOW_STYLE, 0, 0, 1, 1, nullptr, nullptr, GetModuleHandleUni(), nullptr); assert(output_hwnd != nullptr); // set a pointer to the running machine SetWindowLongPtr(output_hwnd, GWLP_USERDATA, (LONG_PTR)&machine()); // allocate message ids om_mame_start = RegisterWindowMessage(OM_MAME_START); assert(om_mame_start != 0); om_mame_stop = RegisterWindowMessage(OM_MAME_STOP); assert(om_mame_stop != 0); om_mame_update_state = RegisterWindowMessage(OM_MAME_UPDATE_STATE); assert(om_mame_update_state != 0); om_mame_register_client = RegisterWindowMessage(OM_MAME_REGISTER_CLIENT); assert(om_mame_register_client != 0); om_mame_unregister_client = RegisterWindowMessage(OM_MAME_UNREGISTER_CLIENT); assert(om_mame_unregister_client != 0); om_mame_get_id_string = RegisterWindowMessage(OM_MAME_GET_ID_STRING); assert(om_mame_get_id_string != 0); // broadcast a startup message PostMessage(HWND_BROADCAST, om_mame_start, (WPARAM)output_hwnd, 0); // register a notifier for output changes machine().output().set_notifier(nullptr, notifier_callback, &machine()); return true; }
void winoutput_init(running_machine *machine) { int result; // ensure we get cleaned up add_exit_callback(machine, winoutput_exit); // reset globals clientlist = NULL; // create our window class result = create_window_class(); assert(result == 0); // create a window output_hwnd = CreateWindowEx( WINDOW_STYLE_EX, OUTPUT_WINDOW_CLASS, OUTPUT_WINDOW_NAME, WINDOW_STYLE, 0, 0, 1, 1, NULL, NULL, GetModuleHandle(NULL), NULL); assert(output_hwnd != NULL); // allocate message ids om_mame_start = RegisterWindowMessage(OM_MAME_START); assert(om_mame_start != 0); om_mame_stop = RegisterWindowMessage(OM_MAME_STOP); assert(om_mame_stop != 0); om_mame_update_state = RegisterWindowMessage(OM_MAME_UPDATE_STATE); assert(om_mame_update_state != 0); om_mame_register_client = RegisterWindowMessage(OM_MAME_REGISTER_CLIENT); assert(om_mame_register_client != 0); om_mame_unregister_client = RegisterWindowMessage(OM_MAME_UNREGISTER_CLIENT); assert(om_mame_unregister_client != 0); om_mame_get_id_string = RegisterWindowMessage(OM_MAME_GET_ID_STRING); assert(om_mame_get_id_string != 0); // broadcast a startup message PostMessage(HWND_BROADCAST, om_mame_start, (WPARAM)output_hwnd, 0); // register a notifier for output changes output_set_notifier(NULL, notifier_callback, NULL); }
int winwindow_init(running_machine *machine) { size_t temp; // determine if we are using multithreading or not multithreading_enabled = options_get_bool("multithreading"); // get the main thread ID before anything else main_threadid = GetCurrentThreadId(); // ensure we get called on the way out add_exit_callback(machine, winwindow_exit); // set up window class and register it if (create_window_class()) return 1; // create an event to signal UI pausing ui_pause_event = CreateEvent(NULL, TRUE, FALSE, NULL); if (!ui_pause_event) return 1; // if multithreading, create a thread to run the windows if (multithreading_enabled) { // create an event to signal when the window thread is ready window_thread_ready_event = CreateEvent(NULL, TRUE, FALSE, NULL); if (!window_thread_ready_event) return 1; // create a thread to run the windows from temp = _beginthreadex(NULL, 0, thread_entry, NULL, 0, (unsigned *)&window_threadid); window_thread = (HANDLE)temp; if (window_thread == NULL) return 1; // set the thread priority equal to the main MAME thread SetThreadPriority(window_thread, GetThreadPriority(GetCurrentThread())); } // otherwise, treat the window thread as the main thread else { window_thread = GetCurrentThread(); window_threadid = main_threadid; } // initialize the drawers if (video_config.mode == VIDEO_MODE_D3D) { if (drawd3d_init(&draw)) video_config.mode = VIDEO_MODE_GDI; } if (video_config.mode == VIDEO_MODE_DDRAW) { if (drawdd_init(&draw)) video_config.mode = VIDEO_MODE_GDI; } if (video_config.mode == VIDEO_MODE_GDI) { if (drawgdi_init(&draw)) return 1; } if (video_config.mode == VIDEO_MODE_NONE) { if (drawnone_init(&draw)) return 1; } // set up the window list last_window_ptr = &win_window_list; return 0; }