I was thinking of something like 4 buttons on the right side of the dialog,
where the user could rightclick to save the current path "into" that button,
or leftclick to go to the already saved path.
Is this a though one?
Should I write my own "open dialogbox" or should I hook into the "common"
one?
Since the program should run under 95,98 NT and 2000 I thought it might be
nice to hook
on to the common dialog, and then avoiding reinventing the wheel. But Im not
sure where to start.
Does anyone have any ideas or suggestions?
Im writing in C using Borland 5.02 under win2000
Thanks alot
// Marcus
It's easy. The file dialogs have a mechanism where you can specify your own
dialog template and hook procedure (which will receive any relevant
messages). Look at the lpTemplateName and lpfnHook fields in the
OPENFILENAME structure.
--
Tim Robinson
http://www.themoebius.org.uk/
The newer File dialogs have a load of large icon shortcuts to the left, to
My Documents and to the Desktop and to other places.
Does anyone know how to customize which shortcuts appear in this panel?
(I've always wanted to do this. Additionally, if there is a standard way,
then this customization would solve the previous poster's problem, but
without the need to do dialog templates.)
--
Lucian Wischik, Queens' College, Cambridge CB3 9ET. www.wischik.com/lu
The Windows 2000 version of TweakUI will allow you to change where the icons
point. I have my Projects directory as the top icon, although relatively few
applications have been recompiled for the new dialogs. I don't see why the
icons couldn't have been applied to the old dialogs as well.
But why leftmost icons disappear under Win2K if I utilize
a OFN_ENABLETEMPLATE (or even OFN_ENABLEHOOK IIRC)?
Here's my setup (hope it would serve as a sample for
the OP):
Ofn%lStructSize = SIZEOF(Ofn)
Ofn%hwndOwner = hSplash
Ofn%hInstance = hInst
Ofn%lpstrFilter = LOC(szFilter)
Ofn%lpstrCustomFilter = NULL
Ofn%nMaxCustFilter = NULL
Ofn%nFilterIndex = 1
Ofn%lpstrFile = LOC(szLocalFile)
Ofn%nMaxFile = LEN(szLocalFile)
Ofn%lpstrFileTitle = LOC(sNetTitle)
Ofn%nMaxFileTitle = LEN(sNetTitle)
Ofn%lpstrInitialDir = LOC(szInitDir)
Ofn%lpstrTitle = LOC(szOpen)
Ofn%Flags = OFN_HIDEREADONLY.OR.OFN_PATHMUSTEXIST.OR. &
OFN_EXPLORER .OR.OFN_ENABLEHOOK .OR. &
OFN_ENABLETEMPLATE
Ofn%nFileOffset = 0
Ofn%nFileExtension = 0
Ofn%lpstrDefExt = LOC(szExt)
Ofn%lCustData = 0
Ofn%lpfnHook = LOC(OpenHookProc)
Ofn%lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG_EXTOPEN)
The sequel is a copy & paste of code handling an additional
child dialog with few radios, edit box and buttons; radios
are titled "local file" and "download from server". Note
use of GetParent() and handling CDN_SELCHANGE.
!=================================================================
INTEGER FUNCTION OpenHookProc(hWnd,Msg,wParam,lParam)
!DEC$ATTRIBUTES STDCALL:: OpenHookProc
USE DFWIN
USE COMCTL
USE GLOBALS
USE OPCCLIENT
USE REGISTRY
IMPLICIT NONE
INCLUDE "Resource.fd"
INTEGER:: hWnd,Msg,wParam,lParam
INTEGER:: iSt,iX,iY
TYPE(T_RECT):: Rect
TYPE(T_NMHDR):: Hdr; POINTER(pHdr, Hdr)
INTERFACE
LOGICAL FUNCTION OfnEnableProc(hWnd, bEnable)
!DEC$ATTRIBUTES STDCALL:: OfnEnableProc
INTEGER:: hwnd
LOGICAL:: bEnable
END FUNCTION
END INTERFACE
SELECT CASE(Msg)
CASE(WM_INITDIALOG)
iSt=GetWindowRect(GetParent(hWnd),Rect)
iX=Rect%Right-Rect%Left
iY=Rect%Bottom-Rect%Top
iSt=GetWindowRect(hFrame,Rect)
iSt=SetWindowPos(GetParent(hWnd),0,(Rect%Right-iX)/2,(Rect%Bottom-iY)/2,0,0,SWP_
NOSIZE.OR.SWP_NOZORDER)
iSt=SendMessage(GetDlgItem(hWnd,IDC_EDIT_SERVER0), WM_SETTEXT, 0,
LOC(szOPCServer))
iSt=SendMessage(GetDlgItem(hWnd, IDC_RADIO_LOCAL), BM_SETCHECK,
iServerStatus.NE.SERVER_OPC, 0)
iSt=SendMessage(GetDlgItem(hWnd, IDC_RADIO_OPC), BM_SETCHECK,
iServerStatus.EQ.SERVER_OPC, 0)
iSt=EnableWindow(GetDlgItem(hWnd,IDC_EDIT_SERVER0),
iServerStatus.EQ.SERVER_OPC)
iSt=EnableWindow(GetDlgItem(hWnd,IDC_BUTTON_BROWSE),
iServerStatus.EQ.SERVER_OPC)
iSt=EnableWindow(GetDlgItem(hWnd,IDC_BUTTON_CONNECT0),
iServerStatus.EQ.SERVER_OPC)
OpenHookProc=.FALSE.
CASE(WM_NOTIFY)
pHdr=lParam
IF (Hdr%Code.EQ.CDN_SELCHANGE) THEN
iSt=EnumChildWindows(GetParent(hWnd), LOC(OfnEnableProc),
iServerStatus.NE.SERVER_OPC)
END IF
OpenHookProc=.FALSE.
CASE(WM_COMMAND)
SELECT CASE(LOWORD(wParam))
CASE(IDC_RADIO_LOCAL, IDC_RADIO_OPC)
IF (LOWORD(wParam).EQ.IDC_RADIO_LOCAL) THEN
iServerStatus=SERVER_NONE
ELSE
iServerStatus=SERVER_OPC
END IF
iSt=SendMessage(GetDlgItem(hWnd, IDC_EDIT_SERVER0), WM_SETTEXT, 0,
LOC(szOPCServer))
iSt=SendMessage(GetDlgItem(hWnd, IDC_RADIO_LOCAL), BM_SETCHECK,
iServerStatus.NE.SERVER_OPC, 0)
iSt=SendMessage(GetDlgItem(hWnd, IDC_RADIO_OPC), BM_SETCHECK,
iServerStatus.EQ.SERVER_OPC, 0)
iSt=EnableWindow(GetDlgItem(hWnd,IDC_EDIT_SERVER0),
iServerStatus.EQ.SERVER_OPC)
iSt=EnableWindow(GetDlgItem(hWnd,IDC_BUTTON_BROWSE),
iServerStatus.EQ.SERVER_OPC)
iSt=EnableWindow(GetDlgItem(hWnd,IDC_BUTTON_CONNECT0),
iServerStatus.EQ.SERVER_OPC)
iSt=EnumChildWindows(GetParent(hWnd), LOC(OfnEnableProc),
iServerStatus.NE.SERVER_OPC)
CASE(IDC_BUTTON_BROWSE)
CALL OnOPCBrowse(hWnd)
CASE(IDC_BUTTON_CONNECT0)
iSt=GetWindowText(GetDlgItem(hWnd, IDC_EDIT_SERVER0), szOPCServer,
LEN(szOPCServer))
iSt=EnableWindow(GetDlgItem(GetParent(hWnd), IDOK), .TRUE.)
iSt=EndDialog(GetParent(hWnd),IDOK)
END SELECT
OpenHookProc=.FALSE.
CASE DEFAULT
OpenHookProc=.FALSE.
END SELECT
END FUNCTION OpenHookProc
Jugoslav
________________________
www.geocities.com/jdujic