コード例 #1
0
ファイル: OHReplay.cpp プロジェクト: codadoc/openholdembot
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
bool InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	Registry	reg;
	int			max_x, max_y;
	HWND		hWnd;
	HMENU		sys_menu;

	hInst = hInstance; // Store instance handle in our global variable

	hWnd = CreateWindow(szWindowClass, szTitle, WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
						CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

	g_hWnd = hWnd; // store hwnd in our global variable

	if (!hWnd)
		return FALSE;

	// Add items to system menu
	sys_menu = GetSystemMenu(g_hWnd, FALSE);
	AppendMenu(sys_menu, MF_SEPARATOR, 0, "");
	AppendMenu(sys_menu, MF_STRING, sys_menu_item_open, "&Open...\tCtrl-O");

	// Restore window location and size
	reg.read_reg();
	max_x = GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON);
	max_y = GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON);

	SetWindowPos(hWnd, HWND_TOP, min(reg.main_x, max_x), min(reg.main_y, max_y), 320, 240, SWP_SHOWWINDOW);
	UpdateWindow(hWnd);

	cur_frame = -1;
	cur_working_path[0] = '\0';

	return true;
}
コード例 #2
0
ファイル: OHReplay.cpp プロジェクト: codadoc/openholdembot
bool DestroyWindow()
{
	Registry		reg;
	WINDOWPLACEMENT wp;

	// Save window position
	reg.read_reg();
	GetWindowPlacement(g_hWnd, &wp);

	reg.main_x = wp.rcNormalPosition.left;
	reg.main_y = wp.rcNormalPosition.top;
	reg.write_reg();

	return true;
}