Moin Mathias,
bei mir sieht die OPENFILENAME Struktur so aus
Delphi-Quellcode:
type
PcsOPENFILENAME = ^TcsOPENFILENAME;
TcsOPENFILENAME =
packed record
lStructSize : DWORD;
hwndOwner : HWND;
hInstance : DWORD;
lpstrFilter : PChar;
lpstrCustomFilter : PChar;
nMaxCustFilter : DWORD;
nFilterIndex : DWORD;
lpstrFile : PChar;
nMaxFile : DWORD;
lpstrFileTitle : PChar;
nMaxFileTitle : DWORD;
lpstrInitialDir : PChar;
lpstrTitle : PChar;
Flags : DWORD;
nFileOffset : WORD;
nFileExtension : WORD;
lpstrDefExt : PChar;
lCustData : lParam;
lpfnHook : PcsOFNHookProc;
lpTemplateName : PChar;
pvReserved : Pointer;
dwReserved : DWORD;
FlagsEx : DWORD;
end;
die erforderlichen Konstanten so
Delphi-Quellcode:
const // aus COMMDLG.H
OFN_READONLY = $00000001;
OFN_OVERWRITEPROMPT = $00000002;
OFN_HIDEREADONLY = $00000004;
OFN_NOCHANGEDIR = $00000008;
OFN_SHOWHELP = $00000010;
OFN_ENABLEHOOK = $00000020;
OFN_ENABLETEMPLATE = $00000040;
OFN_ENABLETEMPLATEHANDLE = $00000080;
OFN_NOVALIDATE = $00000100;
OFN_ALLOWMULTISELECT = $00000200;
OFN_EXTENSIONDIFFERENT = $00000400;
OFN_PATHMUSTEXIST = $00000800;
OFN_FILEMUSTEXIST = $00001000;
OFN_CREATEPROMPT = $00002000;
OFN_SHAREAWARE = $00004000;
OFN_NOREADONLYRETURN = $00008000;
OFN_NOTESTFILECREATE = $00010000;
OFN_NONETWORKBUTTON = $00020000;
OFN_NOLONGNAMES = $00040000;
OFN_EXPLORER = $00080000;
OFN_NODEREFERENCELINKS = $00100000;
OFN_LONGNAMES = $00200000;
OFN_ENABLEINCLUDENOTIFY = $00400000;
OFN_ENABLESIZING = $00800000;
OFN_DONTADDTORECENT = $02000000;
OFN_FORCESHOWHIDDEN = $10000000;
OFN_EX_NOPLACESBAR = $00000001;
und die Funktionsdeklarationen so
Delphi-Quellcode:
function GetOpenFileNameA(const lpofn : PcsOPENFILENAME) : Boolean; stdcall; external 'comdlg32.dll';
function GetSaveFileNameA(const lpofn : PcsOPENFILENAME) : Boolean; stdcall; external 'comdlg32.dll';
function GetOpenFileNamePreviewA(const lpofn : PcsOPENFILENAME) : Boolean; stdcall; external 'msvfw32.dll';
function GetSaveFileNamePreviewA(const lpofn : PcsOPENFILENAME) : Boolean; stdcall; external 'msvfw32.dll';
Das alles auch mal, falls jemand darin noch einen Fehler entdecken kann, denn ausserhalb der Kompo, nur unter Verwendung dieser Deklarationen funktioniert's ja auch nicht