// Create Method.  Call this to create a cef_main_window instance 
BOOL cef_main_window::Create() 
{
    RegisterWndClass();

    int left   = CW_USEDEFAULT;
    int top    = CW_USEDEFAULT;
    int width  = CW_USEDEFAULT;
    int height = CW_USEDEFAULT;
    int showCmd = SW_SHOW;

    LoadWindowRestoreRect(left, top, width, height, showCmd);

    DWORD styles =  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_EX_COMPOSITED;

    if (showCmd == SW_MAXIMIZE)
      styles |= WS_MAXIMIZE;

    if (!cef_host_window::Create(::kWindowClassname, GetBracketsWindowTitleText(),
                                styles, left, top, width, height))
    {
        return FALSE;
    }

    RestoreWindowPlacement(showCmd);
    UpdateWindow();

    return TRUE;
}
Example #2
0
CNSChartCtrl::CNSChartCtrl()
{
	RegisterWndClass(AfxGetInstanceHandle());
	//m_txtFont.CreateStockObject(DEFAULT_GUI_FONT);
	m_txtFont.CreateFont(15,0,0,0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, 
		OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH| FF_DONTCARE, _T("Arial Narrow"));
	
	m_boldFont.CreateStockObject(DEFAULT_GUI_FONT);
	
	LOGFONT lf;
	if(m_txtFont.GetLogFont(&lf))
	{
		lf.lfWeight = FW_BOLD;
		lf.lfHeight = 15;
		_tcscpy(lf.lfFaceName,TEXT("Century Gothic"));
		m_titleFont.DeleteObject();
		m_titleFont.CreateFontIndirect(&lf);
	}

	if(m_boldFont.GetLogFont(&lf)){
		lf.lfWeight = FW_BOLD;
		//lf.lfHeight = 10;
		//_tcscpy(lf.lfFaceName,TEXT("Arial Narrow"));
		m_boldFont.DeleteObject();
		m_boldFont.CreateFontIndirect(&lf);
	}

	m_dTotal = 0.0L;
	m_dMax = 0.0l;
	m_dwStyle = NSCS_PIE;

	m_iCurSel = -1;
}
Example #3
0
CNSChartCtrl::CNSChartCtrl()
{
	m_bShowPercentage = false;
	m_bIntegerValue = false;
	RegisterWndClass(AfxGetInstanceHandle());
	m_txtFont.CreateStockObject(DEFAULT_GUI_FONT);
	m_boldFont.CreateStockObject(DEFAULT_GUI_FONT);
	
	LOGFONT lf;
	if(m_txtFont.GetLogFont(&lf)){
		lf.lfWeight = FW_BOLD;
		lf.lfHeight = 15;
		strcpy(lf.lfFaceName,"Arial");
		m_titleFont.DeleteObject();
		m_titleFont.CreateFontIndirect(&lf);
	}

	if(m_boldFont.GetLogFont(&lf)){
		lf.lfWeight = FW_BOLD;
		m_boldFont.DeleteObject();
		m_boldFont.CreateFontIndirect(&lf);
	}

	m_dTotal = 0.0L;
	m_dMax = 0.0l;
	m_dwStyle = NSCS_PIE;

	m_iCurSel = -1;
}
Example #4
0
BOOL CreateSplashScreen( DWORD milliseconds )
{
	TCHAR szWindowClass[] = _T("SpashWindowCLASS");

	// -------------------------------------------------------

	HWND hParentWnd = NULL; // ::GetDesktopWindow();
	int tx = iSplashWidth;
	int ty = iSplashHeight;

	// -------------------------------------------------------------

	g_dwSplashScreenTimeToLive = milliseconds;
	g_bStopSplashOnTimer = TRUE;
	g_bDragSplash = FALSE;

	RegisterWndClass( szWindowClass );

//	HWND hForeWnd = GetForegroundWindow();

	HWND hWndUser = CreateWindowEx(
		WS_EX_TOPMOST, szWindowClass,
		TMEX_NAME, WS_VISIBLE | WS_POPUP,
		0, 0, tx, ty, hParentWnd, NULL, NULL, NULL);

	ShowWindow(hWndUser, SW_SHOW);
//	SetForegroundWindow( hForeWnd ); // It works strange ????

	return TRUE;
}
Example #5
0
HRESULT RPInitializeGuest(RPGUESTINFO *pInfo, HINSTANCE hInstance, LPCTSTR pszHostInfo,
                          RPGUESTMSGFN pfnMsgFunction, LPARAM lMsgFunctionParam)
{
	_TCHAR szGuestClass[(sizeof(g_szGuestWndClass)/sizeof(_TCHAR))+20];
	_TCHAR *pszHostClass;
	LRESULT lr;

	if (!pInfo || !pszHostInfo)
		return E_POINTER;

	pInfo->hInstance = hInstance;
	pInfo->hHostMessageWindow = NULL;
	pInfo->hGuestMessageWindow = NULL;
	pInfo->bGuestClassRegistered = FALSE;
	pInfo->pfnMsgFunction = pfnMsgFunction;
	pInfo->lMsgFunctionParam = lMsgFunctionParam;

	// find the host message window
	//
	pszHostClass = (_TCHAR *)LocalAlloc(LMEM_FIXED, (_tcslen(g_szHostWndClass) + _tcslen(pszHostInfo) + 1) * sizeof(_TCHAR));
	if (!pszHostClass)
		return E_OUTOFMEMORY;
	wsprintf(pszHostClass, g_szHostWndClass, pszHostInfo);
	pInfo->hHostMessageWindow = FindWindow(pszHostClass, NULL);
	LocalFree(pszHostClass);
	if (!pInfo->hHostMessageWindow)
		return HRESULT_FROM_WIN32(ERROR_HOST_UNREACHABLE);

	// create the guest message window
	//
	wsprintf(szGuestClass, g_szGuestWndClass, GetCurrentProcessId());
	if (!RegisterWndClass(szGuestClass, hInstance))
		return HRESULT_FROM_WIN32(GetLastError());
	pInfo->bGuestClassRegistered = TRUE;
	//
	pInfo->hGuestMessageWindow = CreateWindow(szGuestClass, NULL, 0, 0,0, 1,1, NULL, NULL, hInstance, (LPVOID)pInfo);
	if (!pInfo->hGuestMessageWindow)
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(GetLastError());
	}

	// register with the host
	//
	if (!RPSendMessage(RP_IPC_TO_HOST_REGISTER, 0, 0, g_szRegistration, sizeof(g_szRegistration), pInfo, &lr))
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(ERROR_HOST_UNREACHABLE);
	}
	if (!lr)
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(ERROR_INVALID_ACCESS);
	}
	return S_OK;
}
Example #6
0
GraphicsView::GraphicsView() {
    RegisterWndClass();

    borderColor = RGB(0,0,0);

    imgLeft.Load(L"Images/left.png");
    imgRight.Load(L"Images/right.png");
    imgUp.Load(L"Images/up.png");
    imgDown.Load(L"Images/down.png");
}
            HWND Create()
            {
                if (::IsWindow(m_hWnd)) return m_hWnd;

                HINSTANCE hInstance = ::GetModuleHandle(NULL);
                RegisterWndClass(hInstance);

                m_hWnd = ::CreateWindow(SPARK_MSG_WND_CLASS_NAME, L"", NULL, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, this);

                return m_hWnd;
            }
CDynamicHelp::CDynamicHelp()
{
	if (wnd_class_.IsEmpty())
		RegisterWndClass();

	cx_left_border_ = cx_right_border_ = 0;
	cy_top_border_ = cy_bottom_border_ = 0;
	MRU_width_ = 300;
	default_size_ = CSize(MRU_width_, AfxGetApp()->GetProfileInt(REGISTRY_SECTION_, REGISTRY_WIDTH_, 500));
	header_height_ = 16;
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	try
	{
		Log.RegisterLog(new cFileLog());
		Log.RegisterLog(new CNetworkLog("FTestResolutionServer"));
	}
	catch(...)
	{
	}

TRY_CATCH

	ParseCommandLine();

	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	MSG msg;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_FTESTRESOLUTIONSERVER, szWindowClass, MAX_LOADSTRING);
	RegisterWndClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	// Init CSettings
	SETTINGS_INSTANCE.SetWindow(hWnd);
	// Init CResolutionManager
	RESOLUTIONMANAGER_INSTANCE.Init();
	// Init CFrameRateServer
	RESOLUTIONSERVER_INSTANCE.Start();
	
	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

CATCH_LOG()

	return 0;
}
Example #10
0
BOOL 
MercuryScrollBar::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext /*= NULL*/){
	if( RegisterWndClass(_T("MercuryScrollBar")) ){
		if( dwStyle&WS_VSCROLL ){
			dwStyle &= ~WS_VSCROLL;
			m_bVscroll = TRUE;
			}
		if( dwStyle&WS_HSCROLL ){
			dwStyle &= ~WS_HSCROLL;
			m_bVscroll = FALSE;
			}
		BOOL bRet =  CWnd::Create(_T("MercuryScrollBar"), _T(""), dwStyle, rect, pParentWnd, nID, pContext);
		return bRet;
		}
	return FALSE;
	}
int APIENTRY _tWinMain(HINSTANCE hInstance,
                       HINSTANCE hPrevInstance,
                       LPTSTR    lpCmdLine,
                       int       nCmdShow)
{
    Log.RegisterLog(new cFileLog());

    MSG msg;

    TRY_CATCH

    ParseCommandLine();

    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // Initialize global strings
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadString(hInstance, IDC_FRAMERATETESTCLIENT, szWindowClass, MAX_LOADSTRING);
    RegisterWndClass(hInstance);

    // Perform application initialization:
    if (!InitInstance (hInstance, nCmdShow))
    {
        return FALSE;
    }

    // Init CSettings
    SETTINGS_INSTANCE.SetWindow(hWnd);
    SETTINGS_INSTANCE.SetCreateFrameBitmaps(false);
    SETTINGS_INSTANCE.SetCreateControlPoints(true);
    FRAMERATECLIENT_INSTANCE;

    if(SETTINGS_INSTANCE.GetClientAutoStart())
        FRAMERATECLIENT_INSTANCE.StartViewer();

    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    CATCH_LOG()

    return 0;
}
Example #12
0
File: cns.c Project: Akasurde/krb5
/*
 * The WINSOCK routine gethostbyname has a bug in both FTP and NetManage
 * implementations which causes the blocking hook, if any, not to be
 * called.  This routine attempts to work around the problem by using
 * the async routines to emulate the functionality of the synchronous
 * routines
 */
struct hostent *PASCAL
krb_gethostbyname(
		  const char *name)
{
  HWND hwnd;
  char buf[MAXGETHOSTSTRUCT];
  BOOL FARPROC blockinghook;
  WNDCLASS wc;
  static BOOL isregistered;

  blockinghook = WSASetBlockingHook(NULL);
  WSASetBlockingHook(blockinghook);

  if (blockinghook == NULL)
    return gethostbyname(name);

  if (RegisterWndClass() == NULL)
    return gethostbyname(name);

  if (!isregistered) {
    wc.style = 0;
    wc.lpfnWndProc = gethostbyname_wnd_proc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hlibinstance;
    wc.hIcon = NULL;
    wc.hCursor = NULL;
    wc.hbrBackground = NULL;
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = GETHOSTBYNAME_CLASS;

    if (!RegisterClass(&wc))
      return gethostbyname(name);

    isregistered = TRUE;
  }

  hwnd = CreateWindow(GETHOSTBYNAME_CLASS, "", WS_OVERLAPPED,
		      -100, -100, 0, 0, HWND_DESKTOP, NULL, hlibinstance, NULL);
  if (hwnd == NULL)
    return gethostbyname(name);

  htaskasync =
    WSAAsyncGetHostByName(hwnd, WM_ASYNC_COMPLETED, name, buf, sizeof(buf));
  b = blockinghook(NULL);
}
Example #13
0
	HWND Window::Create(HWND hwndParent, LPCTSTR className, LPCTSTR pstrName, LPCTSTR superClassName/* = L"" */, DWORD dwStyle/* = UI_WNDSTYLE_FRAME */, DWORD dwExStyle/* = UI_WNDSTYLE_EX_FRAME */, fuint classStyle/* = UI_CLASSSTYLE_FRAME */)
	{
		CHECK_ERROR(className || className != L"", L"Create window failed.");
		CHECK_ERROR(pstrName || pstrName != L"", L"Create window failed.");
		if (!SuperClass(superClassName, className))
		{
			return nullptr;
		}

		if (!RegisterWndClass(className, classStyle))
		{
			return nullptr;
		}

		hWnd_ = ::CreateWindowEx(dwExStyle, className, pstrName, dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndParent, nullptr, App::getInstance()->GetAppInstance(), this);
		CHECK_ERROR(hWnd_, L"Create window failed");
		wndClassName_ = className;
		return hWnd_;
	}
//---------------------------------------------------------------------------------------------
BOOL WinMainLauncher::Init( GameApplication* a_application , HINSTANCE a_hInstance, int a_nCmdShow )
{
	// save pointer to the Instance
	m_hInst													=	a_hInstance;

	// Save pointer to the Application
	m_application											=	a_application;

	m_application->SetWindowConfig( m_config );

	RegisterWndClass( );

    // Initialize the Window
	if( !CreateWindowDlg(a_nCmdShow ) )
	{
		return FALSE;
	}

	return TRUE;
}
Example #15
0
HRESULT RPInitializeGuest(RPGUESTINFO *pInfo, HINSTANCE hInstance, LPCTSTR pszHostInfo,
                          RPGUESTMSGFN pfnMsgFunction, LPARAM lMsgFunctionParam)
{
	_TCHAR szGuestClass[(sizeof(g_szGuestWndClass)/sizeof(_TCHAR))+20];
	_TCHAR *pszHostClass;
	RAWINPUTDEVICE rid;
	LRESULT lr;

	if (!pInfo || !pszHostInfo)
		return E_POINTER;

	pInfo->hInstance = hInstance;
	pInfo->hHostMessageWindow = NULL;
	pInfo->hGuestMessageWindow = NULL;
	pInfo->bGuestClassRegistered = FALSE;
	pInfo->pfnMsgFunction = pfnMsgFunction;
	pInfo->lMsgFunctionParam = lMsgFunctionParam;

	// find the host message window
	//
	pszHostClass = (_TCHAR *)LocalAlloc(LMEM_FIXED, (_tcslen(g_szHostWndClass) + _tcslen(pszHostInfo) + 1) * sizeof(_TCHAR));
	if (!pszHostClass)
	{
		RPUninitializeGuest(pInfo);
		return E_OUTOFMEMORY;
	}
	wsprintf(pszHostClass, g_szHostWndClass, pszHostInfo);
	pInfo->hHostMessageWindow = FindWindow(pszHostClass, NULL);
	LocalFree(pszHostClass);
	if (!pInfo->hHostMessageWindow)
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(ERROR_HOST_UNREACHABLE);
	}
	// create the guest message window
	//
	wsprintf(szGuestClass, g_szGuestWndClass, GetCurrentProcessId());
	if (!RegisterWndClass(szGuestClass, hInstance))
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(GetLastError());
	}
	pInfo->bGuestClassRegistered = TRUE;
	//
	pInfo->hGuestMessageWindow = CreateWindow(szGuestClass, NULL, 0, 0,0, 1,1, NULL, NULL, hInstance, (LPVOID)pInfo);
	if (!pInfo->hGuestMessageWindow)
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(GetLastError());
	}

	// register with the host
	//
	if (!RPSendMessage(RP_IPC_TO_HOST_REGISTER, 0, 0, g_szRegistration, sizeof(g_szRegistration), pInfo, &lr))
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(ERROR_HOST_UNREACHABLE);
	}
	if (!lr)
	{
		RPUninitializeGuest(pInfo);
		return HRESULT_FROM_WIN32(ERROR_INVALID_ACCESS);
	}
	// disable system shortcuts (e.g. Windows-key shortcuts) while the guest is the foreground app
	rid.usUsagePage = 0x01; 
	rid.usUsage = 0x06; 
	rid.dwFlags = RIDEV_NOHOTKEYS;
	rid.hwndTarget = 0;
	RegisterRawInputDevices(&rid, 1, sizeof(rid));

	return S_OK;
}
Example #16
0
CZegoAVView::CZegoAVView()
{
	RegisterWndClass();
	m_nAVQuality = -1;
}
Example #17
0
BOOL CGraphListCtrl::RegisterWindowClass()
{
	return RegisterWndClass(AfxGetInstanceHandle(), GRAPHCTRL_CLASSNAME, CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW);
}
Example #18
0
HWND CreateThinkWindow(HINSTANCE instance, ThinkWindow *window)
{
	return CreateWindowEx(WS_EX_ACCEPTFILES
		, reinterpret_cast<LPCWSTR>(RegisterWndClass()), L"loadngo Think", WS_OVERLAPPEDWINDOW
		, 140, 120, 800, 350, 0, 0, instance, static_cast<void *>(window));
}
Example #19
0
DialogHostCtrl::DialogHostCtrl(UINT dialog_id) : dialog_id_(dialog_id)
{
	RegisterWndClass(WND_CLASS);
}