Beispiel #1
0
static BOOL RegisterWindowClasses (void)
{
    WNDCLASSA cls;

    cls.style = 0;
    cls.lpfnWndProc = DefWindowProcA;
    cls.cbClsExtra = 0;
    cls.cbWndExtra = 0;
    cls.hInstance = g_hinst;
    cls.hIcon = NULL;
    cls.hCursor = LoadCursorA (NULL, IDC_ARROW);
    cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    cls.lpszMenuName = NULL;
    cls.lpszClassName = "GetNextDlgItemWindowClass";

    if (!RegisterClassA (&cls)) return FALSE;

    cls.lpfnWndProc = main_window_procA;
    cls.lpszClassName = "IsDialogMessageWindowClass";

    if (!RegisterClassA (&cls)) return FALSE;

    GetClassInfoA(0, "#32770", &cls);
    cls.lpfnWndProc = testDlgWinProc;
    cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
    if (!RegisterClassA (&cls)) return FALSE;

    return TRUE;
}
Beispiel #2
0
void CListSide::Create(HWND hParent, RECT rect, HFONT hFont, int nVBarPos, int nLineHeight, bool bEnableLineSel, bool bIsLyrics)
{
	m_bIsLyrics = bIsLyrics;
	m_bEnableLineSel = bEnableLineSel;
	rect.bottom--;
	rect.right--;
	WNDCLASSA wndclass;
	if (FALSE == GetClassInfoA(genDll.m_hInstance, TABLECLASS, &wndclass))
	{
		ZeroMemory(&wndclass, sizeof(WNDCLASS));

		wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
		wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
		wndclass.hInstance = genDll.m_hInstance;
		wndclass.lpfnWndProc = WindowProc;
		wndclass.lpszClassName = TABLECLASS;
		wndclass.style = CS_VREDRAW | CS_HREDRAW | CS_CLASSDC;

		if (FALSE ==  RegisterClassA(&wndclass))
		{
			DWORD dwError = GetLastError();
			char str[20];
			sprintf(str, "Error 0x%x", dwError);
			MessageBoxA(genDll.m_hWinamp, str, "Fatal Error!", MB_ICONERROR);
#ifdef _DEBUG
			DebugBreak();
#endif
			PostQuitMessage(-1);
			}
	}

	m_hWnd = CreateWindowA(TABLECLASS, 0, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_VSCROLL, rect.left, rect.top, 
rect.right - rect.left + 1, rect.bottom - rect.top + 1, hParent, NULL, genDll.m_hInstance, NULL);

	if (m_hWnd == 0)
	{
		DWORD dwError = GetLastError();
		char str[20];
		sprintf(str, "Error 0x%x", dwError);
		MessageBoxA(genDll.m_hWinamp, str, "Fatal Error!", MB_ICONERROR);
#ifdef _DEBUG
		DebugBreak();
#endif
		PostQuitMessage(-1);
	}

	GetClientRect(m_hWnd, &m_rClient);
	m_nVBarPos = nVBarPos;

	SetWindowLongPtrW(m_hWnd, GWL_USERDATA, (LONG_PTR)this);
	EnableScrollBar(m_hWnd, SB_VERT, ESB_DISABLE_BOTH);
	
	m_hFont = hFont;
	m_nLineHeight = nLineHeight;
	AddLine();
}
Beispiel #3
0
void CButtonBar::Create(HWND hParent, const RECT &rect)
{
	WNDCLASSA wndclass;
	if (FALSE == GetClassInfoA(genDll.m_hInstance, CLASSNAME, &wndclass))
	{
		memset(&wndclass, 0, sizeof(wndclass));
		wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
		wndclass.hInstance = genDll.m_hInstance;
		wndclass.lpfnWndProc = WindowProc;
		wndclass.lpszClassName = CLASSNAME;
		wndclass.lpszMenuName = 0;
		wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_SAVEBITS;

		if (false == RegisterClassA(&wndclass))
		{
			DWORD dwError = GetLastError();
			char str[30];
			sprintf_s(str, 30, "Error 0x%x", dwError);
			MessageBoxA(hParent, str, "Fatal Error!", MB_ICONERROR);
#ifdef _DEBUG
			DebugBreak();
#endif
			PostQuitMessage(-1);
		}
	}

		m_hWnd = CreateWindowA(CLASSNAME, "", WS_CHILD | WS_VISIBLE, rect.left, rect.top, 
			rect.right - rect.left + 1, rect.bottom - rect.top + 1, hParent, 0, genDll.m_hInstance, 0);
		if (m_hWnd == 0)
		{
			DWORD dwError = GetLastError();
			char str[30];
			sprintf_s(str, 30, "Error 0x%x", dwError);
			MessageBoxA(hParent, str, "Fatal Error!", MB_ICONERROR);
#ifdef _DEBUG
			DebugBreak();
#endif
			PostQuitMessage(-1);
		}

		GetClientRect(m_hWnd, &m_rClient);

		m_hbFBack = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FBACK));
		m_hbFFar = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FFAR));
		m_hbPlay = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PLAY));
		m_hbPause = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PAUSE));
		m_hbStop = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_STOP));

		m_hbFBack2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FBACK2));
		m_hbFFar2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FFAR2));
		m_hbPlay2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PLAY2));
		m_hbPause2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PAUSE2));
		m_hbStop2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_STOP2));

		SetWindowLongPtrA(m_hWnd, GWL_USERDATA, (LONG_PTR)this);
}
Beispiel #4
0
//--------------------------------------------------------------------------
void WindowsVideoDevice::UnregisterApp() noexcept
{
	if (!m_i32AppRegistered)
		return;
	--m_i32AppRegistered;
	if (m_i32AppRegistered <= 0)
	{
		WNDCLASSA kClass;
		if (GetClassInfoA(m_hInstance, m_kAppName, &kClass))
		{
			UnregisterClassA(m_kAppName, m_hInstance);
		}
		m_i32AppRegistered = 0;
		m_kAppName = "";
		m_u32AppStyle = 0;
		m_hInstance = nullptr;
	}
}
Beispiel #5
0
void Test_RealGetWindowClass()
{
    int testNo;
    UINT Result;
    CHAR Buffer[1024];

    Result = RealGetWindowClass( NULL, Buffer, ARRAY_SIZE(Buffer) );
    ok(Result == 0, "Result = %d\n", Result);
    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "GetLastError() = %ld\n", GetLastError());

    for (testNo = 0; testNo < ARRAY_SIZE(RealClassTestData); testNo++)
    {
        ATOM atom;
        WNDCLASSA cls;
        HWND hWnd;

        /* Register classes, "derived" from built-in dialog, with and without the DLGWINDOWEXTRA flag set */
        GetClassInfoA(0, "#32770", &cls);
        if (RealClassTestData[testNo].OverrideWndProc)
            cls.lpfnWndProc = DefWindowProcA;
        cls.lpszClassName = RealClassTestData[testNo].ClassName;
        cls.cbWndExtra &= ~RealClassTestData[testNo].WndExtra;
        atom = RegisterClassA (&cls);
        if (atom == 0) return;

        /* Create a window */
        hWnd = CreateWindowEx( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR |
                               WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT | WS_EX_APPWINDOW,
                               RealClassTestData[testNo].ClassName,
                               RealClassTestData[testNo].ClassName,
                               WS_POPUPWINDOW | WS_CLIPSIBLINGS | WS_DLGFRAME | WS_OVERLAPPED |
                               WS_MINIMIZEBOX | WS_MAXIMIZEBOX | DS_3DLOOK | DS_SETFONT | DS_MODALFRAME,
                               CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
                               NULL, NULL, 0, 0);

        /* Do we expect a HWND at all? */
        if (RealClassTestData[testNo].ExpectsHwnd)
        {
            ok(hWnd != NULL, "\n");

            if (hWnd != NULL)
            {
                /* Get the "real" class name */
                Result = RealGetWindowClass( hWnd, Buffer, ARRAY_SIZE(Buffer) );
                printf("Buffer: %s\nExpectedClassNameBefore(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameBefore);
                ok( Result != 0, "\n" );
                ok( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameBefore ) == 0, "\n" );

                /* Call a function that requires a dialog window */
                DefDlgProcA( hWnd, DM_SETDEFID, IDCANCEL, 0 );

                /* Get the "real" class name again */
                Result = RealGetWindowClass( hWnd, Buffer, ARRAY_SIZE(Buffer) );
                printf("Buffer: %s\nExpectedClassNameAfter(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameAfter);
                ok( Result != 0, "\n" );
                ok( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameAfter ) == 0, "\n" );
            }
        }
        else
        {
            ok(hWnd == NULL, "\n");
        }

        /* Cleanup */
        DestroyWindow(hWnd);
        UnregisterClass(RealClassTestData[testNo].ClassName, 0);
    }

}