Exemplo n.º 1
0
VOID PumpMessageQueue( VOID )
{
    char        class_name[80];
    QMSG        qmsg;
    ERRORID     err;
    ULONG       ulCount;

    for( ;; ) {
        DosWaitEventSem( PumpMessageSem, SEM_INDEFINITE_WAIT );
        DosResetEventSem( PumpMessageSem, &ulCount );
        WinThreadAssocQueue( GUIGetHAB(), GUIPMmq );
        while ( WinGetMsg( GUIGetHAB(), &qmsg, 0L, 0, 0 ) ) {
            WinQueryClassName( qmsg.hwnd, sizeof( class_name ), class_name );
            if (strcmp( class_name, "GUIClass" ) == 0 ||
                strcmp( class_name, "WTool" ) == 0) {
                WinDefWindowProc( qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2 );
            } else {
                WinDispatchMsg( GUIGetHAB(), &qmsg );
            }
        }
        WinThreadAssocQueue( GUIGetHAB(), NULL );
        err = WinGetLastError( GUIGetHAB() );
        DosPostEventSem( PumpMessageDoneSem );
    }
}
Exemplo n.º 2
0
size_t GetSystemDir( char *buff, size_t buff_len )
/************************************************/
{
    // inst
    PRFPROFILE                  prof;
    size_t                      i;

    prof.cchUserName = 0L;
    prof.cchSysName = 0L;

    i = 0;
    if( PrfQueryProfile( GUIGetHAB(), &prof ) ) {
        if( prof.cchSysName > 0 ) {
            _AllocA( prof.pszSysName, prof.cchSysName );
            _AllocA( prof.pszUserName, prof.cchUserName );
            PrfQueryProfile( GUIGetHAB(), &prof );
        }

        if( buff_len > prof.cchSysName )
            buff_len = prof.cchSysName;
        memcpy( buff, prof.pszSysName, buff_len );
        if( buff_len > 0 )
            i = --buff_len;     // reserve space for terminating null character
        while( i > 0 ) {
            if( buff[--i] == '\\' ) {
                break;
            }
        }
    }
    buff[i] = NULLCHAR;
    return( strlen( buff ) );
} /* _wpi_getinidirectory */
Exemplo n.º 3
0
bool DebugScreen( void )
{
    if( !WndMain ) return( FALSE );
    if( FocusWnd && WinIsWindow( GUIGetHAB(), FocusWnd ) &&
        FocusWnd != WinQueryFocus( HWND_DESKTOP, 0 ) ) {
        WinSetFocus( HWND_DESKTOP, FocusWnd );
    }
    if( ActiveWnd && WinIsWindow( GUIGetHAB(), ActiveWnd ) &&
        ActiveWnd != WinQueryActiveWindow( HWND_DESKTOP, 0 ) ) {
        WinSetActiveWindow( HWND_DESKTOP, ActiveWnd );
    }
    return( FALSE );
}
Exemplo n.º 4
0
void TellWinHandle( void )
{
    if( !ToldWinHandle ) {
        TellHandles( GUIGetHAB(), GUIGetSysHandle( WndGui( WndMain ) ) );
        ToldWinHandle = TRUE;
    }
}
Exemplo n.º 5
0
unsigned GetSystemDir( char *buff, int max )
/***********************************************/
{
    // inst
    PRFPROFILE                  prof;
    int                         i;
    char                        c;
    int                         len;

    prof.cchUserName = 0L;
    prof.cchSysName = 0L;

    if( PrfQueryProfile( GUIGetHAB(), &prof ) ) {
        if( prof.cchSysName > 0 ) {
            _AllocA( prof.pszSysName, prof.cchSysName );
            _AllocA( prof.pszUserName, prof.cchUserName );
            PrfQueryProfile( GUIGetHAB(), &prof );
        }

        strcpy( buff, prof.pszSysName );
        if( prof.cchSysName <= max ) {
            len = prof.cchSysName;
        } else {
            len = max;
        }

        for( i = len - 1; i >= 0; i-- ) {
            c = buff[i];
            buff[i] = '\0';
            if( c == '\\' ) {
                break;
            }
        }
    } else {
        buff[0] = '\0';
    }
    return( strlen( buff ) );
} /* _wpi_getinidirectory */
Exemplo n.º 6
0
void TellWinHandle( void )
{
    if( !ToldWinHandle && TrapTellHandles( GUIGetHAB(), GUIGetSysHandle( WndGui( WndMain ) ) ) ) {
        ToldWinHandle = true;
    }
}