Esempio n. 1
0
HDDEDATA PASCAL _Cover_DdeClientTransaction( LPBYTE lpvdata,
                                             DWORD cbdata,
                                             HCONV hconv,
                                             HSZ hszitem,
                                             WORD ufmt,
                                             WORD utype,
                                             DWORD utimeout,
                                             LPDWORD lpuresult )
{
    HDDEDATA    rc;
    DWORD       pdata;
    DWORD       presult;

    pdata = (DWORD)lpvdata;
    if( cbdata != -1L ) {
        if( pdata != 0 ) {
            pdata = AllocAlias16( lpvdata );
        }
    }
    presult = (DWORD)lpuresult;
    if( presult != 0 ) {
        presult = AllocAlias16( lpuresult );
    }
    rc = _16DdeClientTransaction( (LPBYTE)pdata, cbdata, hconv, hszitem,
                                  ufmt, utype, utimeout, (LPDWORD)presult );
    if( cbdata != -1L ) {
        if( pdata != 0 ) {
            FreeAlias16( pdata );
        }
    }
    if( presult != 0 ) {
        FreeAlias16( presult );
    }
    return( rc );
}
Esempio n. 2
0
HWND MdiOpenIcon()
{
    FILEOPEN            of;
    char                filename[ _MAX_PATH ];
    char                title[ _MAX_PATH ];
    char                ext[16];
    FILE                *fp;
    HWND                hwnd;
    HANDLE              dll;
#if defined(__WINDOWS_386__)
    HINDIR              h;
#else
    BOOL                (PASCAL FAR *gsn)( LPFILEOPEN );
#endif
    FARPROC             farp;
    DWORD               a1,a2;
    BOOL                rc;

    dll = LoadLibrary( "filedll.dll" );
    if( dll < 32 ) {
        MessageBox( NULL, "Could not find filedll.dll!", "Icon Viewer", MB_OK );
        return( FALSE );
    }
    farp = (FARPROC) GetProcAddress( dll,"GetFileName" );
#if defined(__WINDOWS_386__)
    h = GetIndirectFunctionHandle( farp, INDIR_PTR, INDIR_ENDLIST );
#else
    gsn = (void FAR *) farp;
#endif

    filename[ 0 ] = '\0';
    of.hwnd = FrameWindow;
    a1 = AllocAlias16( "*.ico" );
    of.ext = (LPSTR) a1;
    a2 = AllocAlias16( filename );
    of.name = (LPSTR) a2;
    of.namelen = sizeof( filename );
    of.type = FILE_OPEN;
    of.title = NULL;
#if defined(__WINDOWS_386__)
    rc = InvokeIndirectFunction( h, &of );
#else
    rc = gsn( &of );
#endif
    if( rc ) {
        _splitpath( filename, NULL, NULL, title, ext );
        strcat( title, ext );
        fp = fopen( filename, "rb" );
        hwnd = MdiReadIcon( fp, title, filename, WS_ICONIC );
        ShowWindow( hwnd, SW_SHOWMINIMIZED );
        UpdateWindow( hwnd );
        fclose( fp );
    }
    FreeAlias16( a1 );
    FreeAlias16( a2 );
    FreeLibrary( dll );
    return( hwnd );

} /* MdiIconOpen */
Esempio n. 3
0
void main()
{
    union REGS regs;
    struct SREGS sregs;
    DWORD mi_16;

    regs.w.ax = 0x0500;
    mi_16 = AllocAlias16( &MemInfo );
    sregs.ds = 0;
    sregs.es = HIWORD( mi_16 );
    regs.x.di = LOWORD( mi_16 );

    int86x( DPMI_INT, &regs, &regs, &sregs );
    printf( "Largest available block (in bytes): %ld\n",
            MemInfo.LargestBlockAvail );
    printf( "Maximum unlocked page allocation: %lu\n",
            MemInfo.MaxUnlockedPage );
    printf( "Pages that can be allocated and locked: %lu\n",
            MemInfo.LargestLockablePage );
    printf( "Total linear address space including allocated"
            " pages: %lu\n", MemInfo.LinAddrSpace );
    printf( "Number of free pages available: %lu\n",
             MemInfo.NumFreePagesAvail );
    printf( "Number of physical pages not in use: %lu\n",
             MemInfo.NumPhysicalPagesFree );
    printf( "Total physical pages managed by host: %lu\n",
             MemInfo.TotalPhysicalPages );
    printf( "Free linear address space (pages): %lu\n",
             MemInfo.FreeLinAddrSpace );
    printf( "Size of paging/file partition (pages): %lu\n",
             MemInfo.SizeOfPageFile );
    FreeAlias16( mi_16 );
}
Esempio n. 4
0
bool GUIGetRGBFromUser( gui_rgb init_rgb, gui_rgb *new_rgb )
{
#ifdef __OS2_PM__
    init_rgb = init_rgb;
    new_rgb = new_rgb;
    return( false );
#else
    CHOOSECOLOR     choose;
    bool            ret;
#if defined(__WINDOWS__)
    HINSTANCE       h;
    FARPROC         func;
#ifdef __WINDOWS_386__
    HINDIR          hIndir;
    DWORD           guiColoursAlias;
#endif
#endif

    if( new_rgb == NULL ) {
        return( false );
    }
    memset( &choose, 0, sizeof( CHOOSECOLOR ) );
    choose.Flags = CC_PREVENTFULLOPEN;
    choose.hInstance = (HWND)GUIMainHInst;
    choose.Flags |= CC_RGBINIT;
    choose.rgbResult = GETRGB( init_rgb );
#ifndef __WINDOWS_386__
    choose.lpCustColors = GUIColours;
#endif
    choose.lStructSize = sizeof( CHOOSECOLOR );

#if defined(__NT__)
    ret = ( ChooseColor( &choose ) != 0 );
#else
    h = LoadLibrary( "COMMDLG.DLL" );
    if( (UINT)h < 32 ) {
        return( false );
    }
    func = GetProcAddress( h, "ChooseColor" );
    if( func == NULL ) {
        return( false );
    }
#ifdef __WINDOWS_386__
    hIndir = GetIndirectFunctionHandle( func, INDIR_PTR, INDIR_ENDLIST );
    if( hIndir == NULL ) {
        FreeLibrary( h );
        return( false );
    }
    guiColoursAlias = AllocAlias16( (void *)GUIColours );
    choose.lpCustColors = (void *)guiColoursAlias;
    ret = (short)InvokeIndirectFunction( hIndir, &choose ) != 0;
    if( guiColoursAlias != NULL ) {
        FreeAlias16( guiColoursAlias );
    }
#else
    ret = ((BOOL(WINAPI *)(LPCHOOSECOLOR))func)( &choose ) != 0;
#endif
    FreeLibrary( h );
#endif
    if( ret ) {
        FillInRGB( choose.rgbResult, new_rgb );
    }
    return( ret );
#endif
}
Esempio n. 5
0
bool GUIChooseFont( HFONT font, LOGFONT *lf, HWND hwnd )
{
#ifdef __OS2_PM__
    hwnd = hwnd;
    lf = lf;
    font = font;
    return( false );
#else
    CHOOSEFONT  cf;
    bool        ret;
#if defined(__WINDOWS__)
    HINSTANCE   h;
    FARPROC     func;
#ifdef __WINDOWS_386__
    HINDIR      hIndir;
    DWORD       lfAlias;
#endif
#endif

    memset( &cf, 0, sizeof( CHOOSEFONT ) );

    cf.Flags = CF_SCREENFONTS;
    if( font != NULL ) {
        GetObject( font, sizeof( LOGFONT ), (LPSTR) lf );
        cf.Flags |= CF_INITTOLOGFONTSTRUCT;
    }

#ifndef __WINDOWS_386__
    cf.lpLogFont = lf;
#endif
    cf.lStructSize = sizeof( CHOOSEFONT );
    cf.hwndOwner = hwnd;

#if defined(__NT__)
    ret = ChooseFont( &cf ) != 0;
#else
    h = LoadLibrary( "COMMDLG.DLL" );
    if( (UINT)h < 32 ) {
        return( false );
    }
    func = GetProcAddress( h, "ChooseFont" );
    if( func == NULL ) {
        return( false );
    }
#ifdef __WINDOWS_386__
    hIndir = GetIndirectFunctionHandle( func, INDIR_PTR, INDIR_ENDLIST );
    if( hIndir == NULL ) {
        FreeLibrary( h );
        return( false );
    }
    lfAlias = AllocAlias16( (void *)lf );
    cf.lpLogFont = (LOGFONT *) lfAlias;
    ret = (short)InvokeIndirectFunction( hIndir, &cf ) != 0;
    if( lfAlias != NULL ) {
        FreeAlias16( lfAlias );
    }
#else
    ret = ((BOOL(WINAPI *)(LPCHOOSEFONT))func)( &cf ) != 0;
#endif
    FreeLibrary( h );
#endif
    return( ret );
#endif
}