Ejemplo n.º 1
1
BOOL RegisterLimitEdit()
{
	WNDCLASSEX LimitEditEx;
	ZeroMemory(&LimitEditEx, sizeof(LimitEditEx));
	LimitEditEx.cbSize = sizeof(WNDCLASSEX);
	GetClassInfoEx(0, TEXT("EDIT"), &LimitEditEx);
	OldEditWndProc = LimitEditEx.lpfnWndProc;
	LimitEditEx.lpfnWndProc = LimitEditProc;
	//PreEditEx.lpszMenuName=
	LimitEditEx.lpszClassName = TEXT("LimitEdit");
	RegisterClassEx(&LimitEditEx);
	return TRUE;
}
Ejemplo n.º 2
1
BOOL RegisterTimeBoxEdit()
{
	WNDCLASSEX TimeBoxEdit;
	ZeroMemory(&TimeBoxEdit, sizeof(TimeBoxEdit));
	TimeBoxEdit.cbSize = sizeof(WNDCLASSEX);
	GetClassInfoEx(0, TEXT("EDIT"), &TimeBoxEdit);
	OldEditWndProc2 = TimeBoxEdit.lpfnWndProc;
	TimeBoxEdit.lpfnWndProc = TimeBoxProc;
	//PreEditEx.lpszMenuName=
	TimeBoxEdit.lpszClassName = TEXT("TimeBoxEdit");
	RegisterClassEx(&TimeBoxEdit);
	return TRUE;
}
Ejemplo n.º 3
1
void InitURLControl()
{
	WNDCLASSEX wce;

	ZeroMemory(&wce, sizeof(wce));
	wce.cbSize = sizeof(WNDCLASSEX);
	if (GetClassInfoEx(hInst, "Static", &wce)==0) {
		PrintLastError("GetClassInfoEx()");
        return;
	}

	wce.hCursor = LoadCursor(NULL, IDC_HAND);
	wce.hInstance = hInst;
	wce.lpszClassName = "URLLink";
	if (RegisterClassEx(&wce) == 0) {
		PrintLastError("RegisterClassEx()");
	}

}
Ejemplo n.º 4
0
BOOL FadeCtrl_RegisterControl(HMODULE hModule)
{
    WNDCLASSEX wcex;
    WNDCLASS wc;

    ZeroMemory(&wc, sizeof(WNDCLASS));
    wcex.cbSize = sizeof(WNDCLASSEX);

    if (GetClassInfoEx(hModule, ABOUT_FADE_CLASS, &wcex) != 0)
        return (TRUE);

    wc.style            = CS_SAVEBITS | CS_DBLCLKS | CS_BYTEALIGNCLIENT | CS_GLOBALCLASS;
    wc.lpfnWndProc      = (WNDPROC)FadeCtrl_WndProc;
    wc.cbClsExtra       = 0;
    wc.cbWndExtra       = 0;
    wc.hInstance        = hModule;
    wc.hIcon            = NULL;
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground    = (HBRUSH)GetStockObject(BLACK_BRUSH);
    wc.lpszMenuName     = NULL;
    wc.lpszClassName    = ABOUT_FADE_CLASS;

    if (!RegisterClass(&wc))
        return (FALSE);

    return (TRUE);
}
Ejemplo n.º 5
0
bool Window::RegClass(LPCTSTR lpszClass, HINSTANCE hInstance)
{
    WNDCLASSEX wcex;

    if (!GetClassInfoEx(hInstance, lpszClass, &wcex))
    {
        wcex.cbSize         = sizeof(WNDCLASSEX);
        wcex.style          = 0;
        wcex.lpfnWndProc    = WindowProc;
        wcex.cbClsExtra     = 0;
        wcex.cbWndExtra     = 0;
        wcex.hInstance      = NULL;
        wcex.hIcon          = NULL;
        wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
        wcex.hbrBackground  = (HBRUSH)GetStockObject(WHITE_BRUSH);
        wcex.lpszMenuName   = NULL;
        wcex.lpszClassName  = NULL;
        wcex.hIconSm        = NULL;

        FillWndClassEx(wcex);

        wcex.hInstance = hInstance;
        wcex.lpszClassName = lpszClass;

        if (!RegisterClassEx(&wcex)) { return false; }
    }

    return true;
}
Ejemplo n.º 6
0
bool CommonWnd::CreateClass()
{
  memset(&_wc, 0, sizeof(WNDCLASSEX));
  _hinstance = GetModuleHandle(nullptr);
  if (GetClassInfoEx(_hinstance, _szClassName.c_str(), &_wc))
  {
    return true;
  }
  //Step 1: Registering the Window Class
  _wc.cbSize = sizeof(WNDCLASSEX);
  _wc.style = CS_HREDRAW | CS_VREDRAW;
  _wc.lpfnWndProc = WndProc;
  _wc.cbClsExtra = 0;
  _wc.cbWndExtra = 0;
  _wc.hInstance = _hinstance;
  _wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
  _wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
  _wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
  _wc.lpszMenuName = nullptr;
  _wc.lpszClassName = _szClassName.c_str();
  _wc.hIconSm = LoadIcon(nullptr, IDI_APPLICATION);

  if (!RegisterClassEx(&_wc))
  {
    return false;
  }
  return true;
}
Ejemplo n.º 7
0
bool basic_window::registerClass(const char *_className)
{
  className = _className;
  
  WNDCLASSEX wc;
  if (!GetClassInfoEx(hInstance, _className, &wc))
  {
    wc.cbSize        = sizeof(WNDCLASSEX); 
    wc.style		     = 0;	    // Redraw On Size, And Own DC For Window.
    wc.lpfnWndProc	 = (WNDPROC) WndProcRouter;			
    wc.cbClsExtra		 = 0;					                  // No Extra Window Data
    wc.cbWndExtra		 = 0;					                  // No Extra Window Data
    wc.hInstance		 = hInstance;				            // Set The Instance
    wc.hIcon		     = LoadIcon(NULL, IDI_WINLOGO); // Load The Default Icon
    wc.hCursor		   = LoadCursor(NULL, IDC_ARROW); // Load The Arrow Pointer
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);				
    wc.lpszMenuName	 = NULL;			     		          // We Don't Want A Menu
    wc.lpszClassName = className;    		            // Set The Class Name
    wc.hIconSm       = LoadIcon(NULL, IDI_WINLOGO);

    if (!RegisterClassEx(&wc))					            // Attempt To Register The Window Class
    {
      char error[50];
      sprintf(error, "Failed To Register %s Window Class.", className);
      
      MessageBox(NULL, error, "ERROR", MB_OK | MB_ICONEXCLAMATION);

      return false;	
    }
  }
  
  return true;
}
Ejemplo n.º 8
0
bool mdi_window::registerClass(const char *_className)
{
  className = _className;
  
  WNDCLASSEX wc;

  if (!GetClassInfoEx(hInstance, _className, &wc))
  {
    wc.cbSize        =              sizeof(WNDCLASSEX);
    wc.style         =                               0;
    wc.lpfnWndProc   =         (WNDPROC) WndProcRouter;
    wc.cbClsExtra    =                               0;
    wc.cbWndExtra    =                               0;
    wc.hInstance     =                       hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       =     LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground =        (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  =                            NULL;  //no menu for now
    wc.lpszClassName =                       className;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    if (!RegisterClassEx(&wc)) // Attempt To Register The Window Class
    {
      char error[50];
      sprintf(error, "Failed To Register %s Window Class.", className);
      
      MessageBox(NULL, error, "ERROR", MB_OK | MB_ICONEXCLAMATION);

      return false;	
    }
  }
  
  return true;
}
Ejemplo n.º 9
0
VOID WepWriteClientData(
    __in HWND hwnd
    )
{
    WCHAR className[256];
    LOGICAL isUnicode;

    memset(&WeServerSharedData->c, 0, sizeof(WeServerSharedData->c));
    isUnicode = IsWindowUnicode(hwnd);

    if (isUnicode)
    {
        WeServerSharedData->c.WndProc = GetWindowLongPtrW(hwnd, GWLP_WNDPROC);
        WeServerSharedData->c.DlgProc = GetWindowLongPtrW(hwnd, DWLP_DLGPROC);
    }
    else
    {
        WeServerSharedData->c.WndProc = GetWindowLongPtrA(hwnd, GWLP_WNDPROC);
        WeServerSharedData->c.DlgProc = GetWindowLongPtrA(hwnd, DWLP_DLGPROC);
    }

    if (!GetClassName(hwnd, className, sizeof(className) / sizeof(WCHAR)))
        className[0] = 0;

    WeServerSharedData->c.ClassInfo.cbSize = sizeof(WNDCLASSEX);
    GetClassInfoEx(NULL, className, &WeServerSharedData->c.ClassInfo);

    if (isUnicode)
        WeServerSharedData->c.ClassInfo.lpfnWndProc = (PVOID)GetClassLongPtrW(hwnd, GCLP_WNDPROC);
    else
        WeServerSharedData->c.ClassInfo.lpfnWndProc = (PVOID)GetClassLongPtrA(hwnd, GCLP_WNDPROC);
}
Ejemplo n.º 10
0
//***************************************************************
bool CDummyWindow::init(HINSTANCE hInstance, WNDPROC winProc)
{
	release();
	static const char *INVISIBLE_WINDOW_CLASS = "nl_invisible_wnd_class";
	WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	if (!GetClassInfoEx(hInstance, INVISIBLE_WINDOW_CLASS, &wc))
	{
		wc.cbSize = sizeof(WNDCLASSEX);
		wc.style			= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
		wc.lpfnWndProc		= nlDefaultWinProc;
		wc.cbClsExtra		= 0;
		wc.cbWndExtra		= 0;
		wc.hInstance		= hInstance;
		wc.hIcon			= 0;
		wc.hCursor			= 0;
		wc.hbrBackground	= 0;
		wc.lpszMenuName		= 0;
		wc.lpszClassName	= INVISIBLE_WINDOW_CLASS;
		wc.hIconSm			= 0;
		RegisterClassEx(&wc);
	}
    _HWnd = CreateWindow(INVISIBLE_WINDOW_CLASS, "", WS_POPUP,
                         CW_USEDEFAULT,CW_USEDEFAULT,
                         CW_USEDEFAULT,CW_USEDEFAULT,
                         NULL, 0,
                         hInstance, 0);
	if (_HWnd)
	{
		if (winProc) SetWindowLongPtr(_HWnd, GWLP_WNDPROC, (LONG_PTR) winProc);
		return true;
	}
	return false;
}
Ejemplo n.º 11
0
int PASCAL ApplyWinMain(HINSTANCE hInstance)
{
    INITCOMMONCONTROLSEX icc;
    WNDCLASSEX wcx;
	icc.dwSize = sizeof(icc);
	icc.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&icc);

	InitCheckedListBox(hInstance);
	if(0 == ghInstance)
	{
		ghInstance = hInstance;

		

		/* Get system dialog information */
		wcx.cbSize = sizeof(wcx);
		if (!GetClassInfoEx(NULL, MAKEINTRESOURCE(32770), &wcx))
			return 0;

		/* Add our own stuff */
		wcx.hInstance = hInstance;
	//	wcx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDR_ICO_MAIN));
		wcx.lpszClassName = _T("CheckedCClass");
		if (!RegisterClassEx(&wcx))
			return 0;
	}
    /* The user interface is a modal dialog box */
    return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLGSEGMEN), NULL, (DLGPROC)Main_Apply_DlgProc);
}
Ejemplo n.º 12
0
void Window::enableTooltips(bool enable)
{
  if (hWnd == NULL)
    return;
  if (enable && ttData == NULL)
  {
    ttData = new TTData;
    WNDCLASSEX wcx;
    HINSTANCE hInstance = getInstance();
    if (!GetClassInfoEx(hInstance, "DRTooltip", &wcx))
    {
      memset(&wcx, 0, sizeof wcx);
      wcx.cbSize = sizeof wcx;
      wcx.lpfnWndProc = TooltipWindowProc;
      wcx.hInstance = hInstance;
      wcx.lpszClassName = "DRTooltip";
      wcx.hbrBackground = CreateSolidBrush(0xE1FFFF);
      RegisterClassEx(&wcx);
    }
    ttData->hTip = CreateWindowEx(WS_EX_TOPMOST, "DRTooltip",
      NULL, WS_POPUP, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWnd, NULL,
      getInstance(), NULL);

    ttData->hitCode = -1;
  }
  else if (!enable && ttData != NULL)
  {
    DestroyWindow(ttData->hTip);
    delete ttData;
    ttData = NULL;
  }
}
Ejemplo n.º 13
0
/*************
 * DESCRIPTION:	Called before window is created, change window class so
 *						that we have an own DC
 * INPUT:			system
 * OUTPUT:			-
 *************/
BOOL CCamView::PreCreateWindow(CREATESTRUCT &cs)
{
    cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
    if (CView::PreCreateWindow(cs))
    {
        static BOOL bRegistered = FALSE;		// flag for first-time init

        if (!bRegistered)
        {
            // This is the first time a view is being created.
            // Need to register the view class.
            //
            TRACE("CCamView::PreCreateWindow, MFC classname = %s\n", cs.lpszClass);
            WNDCLASSEX wc;
            wc.cbSize = sizeof(WNDCLASSEX);

            // Get class information for MFC default view.
            // The classname is in cs.lpszClass
            GetClassInfoEx(AfxGetInstanceHandle(), cs.lpszClass, &wc);

            // Modify name and style
            wc.lpszClassName = CAMVIEWCLASSNAME;
            // Here's the trick, we want to have our own DC !
            // We don't want to call GetDC all the time!
            wc.style |= CS_OWNDC;

            // Register new class
            VERIFY(RegisterClassEx(&wc));
        }
        cs.lpszClass = CAMVIEWCLASSNAME;

        return TRUE;
    }
    return FALSE;
}
Ejemplo n.º 14
0
BOOL BaseBar_RegisterControl(HINSTANCE hInstance)
{
    WNDCLASSEX wcex;
    WNDCLASS   wc;

    ZeroMemory(&wc, sizeof(WNDCLASS));
    wcex.cbSize = sizeof(WNDCLASSEX);

    if (GetClassInfoEx(hInstance, WC_BASEBAR, &wcex) != 0)
        return (TRUE);

    wc.style         = CS_SAVEBITS;
    wc.lpfnWndProc   = (WNDPROC) BaseBar_WindowProc;
    wc.hInstance     = hInstance;
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
    wc.lpszClassName = WC_BASEBAR;

    if (!RegisterClass(&wc))
        return (FALSE);

    s_hBaseBarAtom = GlobalAddAtom(s_pszBaseBarProp);


    return (TRUE);
}
Ejemplo n.º 15
0
/*
Author      : mah
Date        : 13.06.2002
Description : 
    Constructs window class InputBox
*/
CInputBox::CInputBox(HWND hWndParent)
{
	HINSTANCE hInst = GetModuleHandle(NULL);

	WNDCLASSEX wcex;

	if (!GetClassInfoEx(hInst, _T("InputBox"), &wcex))
	{
		wcex.cbSize = sizeof(WNDCLASSEX); 

		wcex.style			= CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc	= (WNDPROC)WndProc;
		wcex.cbClsExtra		= 0;
		wcex.cbWndExtra		= 0;
		wcex.hInstance		= hInst;
		wcex.hIcon			= NULL;//LoadIcon(hInst, (LPCTSTR)IDI_MYINPUTBOX);
		wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
		wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW);
		wcex.lpszMenuName	= NULL;
		wcex.lpszClassName	= _T("InputBox");
		wcex.hIconSm		= NULL;

		if (RegisterClassEx(&wcex) == 0)
			MessageBox(NULL, _T("Can't create CInputBox!"), _T("Error"), MB_OK);
	}

    m_hWndParent = hWndParent;

    Text = NULL;

}
Ejemplo n.º 16
0
/**
* Function:	Window::createWindow()
* Description: Creates a window with the specified name, starting coordinates, height and width.
*/
void Window::createWindow()
{
	std::wstring stemp = std::wstring(windowName.begin(), windowName.end());
	LPCWSTR windowNaamLPCWSTR = stemp.c_str();
	WNDCLASSEX wc = { 0 };
	wc.cbSize = sizeof wc;
	wc.hInstance = GetModuleHandle(NULL);
	wc.style = CS_CLASSDC;
	wc.lpfnWndProc = WindowProc;
	wc.lpszClassName = windowClass;

	if (!GetClassInfoEx(wc.hInstance, windowClass, &wc))
	{	
		if (!RegisterClassEx(&wc))
		{
			loggerW->WriteToFile(Error, "Window Registration Failed!");
		}
	}
   
	hwnd = CreateWindowEx(WS_EX_APPWINDOW, windowClass, windowNaamLPCWSTR,
                              WS_OVERLAPPEDWINDOW, startingX, startingY, windowWidth, windowHeight,
                              NULL, NULL, wc.hInstance, this );
	SetWindowText(hwnd, windowNaamLPCWSTR);
	ShowWindow(hwnd, SW_SHOWDEFAULT);
	Window::updateWindow();
}
Ejemplo n.º 17
0
BOOL CPanel::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: 在此添加专用代码和/或调用基类
	HINSTANCE hist = AfxGetInstanceHandle();

	WNDCLASSEX wcex;
	wcex.cbSize = sizeof(WNDCLASSEX);
	if (GetClassInfoEx(hist,cs.lpszClass,&wcex))
	{
		return TRUE;
	}

	wcex.cbClsExtra = 0;
	wcex.cbSize = sizeof(wcex);
	wcex.cbWndExtra = 0;
	wcex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	wcex.hCursor = LoadCursor(NULL,IDC_ARROW);
	wcex.hIcon = LoadIcon(hist,MAKEINTRESOURCE(IDR_MAINFRAME));
	wcex.hIconSm = LoadIcon(hist,MAKEINTRESOURCE(IDR_MAINFRAME));
	wcex.hInstance = hist;
	wcex.lpfnWndProc = AfxWndProc;
	wcex.lpszClassName = cs.lpszClass;
	wcex.lpszMenuName = NULL;
	wcex.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;

	if (!RegisterClassEx(&wcex))
	{
		return FALSE;
	}

	return  TRUE;

}
Ejemplo n.º 18
0
BOOL CImageButton::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO:  在此添加专用代码和/或调用基类
	WNDCLASSEX wcex;
	wcex.cbSize = sizeof(WNDCLASSEX);
	if (GetClassInfoEx(cs.hInstance, cs.lpszClass, &wcex))	// 已经注册
	{
		return TRUE;
	}

	// 注册
	wcex.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
	wcex.lpfnWndProc = AfxWndProc;
	wcex.cbClsExtra = 0;
	wcex.cbWndExtra = 0;
	wcex.hInstance = cs.hInstance;
	wcex.hIcon = wcex.hIconSm = (HICON)LoadIcon(cs.hInstance, MAKEINTRESOURCE(IDR_MAINFRAME));
	wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcex.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
	wcex.lpszMenuName = NULL;
	wcex.lpszClassName = cs.lpszClass;
	return RegisterClassEx(&wcex);

	//return CWnd::PreCreateWindow(cs);
}
Ejemplo n.º 19
0
bool Balloon::Initialize()
{
  WNDCLASSEX wincl;

  if (!GetClassInfoEx(mainInst, balloonName, &wincl))
  {
    ZeroMemory(&wincl, sizeof(WNDCLASSEX));

    // Register the window class
    wincl.hInstance = mainInst;
    wincl.lpszClassName = balloonName;
    wincl.lpfnWndProc = BalloonProcedure;
    wincl.cbSize = sizeof (WNDCLASSEX);
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);

    if (!RegisterClassEx (&wincl))
    {
      return false;
    }
  }

  balloonWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_LAYERED, balloonName, NULL, WS_POPUP,
                              0, 0, 0, 0, NULL, NULL, mainInst, reinterpret_cast<LPVOID>(this));
  if (!balloonWnd)
  {
    return false;
  }

  return true;
}
bool
HippoAbstractWindow::registerClass()
{
    WNDCLASSEX wcex;
    
    // note that the class may be a predefined Windows control class,
    // and that RegisterClassEx does NOT fail if the class is already
    // registered

    HippoUStr uName(className_);
    if (GetClassInfoEx(instance_, className_.m_str, &wcex) != 0) {
        g_debug("Got existing window class %s", uName.c_str());
        return true;
    } else if (GetClassInfoEx(NULL, className_.m_str, &wcex) != 0) {
        g_debug("Got existing system window class %s", uName.c_str());
        return true;
    } else {
        ZeroMemory(&wcex, sizeof(WNDCLASSEX));
        wcex.cbSize = sizeof(WNDCLASSEX); 

        wcex.style = classStyle_;
        wcex.lpfnWndProc = windowProc;
        wcex.cbClsExtra = 0;
        wcex.cbWndExtra = 0;
        wcex.hInstance  = instance_;
        wcex.hCursor    = LoadCursor(NULL, IDC_ARROW);
        wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
        wcex.lpszMenuName   = NULL;
        wcex.lpszClassName  = className_.m_str;
        if (ui_) {
            wcex.hIcon = ui_->getBigIcon();
            wcex.hIconSm = ui_->getSmallIcon();;
        }

        if (RegisterClassEx(&wcex) == 0) {
            HippoBSTR err;
            hippoHresultToString(GetLastError(), err);
            g_warning("Failed to register window class and failed to get existing class %s: %s", uName.c_str(),
                HippoUStr(err).c_str());
            return false;
        } else {
            g_debug("Registered new window class %s", uName.c_str());
            return true;
        }
    }
}
static int vboxClipboardCreateWindow(PVBOXCLIPBOARDCONTEXT pCtx)
{
    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);

    int rc = VINF_SUCCESS;

    AssertPtr(pCtx->pEnv);
    HINSTANCE hInstance = pCtx->pEnv->hInstance;
    Assert(hInstance != 0);

    /* Register the Window Class. */
    WNDCLASSEX wc = { 0 };
    wc.cbSize     = sizeof(WNDCLASSEX);

    if (!GetClassInfoEx(hInstance, s_szClipWndClassName, &wc))
    {
        wc.style         = CS_NOCLOSE;
        wc.lpfnWndProc   = vboxClipboardWndProc;
        wc.hInstance     = pCtx->pEnv->hInstance;
        wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1);
        wc.lpszClassName = s_szClipWndClassName;

        ATOM wndClass = RegisterClassEx(&wc);
        if (wndClass == 0)
            rc = RTErrConvertFromWin32(GetLastError());
    }

    if (RT_SUCCESS(rc))
    {
        const PVBOXCLIPBOARDWINCTX pWinCtx = &pCtx->Win;

        /* Create the window. */
        pWinCtx->hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
                                       s_szClipWndClassName, s_szClipWndClassName,
                                       WS_POPUPWINDOW,
                                       -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
        if (pWinCtx->hWnd == NULL)
        {
            rc = VERR_NOT_SUPPORTED;
        }
        else
        {
            SetWindowPos(pWinCtx->hWnd, HWND_TOPMOST, -200, -200, 0, 0,
                         SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE);

            VBoxClipboardWinAddToCBChain(pWinCtx);
            if (!VBoxClipboardWinIsNewAPI(&pWinCtx->newAPI))
                pWinCtx->oldAPI.timerRefresh = SetTimer(pWinCtx->hWnd, 0, 10 * 1000 /* 10s */, NULL);
        }
    }

    LogFlowFuncLeaveRC(rc);
    return rc;
}
Ejemplo n.º 22
0
void FadeCtrl_UnregisterControl(HMODULE hModule)
{
    WNDCLASSEX wcex;

    wcex.cbSize = sizeof(WNDCLASSEX);

    if (GetClassInfoEx(hModule, ABOUT_FADE_CLASS, &wcex) == FALSE)
        return;

    UnregisterClass(ABOUT_FADE_CLASS, hModule);
}
Ejemplo n.º 23
0
static void register_subclass(void)
{
    WNDCLASSEX cls;

    cls.cbSize = sizeof(WNDCLASSEX);
    GetClassInfoEx(NULL, STATUSCLASSNAME, &cls);
    g_status_wndproc = cls.lpfnWndProc;
    cls.lpfnWndProc = create_test_wndproc;
    cls.lpszClassName = SUBCLASS_NAME;
    cls.hInstance = NULL;
    ok(RegisterClassEx(&cls), "RegisterClassEx failed\n");
}
Ejemplo n.º 24
0
BOOL BaseBar_UnregisterControl(HINSTANCE hInstance)
{
    WNDCLASSEX wcex;

    if (GetClassInfoEx(hInstance, WC_BASEBAR, &wcex) == 0)
        return (FALSE);

    UnregisterClass(WC_BASEBAR, hInstance);
    GlobalDeleteAtom(s_hBaseBarAtom);

    return (TRUE);
}
Ejemplo n.º 25
0
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
    WNDCLASSEX wcx;
    
    ghInstance = hInstance;

    wcx.cbSize = sizeof(wcx);
    if (!GetClassInfoEx(NULL, MAKEINTRESOURCE(32770), &wcx)) return 0;
    wcx.hInstance = hInstance;
    wcx.lpszClassName = _T("HLinkClass");
    if (!RegisterClassEx(&wcx)) return 0;

    return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)MainDlgProc);
}
Ejemplo n.º 26
0
Window::Window(uint width, uint height)	{
	hasInit = false;
	HINSTANCE hInstance = GetModuleHandle( NULL );

	WNDCLASSEX windowClass;
	ZeroMemory(&windowClass, sizeof(WNDCLASSEX));

	if(!GetClassInfoEx(hInstance,WINDOWCLASS,&windowClass))	{
		windowClass.cbSize		= sizeof(WNDCLASSEX);
		windowClass.style		= CS_HREDRAW | CS_VREDRAW;
		windowClass.lpfnWndProc	= (WNDPROC)StaticWindowProc;
		windowClass.hInstance	= hInstance;
		windowClass.hCursor		= LoadCursor(NULL, IDC_ARROW);
		windowClass.hbrBackground = (HBRUSH)COLOR_WINDOW;
		windowClass.lpszClassName = WINDOWCLASS;

		if(!RegisterClassEx(&windowClass)) {
			return;
		}
	}

	windowHandle = CreateWindowEx(NULL,
		WINDOWCLASS,    // name of the window class
		"Software Rasteriser!",   // title of the window
		WS_OVERLAPPEDWINDOW|WS_POPUP|WS_VISIBLE|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX,    // window style
		(int)100,	// x-position of the window
		(int)100,	// y-position of the window
		(int)width,		// width of the window
		(int)height,		// height of the window
		NULL,				// No parent window!
		NULL,				// No Menus!
		hInstance,			// application handle
		this);				// 

	deviceContext=GetDC(windowHandle);

	RECT    rt; 
	GetClientRect(windowHandle, &rt);

	screenWidth		= rt.right;
	screenHeight	= rt.bottom;

	BuildBitmap();

	Keyboard::Initialise(windowHandle);
	Mouse::Initialise(windowHandle);

	hasInit		= true;
	forceQuit	= false;
}
Ejemplo n.º 27
0
	bool KWindow::RegisterClass(LPCTSTR lpszClass, HINSTANCE hInst)
	{
		WNDCLASSEX wc;

		if (!GetClassInfoEx(hInst, lpszClass, &wc))
		{
			GetWndClassEx(wc);
			wc.hInstance = hInst;
			wc.lpszClassName = lpszClass;
			if (!RegisterClassEx(&wc))
				return false;
		}

		return true;
	}
Ejemplo n.º 28
0
  IpcListenerWnd::IpcListenerWnd(const wchar_t* pszClassName, HWND pParent, std::mutex& mutex, IpcMessageHandler& handler) :
    _mutex( mutex ),
    _pParentWnd(pParent),
    _handler( handler )
  {
    //  the instance of this module
    auto hInstance = ::GetModuleHandle( nullptr );
    WNDCLASSEX wcx; 
    if (GetClassInfoEx(hInstance, pszClassName, &wcx))
    {
      throw "The server already exists.";
    }

    wcx.cbSize = sizeof(wcx);
    wcx.style = 0;
    wcx.lpfnWndProc = WindowProc;
    wcx.cbClsExtra = 0;
    wcx.cbWndExtra = 0;
    wcx.hInstance = hInstance;
    wcx.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
    wcx.hCursor = LoadCursor(nullptr, IDC_ARROW);
    wcx.hbrBackground = static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH));
    wcx.lpszMenuName = L"MainMenu";
    wcx.lpszClassName = pszClassName;
    wcx.hIconSm = static_cast<HICON>(LoadImage(hInstance,
                                               MAKEINTRESOURCE(5),
                                               IMAGE_ICON,
                                               GetSystemMetrics(SM_CXSMICON),
                                               GetSystemMetrics(SM_CYSMICON),
                                               LR_DEFAULTCOLOR));

    if (!RegisterClassEx(&wcx))
    {
      throw "Can't register IpcListener window class.";
    }

    // one way or another the class was created.
    // so we can create our listener accordingly.
    if (!this->CWnd::CreateEx(0, pszClassName, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr))
    {
      throw "Can't create IpcListener window.";
    }

    this->CWnd::UpdateWindow();

    // save this pointer
    SetWindowLongPtr(GetSafeHwnd(), GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
  }
Ejemplo n.º 29
0
int wgWindowRegister(struct wgWindow* object, HINSTANCE hInst, LPCTSTR className)
{
  WNDCLASSEX wc;

  assert(NULL != object);
  if (!GetClassInfoEx(hInst, className, &wc))
  {
    object->getWindowClassEx(object, &wc);
    wc.hInstance      = hInst;
    wc.lpszClassName  = className;
    if (!RegisterClassEx(&wc))
      return Result_Failed_RegisterWindowClass;
  }

  return Result_Success;
}
Ejemplo n.º 30
0
static void EhTreeInizialize(void)
{
	WNDCLASSEX wc;
	// Cambio il puntamento standarda della procedura di classe Eh
	CHAR NewClass[80];
	sprintf(NewClass,"%sT",sys.tzWinClassBase); //win_infoarg("%s",NewClass);
	wc.cbSize=sizeof(wc);
	if (!GetClassInfoEx(sys.EhWinInstance,sys.tzWinClassBase,&wc)) ehExit("Errore 1");
	if (wc.lpfnWndProc!=LIntercept)
	{
		EhOriginalProc=wc.lpfnWndProc;
		wc.lpfnWndProc=LIntercept;
		wc.lpszClassName=NewClass;
		if (!RegisterClassEx(&wc)) win_infoarg("error");
		strcpy(sys.tzWinClassBase,NewClass);
	}
}