On 11/03/2018 09:04 PM, James wrote: > So my question is, how can I use Ifilesavedialog with just FreePascal in > a console application?
First off, the IFileSaveDialog is an interface, not a simple function. So, you'll need to: - Include the right units from freepascal (ActiveX and comobj IIRC) - Initialize and finalize the COM subsystem (see CoInitialize and CoUninitialize) - Use the CoCreateInstance to instantiate an IFileSaveDialog, etc.. I've never used the IFileSaveDialog myself, so have a look at https://msdn.microsoft.com/en-us/library/windows/desktop/bb776913%28v=vs.85%29.aspx#usage That's the nice thing about the GetSaveFileNameA function: one call, and you're done :-) Now, if this function is not defined in the windows unit (which could be the case), you can either look into some other units or simply define it yourself: === code begin === Type TOpenFileNameAHookProc = function(Wnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): UINT stdcall; TOpenFileNameA = Packed Record lStructSize: DWord; hWndOwner: HWND; hInstance: HINST; 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: TOpenFileNameAHookProc; lpTemplateName: PChar; lpEditInfo: Pointer; // Undocumented? lpstrPrompt: PChar; _Reserved1: Pointer; _Reserved2: DWord; FlagsEx: DWord; End; POpenFileNameA = ^TOpenFileNameA; Function GetSaveFileNameA(arg: POpenFileNameA): windows.bool; stdcall; external 'comdlg32' name 'GetSaveFileNameA'; === code end === -- Ewald _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal