コード例 #1
0
ファイル: wdefmenu.c プロジェクト: Ukusbobra/open-watcom-v2
void WdeSetDialogObjectMenu ( Bool restorable, Bool res_has_hash, WdeOrderMode mode )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();

    if( WdeLastObject != DIALOG || WdeLastDlgRestorable != restorable ||
        mode != WdeLastOrderMode ) {

        WdeSetDialogObjectDialogMenu( menu, i, restorable, res_has_hash, mode );
        WdeEnableAllMenuItems( GetSubMenu( menu, EDIT_MENU + i ), TRUE );
        WdeLastObject = DIALOG;
        WdeLastDlgRestorable = restorable;
    }

    WdeEnableSelectDialogItem( menu );
    WdeEnableAlignTools( menu, i );
    //WdeEnableTest( menu, mode == WdeSelect );
    //WdeEnableGotoMenu( menu );

#if 0
    DrawMenuBar( WdeGetMainWindowHandle() );
#endif
}
コード例 #2
0
ファイル: wdefmenu.c プロジェクト: Ukusbobra/open-watcom-v2
void WdeSetBaseObjectMenu( Bool has_hash )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();

    if( WdeLastObject != BASE ) {
        WdeEnableAllMenuItems( GetSubMenu( menu, EDIT_MENU + i ), FALSE );
        EnableMenuItem( menu, IDM_OPTIONS, MF_ENABLED | MF_BYCOMMAND );

        WdeEnableAllMenuItems( GetSubMenu( menu, DIALOG_MENU + i ), FALSE );
        EnableMenuItem( menu, IDM_DIALOG_NEW, MF_ENABLED | MF_BYCOMMAND );

        if( has_hash ) {
            EnableMenuItem( menu, IDM_WRITE_SYMBOLS, MF_ENABLED | MF_BYCOMMAND );
        } else {
            EnableMenuItem( menu, IDM_WRITE_SYMBOLS, MF_GRAYED | MF_BYCOMMAND );
        }

        WdeLastObject = BASE;
    }

    WdeEnableSelectDialogItem( menu );
    //WdeEnableGotoMenu( menu );

    menu = GetSubMenu( menu, EDIT_MENU + i );
    EnableMenuItem( menu, SYMBOLS_SUBMENU, MF_ENABLED | MF_BYPOSITION );

#if 0
    DrawMenuBar( WdeGetMainWindowHandle() );
#endif
}
コード例 #3
0
bool WdeDisplayOptions( void )
{
    HWND      dialog_owner;
    DLGPROC   dlgproc;
    HINSTANCE app_inst;
    INT_PTR   modified;

    WdeSetStatusText( NULL, " ", false );
    WdeSetStatusByID( WDE_DISPLAYOPTIONS, 0 );

    dialog_owner = WdeGetMainWindowHandle();
    app_inst = WdeGetAppInstance();
    dlgproc = MakeProcInstance_DLG( WdeOptionsDlgProc, app_inst );
    modified = JDialogBoxParam( app_inst, "WdeOptions", dialog_owner, dlgproc, (LPARAM)NULL );
    FreeProcInstance_DLG( dlgproc );

    if( modified == -1 ) {
        WdeWriteTrail( "WdeDisplayOptions: Dialog not created!" );
        return( FALSE );
    }

    WdeSetStatusReadyText();

    return( TRUE );
}
コード例 #4
0
ファイル: wdecust.c プロジェクト: jossk/open-watcom-v2
Bool WdeSetCurrentCustControl( int which )
{
    int       ret;
    HINSTANCE inst;
    FARPROC   proc;

    if( WdeCustomLibList == NULL ) {
        WdeSetStatusByID( -1, WDE_NOCUSTLOADED );
        return( TRUE );
    }

    if( !WDE_CHECK_WHICH( which ) ) {
        WdeWriteTrail( "WdeSetCurrentCustControl: bad which!" );
        return( FALSE );
    }

    inst = WdeGetAppInstance();
    proc = MakeProcInstance( (FARPROC)WdeSelectCustProc, inst );
    if( proc == NULL ) {
        WdeWriteTrail( "WdeSetCurrentCustomControl: MakeProcInstance failed!" );
        return( FALSE );
    }
    ret = JDialogBoxParam( inst, "WdeSelectCustom", WdeGetMainWindowHandle(),
                           (DLGPROC)proc, (LPARAM)(LPVOID)&which );
    FreeProcInstance( proc );

    /* if the window could not be created return FALSE */
    if( ret == -1 ) {
        WdeWriteTrail( "WdeSetCurrentCustomControl: Could not create selection window!" );
        return( FALSE );
    }

    return( TRUE );
}
コード例 #5
0
static Bool WdeQueryClearRes( void )
{
    int         ret;
    UINT        style;
    char        *title;
    char        *text;

    style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
    title = WdeAllocRCString( WDE_CLEARTITLE );
    text = WdeAllocRCString( WDE_CLEARMSG );

    ret = MessageBox( WdeGetMainWindowHandle(), text, title, style );
    if( ret == IDYES ) {
        return( TRUE );
    }

    if( title ) {
        WdeFreeRCString( title );
    }
    if( text ) {
        WdeFreeRCString( text );
    }

    return( FALSE );
}
コード例 #6
0
ファイル: wdecust.c プロジェクト: bhanug/open-watcom-v2
BOOL WdeLoadMSCustomControls( WdeCustLib *lib )
{
    WdeCustInfoProc  info_proc;
    WdeCustStyleProc style_proc;
    WdeCustFlagsProc flags_proc;
    HWND             dialog_owner;
    FARPROC          proc_inst;
    HINSTANCE        app_inst;
    INT_PTR          ok;

    dialog_owner = WdeGetMainWindowHandle();
    app_inst = WdeGetAppInstance();
    proc_inst = MakeProcInstance ( (FARPROC)WdeLoadCustProc, app_inst );
    ok = JDialogBoxParam( app_inst, "WdeLoadCustom", dialog_owner,
                          (DLGPROC)proc_inst, (LPARAM)(LPVOID)lib );
    FreeProcInstance ( proc_inst );

    if( ok == -1 ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: Dialog not created!" );
        return( FALSE );
    }

    if( !ok ) {
        return( FALSE );
    }

    if( !HIWORD( (uint_32)lib->info_name ) ) {
        if( !WdeQueryUnsafeMSLoad() ) {
            WdeWriteTrail( "WdeLoadMSCustomControls: User aborted unsafe load!" );
            return( FALSE );
        }
    }

    info_proc = (WdeCustInfoProc)GetProcAddress( lib->inst, lib->info_name );
    style_proc = (WdeCustStyleProc)GetProcAddress ( lib->inst, lib->style_name );
    flags_proc = (WdeCustFlagsProc)GetProcAddress ( lib->inst, lib->flags_name );

    if( info_proc == NULL || style_proc == NULL || flags_proc == NULL ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: Could not get proc address of ordinal!" );
        return( FALSE );
    }

    if( !WdeCreateAndAddCustControl( lib, info_proc, style_proc, flags_proc ) ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: Control not added to list!" );
        return( FALSE );
    }

    WRMemValidate( lib );

    return( TRUE );
}
コード例 #7
0
WRFileType WdeSelectFileType( char *name, bool is32bit )
{
    WRFileType      file_type;
    HWND            parent;
    bool            use_wres;
    HELP_CALLBACK   hcb;

    hcb = (HELP_CALLBACK)MakeProcInstance( (FARPROC)WdeHelpRoutine, WdeGetAppInstance() );
    use_wres = WdeGetOption( WdeOptIsWResFmt );
    parent  = WdeGetMainWindowHandle();
    file_type = WRSelectFileType( parent, name, is32bit, use_wres, hcb );
    FreeProcInstance( (FARPROC)hcb );

    return( file_type );
}
コード例 #8
0
void WdeHandlePokedData( HDDEDATA hdata )
{
    HWND        main;
    char        *cmd;
    WdeResInfo  *rinfo;

    if( hdata == (HDDEDATA)NULL ) {
        return;
    }

    cmd = (char *)WdeHData2Mem( hdata );
    if( cmd == NULL ) {
        return;
    }

    main = WdeGetMainWindowHandle();

    if( stricmp( cmd, "show" ) == 0 ) {
        ShowWindow( main, SW_RESTORE );
        ShowWindow( main, SW_SHOWNA );
    } else if( stricmp( cmd, "hide" ) == 0 ) {
        ShowWindow( main, SW_SHOWMINNOACTIVE );
        ShowWindow( main, SW_HIDE );
    } else if( stricmp( cmd, "endsession" ) == 0 ) {
        if( GotEndSession == FALSE ) {
            GotEndSession = TRUE;
            rinfo = WdeGetCurrentRes();
            WdeDestroyResourceWindow( rinfo );
        }
    } else if( stricmp( cmd, "bringtofront" ) == 0 ) {
        if( IsIconic( main ) ) {
            ShowWindow( main, SW_RESTORE );
        }
#ifdef __NT__
        SetWindowPos( main, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
        SetWindowPos( main, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
        SetWindowPos( main, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
        SetForegroundWindow( main );
#else
        SetActiveWindow( main );
        SetWindowPos( main, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
#endif
    }

    WRMemFree( cmd );
}
コード例 #9
0
bool WdeHandleTestModeMenu( WdeResInfo *info )
{
    HWND   main_window;
    bool   ret;

    if( info == NULL ) {
        return( FALSE );
    }

    main_window = WdeGetMainWindowHandle();

    if( WdeTestMode ) {
        WdeTestMode = FALSE;
        if( WdeTestDialogHandle != NULL ) {
            DestroyWindow( WdeTestDialogHandle );
        }
        WdeSetTestModeMenu( FALSE );
        WdeSetStatusReadyText();
        WdeShowResourceWindows( SW_SHOWNA );
        if( WdeTestResource != NULL ) {
            //InitState( WdeTestResource->forms_win );
            //SendMessage( WdeTestResource->res_win, WM_MDIRESTORE, 0, 0 );
            WdeTestResource = NULL;
        }
        ret = TRUE;
    } else {
        WdeSetStatusText( NULL, "", FALSE );
        WdeSetStatusByID( WDE_TESTMODE, -1 );
        ret = WdeTestCurrentObject();
        if( ret ) {
            WdeShowResourceWindows( SW_HIDE );
            WdeSetTestModeMenu( TRUE );
            WdeTestMode = TRUE;
            WdeTestResource = info;
        } else {
            WdeSetStatusReadyText();
        }
    }

    return( ret );
}
コード例 #10
0
static void WdeCheckIfActiveWindow( void )
{
    HWND        main;
    HWND        active;

    main = WdeGetMainWindowHandle();
    active = GetActiveWindow();
    if( active != main ) {
        if( IsIconic( main ) ) {
            ShowWindow( main, SW_RESTORE );
        }
#ifdef __NT__
        SetWindowPos( main, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
        SetWindowPos( main, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
        SetWindowPos( main, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
        SetForegroundWindow( main );
#else
        SetActiveWindow( main );
        SetWindowPos( main, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
#endif
    }
}
コード例 #11
0
ファイル: wdefmenu.c プロジェクト: Ukusbobra/open-watcom-v2
void WdeSetControlObjectMenu ( Bool dlg_is_parent, Bool dlg_restorable,
                               Bool res_has_hash, WdeOrderMode mode )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();

    if ( WdeLastObject != CONTROL || mode != WdeLastOrderMode ||
         WdeLastDlgIsParent != dlg_is_parent ) {
        if( dlg_is_parent ) {
            WdeSetDialogObjectDialogMenu( menu, i, dlg_restorable, res_has_hash, mode );
        } else {
            if( mode != WdeLastOrderMode ) {
                WdeCheckModeMenu( menu, WdeLastOrderMode, MF_UNCHECKED );
                WdeCheckModeMenu( menu, mode, MF_CHECKED );
                WdeLastOrderMode = mode;
            }
            WdeEnableAllMenuItems( GetSubMenu( menu, DIALOG_MENU + i ), FALSE );
            EnableMenuItem( menu, IDM_DIALOG_NEW, MF_ENABLED );
        }

        WdeEnableAllMenuItems( GetSubMenu( menu, EDIT_MENU + i ), TRUE );

        WdeLastObject = CONTROL;
        WdeLastDlgIsParent = dlg_is_parent;
    }

    WdeEnableSelectDialogItem( menu );
    WdeEnableAlignTools( menu, i );
    //WdeEnableTest( menu, mode == WdeSelect );
    //WdeEnableGotoMenu( menu );

#if 0
    DrawMenuBar( WdeGetMainWindowHandle() );
#endif
}
コード例 #12
0
void WdeShowRibbon( void )
{
    bool        created;
    char        *mtext;

    if( WdeRibbonHeight != 0 ) {
        ShowWindow( WdeRibbon->win, SW_HIDE );
        WdeRibbonHeight = 0;
        WdeResizeWindows();
        mtext = WdeAllocRCString( WDE_SHOWTOOLBAR );
    } else {
        if( WdeRibbon == NULL ) {
            WdeCreateRibbon( WdeGetMainWindowHandle() );
            created = TRUE;
        } else {
            created = FALSE;
        }
        if( !created ) {
            WdeRibbonHeight = 2 * WdeRibbonInfo->dinfo.border_size.y +
                              WdeRibbonInfo->dinfo.button_size.y +
                              2 * GetSystemMetrics( SM_CYBORDER );
            WdeResizeWindows();
        }
        mtext = WdeAllocRCString( WDE_HIDETOOLBAR );
        ShowWindow( WdeRibbon->win, SW_SHOW );
    }

    WdeSetOption( WdeOptIsRibbonVisible, WdeRibbonHeight != 0 );

    ModifyMenu( WdeGetInitialMenuHandle(), IDM_SHOW_RIBBON,
                MF_BYCOMMAND | MF_STRING, IDM_SHOW_RIBBON, mtext );
    ModifyMenu( WdeGetResMenuHandle(), IDM_SHOW_RIBBON,
                MF_BYCOMMAND | MF_STRING, IDM_SHOW_RIBBON, mtext );

    if( mtext != NULL ) {
        WdeFreeRCString( mtext );
    }
}
コード例 #13
0
ファイル: wdefmenu.c プロジェクト: Ukusbobra/open-watcom-v2
void WdeSetTestModeMenu( Bool testing )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();
    WdeEnableAllMenuItems( menu, !testing );
    WdeEnableAllMenuItems( GetSubMenu( menu, DIALOG_MENU + i ), !testing );

    if( testing ) {
        EnableMenuItem( menu, DIALOG_MENU + i, MF_ENABLED | MF_BYPOSITION );
        EnableMenuItem( menu, IDM_TEST_MODE, MF_ENABLED );
        CheckMenuItem( menu, IDM_TEST_MODE, MF_CHECKED );
    } else {
        CheckMenuItem( menu, IDM_TEST_MODE, MF_UNCHECKED );
    }

    WdeSetRibbonItemState( IDM_TEST_MODE, testing );

    DrawMenuBar( WdeGetMainWindowHandle() );
}
コード例 #14
0
ファイル: wdeinfo.c プロジェクト: ABratovic/open-watcom-v2
WINEXPORT BOOL CALLBACK WdeInfoWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    WORD    w;
    RECT    r;
    HDC     dc;

    _wde_touch( lParam );

    switch( message ) {
#if defined( __NT__ )
    case WM_INITDIALOG:
        SetWindowLong( hWnd, GWL_STYLE, WS_CHILD );
        break;
#endif
    case WM_SYSCOLORCHANGE:
#if defined( __NT__ )
        WdeInfoColor = GetSysColor( COLOR_BTNFACE );
        DeleteObject( WdeInfoBrush );
        WdeInfoBrush = CreateSolidBrush( WdeInfoColor );
#endif
        WdeCtl3dColorChange ();
        break;

#ifdef __NT__
    case WM_CTLCOLORBTN:
    case WM_CTLCOLORSTATIC:
        dc = (HDC)wParam;
        SetBkColor( dc, WdeInfoColor );
        return( WdeInfoBrush != NULL );

    case WM_CTLCOLORMSGBOX:
    case WM_CTLCOLOREDIT:
        break;
#else
    case WM_CTLCOLOR:
        w = HIWORD( lParam );
        if( w != CTLCOLOR_MSGBOX && w != CTLCOLOR_EDIT ) {
            dc = (HDC)wParam;
            SetBkColor( dc, WdeInfoColor );
            return( WdeInfoBrush != NULL );
        }
        break;
#endif

    case WM_ERASEBKGND:
#if defined( __NT__ )
        if( WdeInfoColor != GetSysColor( COLOR_BTNFACE ) ) {
            /* Fake it, this proc does not get it ... */
            SendMessage( hWnd, WM_SYSCOLORCHANGE, (WPARAM)0, (LPARAM)0 );
        }
#endif
        GetClientRect( hWnd, &r );
        UnrealizeObject( WdeInfoBrush );
        FillRect( (HDC)wParam, &r, WdeInfoBrush );
        return( TRUE );

    case WM_COMMAND:
        w = GET_WM_COMMAND_CMD( wParam, lParam );
        switch( LOWORD( wParam ) ) {
        case IDB_INFO_IDSTR:
            if( w == CBN_EDITCHANGE || w == CBN_SELCHANGE ) {
                WdeInfoLookupComboEntry( hWnd, w );
            }
            break;

        case IDB_INFO_SET:
            WdeChangeInfo();
            SetFocus( WdeGetMainWindowHandle() );
            break;

        case IDB_INFO_RESET:
            WdeResetInfo();
            break;

        case IDCANCEL:
            WdeResetInfo();
            SetFocus( WdeGetMainWindowHandle() );
            break;
        }
        break;
    }
    return( FALSE );
}
コード例 #15
0
bool WdeCreateControlsToolBar( void )
{
    RECT        t, r, screen;
    HWND        parent;
    int         id;
    char        *text;

    if( WdeControls != NULL ) {
        return ( true );
    }

    WdeSetStatusText( NULL, "", false );
    WdeSetStatusByID( WDE_CREATINGTOOLBOX, 0 );

    parent = WdeGetMainWindowHandle();

    WdeGetCntlTBarPosOption( &t );

    if( t.left == t.right && t.top == t.bottom ) {
        GetWindowRect( parent, &r );
#ifdef __NT__
        if( GetModuleHandle( "COMCTL32.DLL" ) == NULL ) {
#endif
            t.left = r.right - CONTROLS_DEFX;
            t.top = r.top + CONTROLS_INSET;
            t.right = r.right;
            t.bottom = t.top + CONTROLS_DEFY;
#ifdef __NT__
        } else {
            t.left = r.right - CONTROLS_DEFXCC;
            t.top = r.top + CONTROLS_INSET;
            t.right = r.right;
            t.bottom = t.top + CONTROLS_DEFYCC;
        }
#endif
    }

    GetWindowRect( GetDesktopWindow(), &screen );
    if( !IntersectRect( &r, &screen, &t ) ) {
        r.right = t.right - t.left;
        r.bottom = t.bottom - t.top;
        r.left = 0;
        if( screen.right > r.right )
            r.left = ( screen.right - r.right ) / 2;
        r.top = 0;
        if( screen.bottom - screen.top - r.bottom  > 0 )
            r.top = ( screen.bottom - screen.top - r.bottom ) / 2;
        r.right += r.left;
        r.bottom += r.top;
        t = r;
    }

    WdeControlsInfo->dinfo.area = t;

    WdeControls = WdeCreateToolBar( WdeControlsInfo, parent );

    if( WdeControls == NULL ) {
        return( false );
    }

    text = WdeAllocRCString( WDE_TOOLBOXCAPTION );
    SendMessage( WdeControls->win, WM_SETTEXT, 0, (LPARAM)(LPCSTR)text );
    if( text != NULL ) {
        WdeFreeRCString( text );
    }

    text = WdeAllocRCString( WDE_HIDETOOLBOX );
    ModifyMenu ( WdeGetInitialMenuHandle(), IDM_SHOW_TOOLS,
                 MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text );
    ModifyMenu ( WdeGetResMenuHandle(), IDM_SHOW_TOOLS,
                 MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text );
    if( text != NULL ) {
        WdeFreeRCString( text );
    }

    if( WdeGetNumRes() ) {
        id = WdeGetMenuFromOBJID( GetBaseObjType() );
        if( id != -1 ) {
            WdeSetToolBarItemState( WdeControls, id, BUTTON_DOWN );
        }
        WdeSetStickyMode( WdeStickyMode );
    }

    WdeSetStatusReadyText();

    return( true );
}
コード例 #16
0
ファイル: wdegetfn.c プロジェクト: Azarien/open-watcom-v2
char *WdeGetFileName( WdeGetFileStruct *gf, DWORD flags, WdeGetFileNameAction action )
{
    OPENFILENAME        wdeofn;
    HWND                owner_window;
    DWORD               error;
    char                fn_drive[_MAX_DRIVE];
    char                fn_dir[_MAX_DIR];
    char                fn_name[_MAX_FNAME];
    char                fn_ext[_MAX_EXT];
    char                ext[_MAX_EXT + 1];
    HINSTANCE           app_inst;
    int                 len;
    int                 filter;
    bool                ret;

    if( gf == NULL ) {
        return( NULL );
    }

    owner_window = WdeGetMainWindowHandle();
    app_inst = WdeGetAppInstance();

    if( app_inst == NULL || owner_window == NULL ) {
        return( NULL );
    }

    /* set the initial directory */
    if( *wde_initial_dir == '\0' ) {
        getcwd( wde_initial_dir, MAXFILENAME );
    }

    if( gf->title != NULL ) {
        len = strlen( gf->title );
        if ( len < MAX_NAME ) {
            memcpy( wdefntitle, gf->title, len + 1 );
        } else {
            memcpy( wdefntitle, gf->title, MAX_NAME );
            wdefntitle[MAX_NAME - 1] = 0;
        }
    } else {
        wdefntitle[0] = 0;
    }

    filter = 0;

    if( gf->file_name != NULL && *gf->file_name != '\0' ) {
        _splitpath( gf->file_name, fn_drive, fn_dir, fn_name, fn_ext );
        if( *fn_drive != '\0' || *fn_dir != '\0' ) {
            _makepath( wde_initial_dir, fn_drive, fn_dir, NULL, NULL );
        }
        _makepath( wde_file_name, NULL, NULL, fn_name, fn_ext );
        if( fn_ext[0] != '\0' ) {
            ext[0] = '*';
            strcpy( ext + 1, fn_ext );
            filter = WdeFindFileFilterIndex( gf->filter, ext );
        }
    } else {
        wde_file_name[0] = 0;
    }

    if( filter == 0 ) {
        filter = WdeFindFileFilterIndex( gf->filter, WdeFileFilter );
        if( filter < 1 ) {
            filter = 1;
        }
    }

    // CTL3D no longer requires this
#if !defined( __NT__ )
    flags |= OFN_ENABLEHOOK;
#endif
    /* initialize the OPENFILENAME struct */
    memset( &wdeofn, 0, sizeof( OPENFILENAME ) );

    /* fill in non-variant fields of OPENFILENAME struct */
    wdeofn.lStructSize = sizeof( OPENFILENAME );
    wdeofn.hwndOwner = owner_window;
    wdeofn.hInstance = app_inst;
    wdeofn.lpstrFilter = gf->filter;
    wdeofn.lpstrCustomFilter = NULL;
    wdeofn.nMaxCustFilter = 0;
    wdeofn.nFilterIndex = filter;
    wdeofn.lpstrFile = wde_file_name;
    wdeofn.nMaxFile = MAXFILENAME;
    wdeofn.lpstrFileTitle = wdefntitle;
    wdeofn.nMaxFileTitle = MAXFILENAME;
    wdeofn.lpstrInitialDir = wde_initial_dir;
    wdeofn.lpstrTitle = wdefntitle;
    wdeofn.Flags = flags;
#if !defined( __NT__ )
    wdeofn.lpfnHook = (LPOFNHOOKPROC)MakeProcInstance( (FARPROC)WdeOpenHookProc, app_inst );
#endif

#if 0
    wdeofn.nFileOffset = 0L;
    wdeofn.nFileExtension = 0L;
    wdeofn.lpstrDefExt = NULL;
    wdeofn.lCustData = NULL;
    wdeofn.lpfnHook = NULL;
    wdeofn.lpTemplateName = NULL;
#endif

    if( action == WDEOPENFILE ) {
        ret = GetOpenFileName( (LPOPENFILENAME)&wdeofn );
    } else if( action == WDESAVEFILE ) {
        ret = GetSaveFileName( (LPOPENFILENAME)&wdeofn );
    } else {
        return( NULL );
    }

#ifndef __NT__
    if( wdeofn.lpfnHook != NULL ) {
        FreeProcInstance( (FARPROC)wdeofn.lpfnHook );
    }
#endif

    gf->fn_offset = wdeofn.nFileOffset;
    gf->ext_offset = wdeofn.nFileExtension;

    /* show the dialog box */
    if( !ret ) {
        error = CommDlgExtendedError();
        if( error ) {
            WdeDisplayErrorMsg( WDE_ERRORSELECTINGFILE );
        }
        return( NULL );
    } else {
        memcpy( wde_initial_dir, wde_file_name, wdeofn.nFileOffset );
        if( wde_initial_dir[wdeofn.nFileOffset - 1] == '\\' &&
            wde_initial_dir[wdeofn.nFileOffset - 2] != ':' ) {
            wde_initial_dir[wdeofn.nFileOffset - 1] = '\0';
        } else {
            wde_initial_dir[wdeofn.nFileOffset] = '\0';
        }
        _splitpath( wde_file_name, NULL, NULL, NULL, fn_ext + 1 );
        if( fn_ext[1] != '\0' ) {
            fn_ext[0] = '*';
            WdeSetFileFilter( fn_ext );
        } else {
            char *out_ext;
            out_ext = WdeFindFileFilterFromIndex( gf->filter, wdeofn.nFilterIndex );
            if( out_ext[2] != '*' ) {
                strcat( wde_file_name, &out_ext[1] );
            }
        }
    }

    UpdateWindow( WdeGetMainWindowHandle() );

    return( WdeStrDup( wde_file_name ) );
}
コード例 #17
0
WINEXPORT HDDEDATA CALLBACK DdeCallBack( UINT wType, UINT wFmt, HCONV hConv,
        HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
        ULONG_PTR lData1, ULONG_PTR lData2 )
{
    HWND                hmain;
    HSZPAIR             hszpair[2];
    HDDEDATA            ret;
    WdeResDlgItem       *ditem;

    _wde_touch( wFmt );
    _wde_touch( hdata );
    _wde_touch( lData1 );
    _wde_touch( lData2 );

    ret = (HDDEDATA)NULL;

    switch( wType ) {
    case XTYP_CONNECT_CONFIRM:
        WdeServerConv = hConv;
        break;

    case XTYP_DISCONNECT:
        WdeServerConv = (HCONV)NULL;
        WdeClientConv = (HCONV)NULL;
        hmain = WdeGetMainWindowHandle();
        SendMessage( hmain, WM_CLOSE, (WPARAM)1, 0 );
        break;

    case XTYP_CONNECT:
        if( WdeServerConv == (HCONV)NULL && hsz1 == hDialogTopic ) {
            ret = (HDDEDATA)TRUE;
        }
        break;

    case XTYP_WILDCONNECT:
        if( hsz2 != hDialogService ) {
            break;
        }
        hszpair[0].hszSvc = hDialogService;
        hszpair[0].hszTopic = hDialogTopic;
        hszpair[1].hszSvc = (HSZ)NULL;
        hszpair[1].hszTopic = (HSZ)NULL;
        ret = (HDDEDATA)DdeCreateDataHandle( IdInst, (LPBYTE)&hszpair[0],
                                             sizeof( hszpair ), 0L, 0, CF_TEXT, 0 );
        break;

    case XTYP_REQUEST:
        if( wFmt == WdeDataClipbdFormat ) {
            if( hsz1 == hTopic ) {
                ditem = WdeGetDlgItem();
                if( hsz2 == hDataItem ) {
                    ret = WdeCreateResData( ditem );
                } else if( hsz2 == hNameItem ) {
                    ret = WdeCreateResNameData( ditem->dialog_name, ditem->is32bit );
                }
            }
        }
        break;

    case XTYP_POKE:
        ret = (HDDEDATA)DDE_FNOTPROCESSED;
        if( hsz1 == hDialogTopic ) {
            if( hsz2 == hDataItem ) {
                WdeHandlePokedData( hdata );
                ret = (HDDEDATA)DDE_FACK;
            }
        }
        break;
    }

    return( ret );
}