Beispiel #1
0
int GUIAPI DispatchMessage (PMSG pMsg)
{
    WNDPROC WndProc;
#ifndef _LITE_VERSION
    PSYNCMSG pSyncMsg;
#endif
    int iRet;

#ifdef _TRACE_MSG
    fprintf (stderr, "Message, %s: hWnd: %x, wP: %x, lP: %lx. %s\n",
        Message2Str (pMsg->message),
        pMsg->hwnd,
        pMsg->wParam,
        pMsg->lParam,
        SYNMSGNAME);
#endif

    if (pMsg->hwnd == HWND_INVALID) {
#ifndef _LITE_VERSION
        if (pMsg->pAdd) {
            pSyncMsg = (PSYNCMSG)pMsg->pAdd;
            pSyncMsg->retval = ERR_MSG_CANCELED;
            sem_post (pSyncMsg->sem_handle);
        }
#endif
        
#ifdef _TRACE_MSG
        fprintf (stderr, "Message have been thrown away: %s\n",
            Message2Str (pMsg->message));
#endif
        return -1;
    }

    if (pMsg->hwnd == 0)
        return -1;

    if (!(WndProc = GetWndProc (pMsg->hwnd)))
        return -1;

    iRet = (*WndProc)(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);

#ifndef _LITE_VERSION
    /* this is a sync message. */
    if (pMsg->pAdd) {
        pSyncMsg = (PSYNCMSG)pMsg->pAdd;
        pSyncMsg->retval = iRet;
        sem_post (pSyncMsg->sem_handle);
    }
#endif

#ifdef _TRACE_MSG
    fprintf (stderr, "Message, %s done, return value: %x\n",
        Message2Str (pMsg->message), iRet);
#endif

    return iRet;
}
Beispiel #2
0
int GUIAPI SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
{
    WNDPROC WndProc;
    
    MG_CHECK_RET (MG_IS_WINDOW(hWnd), -1);

    if ( !(WndProc = GetWndProc(hWnd)) )
        return -1;

    return (*WndProc)(hWnd, iMsg, wParam, lParam);
}
Beispiel #3
0
bool FileCompleteWindowInit( void )
{
    WNDCLASS        wc;

    wc.style = CS_DBLCLKS;
    wc.lpfnWndProc = GetWndProc( FileCompleteWindowProc );
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof( LONG_PTR );
    wc.hInstance = InstanceHandle;
    wc.hIcon = LoadIcon( (HINSTANCE)NULLHANDLE, IDI_APPLICATION );
    wc.hCursor = LoadCursor( (HINSTANCE)NULLHANDLE, IDC_ARROW );
    wc.hbrBackground = (HBRUSH) COLOR_APPWORKSPACE;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = ClassName;
    return( RegisterClass( &wc ) != 0 );
}
Beispiel #4
0
/*
 * RegPushWin - register the push window class
 */
bool RegPushWin( HANDLE instance )
{
    WNDCLASS    wc;

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = GetWndProc( PushWinProc );
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof( LONG_PTR );
    wc.hInstance = instance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor( NULL, IDC_ARROW );
    wc.hbrBackground = (HBRUSH)(pointer_int)(COLOR_WINDOW + 1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = "PushWin";
    return( RegisterClass( &wc ) != 0 );

} /* RegPushWin */
Beispiel #5
0
/*
 * RegisterMainWindow - register the main (root) window class
 */
bool RegisterMainWindow( HANDLE inst )
{
    WNDCLASS    wc;

    wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = GetWndProc( MainWindowProc );
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = inst;
    wc.hIcon = LoadIcon( inst, "APPLICON" );
    wc.hCursor = LoadCursor( (HINSTANCE)NULLHANDLE, IDC_ARROW );
    wc.hbrBackground = 0;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = EditorName;
    return( RegisterClass( &wc ) != 0 );

} /* RegisterMainWindow */
Beispiel #6
0
/*
 * RegMemWndClass - must be called by the first instance of a using
 *                  program to register window classes
 */
bool RegMemWndClass( HANDLE instance )
{
    WNDCLASS    wc;

    wc.style = 0L;
    wc.lpfnWndProc = GetWndProc( MemDisplayProc );
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof( LONG_PTR );
    wc.hInstance = instance;
    wc.hIcon = NULLHANDLE;
    wc.hCursor = LoadCursor( NULLHANDLE, IDC_ARROW );
    wc.hbrBackground = (HBRUSH)(pointer_int)(COLOR_WINDOW + 1);
    wc.lpszMenuName = "MEMINFOMENU";
    wc.lpszClassName = MEM_DISPLAY_CLASS;
    return( RegisterClass( &wc ) != 0 );

} /* RegMemWndClass */
Beispiel #7
0
int GUIAPI SendMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
{
    WNDPROC WndProc;

    MG_CHECK_RET (MG_IS_WINDOW(hWnd), -1);

#ifndef _LITE_VERSION
    if (!BE_THIS_THREAD(hWnd))
        return SendSyncMessage (hWnd, iMsg, wParam, lParam);
#endif /* !_LITE_VERSION */
    
    if ( !(WndProc = GetWndProc(hWnd)) )
        return ERR_INV_HWND;

    return (*WndProc)(hWnd, iMsg, wParam, lParam);

}
Beispiel #8
0
/*
 * RegisterSnapClass - register the window class used to display the desktop
 */
bool RegisterSnapClass( HANDLE instance )
{
    WNDCLASS    wc;

    thisInstance = instance;
    wc.style = 0L;
    wc.lpfnWndProc = GetWndProc( DesktopProc );
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = thisInstance;
    wc.hIcon = (HICON)NULL;
    wc.hCursor = (HCURSOR)NULL;
    wc.hbrBackground = (HBRUSH)NULL;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = "SnapClass";
    return( RegisterClass( &wc ) != 0 );

} /* RegisterSnapClass */
Beispiel #9
0
bool MessageBarInit( void )
{
    WNDCLASS        wc;

    msgString1[0] = '\0';
    msgString2[0] = '\0';

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = GetWndProc( MessageWindowProc );
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof( LONG_PTR );
    wc.hInstance = InstanceHandle;
    wc.hIcon = LoadIcon( (HINSTANCE)NULLHANDLE, IDI_APPLICATION );
    wc.hCursor = LoadCursor( (HINSTANCE)NULLHANDLE, IDC_ARROW );
    wc.hbrBackground = (HBRUSH) COLOR_APPWORKSPACE;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = ClassName;
    return( RegisterClass( &wc ) != 0 );
}
Beispiel #10
0
void InitClrPick( void )
{
    WNDCLASS    wndclass;

    if( GetClassInfo( InstanceHandle, "ClrPick", &wndclass ) ) {
        return;
    }

    wndclass.style          = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc    = GetWndProc( ClrPickProc );
    wndclass.cbClsExtra     = 0;
    wndclass.cbWndExtra     = 0;
    wndclass.hInstance      = InstanceHandle;
    wndclass.hIcon          = (HICON)NULLHANDLE;
    wndclass.hCursor        = LoadCursor( (HINSTANCE)NULLHANDLE, IDC_ARROW );
    wndclass.hbrBackground  = (HBRUSH)COLOR_APPWORKSPACE;
    wndclass.lpszMenuName   = NULL;
    wndclass.lpszClassName  = "ClrPick";

    RegisterClass( &wndclass );
}
Beispiel #11
0
/*
 * StatusWndInit - initialize for using the status window
 */
bool StatusWndInit( WPI_INST hinstance, statushook hook, int extra, HCURSOR hDefaultCursor )
{
    bool        rc;
#ifdef __OS2_PM__
    /* OS/2 PM version of the initialization */

    colorButtonFace = CLR_PALEGRAY;

    if( !hasGDIObjects ) {
        brushButtonFace = _wpi_createsolidbrush( colorButtonFace );
        penLight = _wpi_createpen( PS_SOLID, 1, CLR_WHITE );
        penShade = _wpi_createpen( PS_SOLID, 1, CLR_DARKGRAY );
        hasGDIObjects = true;
    }

    statusWndHookFunc = hook;

    rc = true;
    if( !classRegistered ) {
        memcpy( &classHandle, &hinstance, sizeof( WPI_INST ) );
        rc = WinRegisterClass( hinstance.hab, className, (PFNWP)StatusWndCallback,
                               CS_SIZEREDRAW | CS_CLIPSIBLINGS,
                               extra + sizeof( statwnd * ) );
        classWinExtra = extra;
        classRegistered = true;
    }
#else
    /* Win16 and Win32 version of the initialization */
    WNDCLASS    wc;

  #ifdef __NT__
    if( LoadCommCtrl() ) {
        rc = true;
    } else {
  #endif
        if( !hasGDIObjects ) {
            colorButtonFace = GetSysColor( COLOR_BTNFACE );
            colorTextFace = GetSysColor( COLOR_BTNTEXT );
            brushButtonFace = CreateSolidBrush( colorButtonFace );
            penLight = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) );
            penShade = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) );
            hasGDIObjects = true;
        }

        statusWndHookFunc = hook;

        rc = true;
        if( !GetClassInfo( hinstance, className, &wc ) ) {
            classHandle = hinstance;
            classWinExtra = extra;
            wc.style = CS_HREDRAW | CS_VREDRAW;
            wc.lpfnWndProc = GetWndProc( StatusWndCallback );
            wc.cbClsExtra = 0;
            wc.cbWndExtra = extra + sizeof( statwnd * );
            wc.hInstance = hinstance;
            wc.hIcon = LoadIcon( (HINSTANCE)NULL, IDI_APPLICATION );
            wc.hCursor = hDefaultCursor;
            if( wc.hCursor == NULL ) {
                wc.hCursor = LoadCursor( (HINSTANCE)NULL, IDC_ARROW );
            }
            wc.hbrBackground = (HBRUSH)0;
            wc.lpszMenuName = NULL;
            wc.lpszClassName = className;
            rc = ( RegisterClass( &wc ) != 0 );
            classRegistered = true;
        }
  #ifdef __NT__
    }
  #endif
#endif
    return( rc );

} /* StatusWndInit */