Solved

Using Open With Dialog

Posted on 2000-05-12
6
390 Views
Last Modified: 2010-04-04
Hi All!

There is an dialog in Windows called 'Open With'. It is not supported by Delphi and there is no information about it into MSDN. My question: How to use this dialog in my application in order to give user a way to open document thru this dialog for choosing application.

Jo.
0
Comment
Question by:Fatman121898
6 Comments
 
LVL 3

Expert Comment

by:shenqw
ID: 2803817
listening
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 2803924
Fatman

I seem to remember playing with this a while ago, but never really got anywhere, one place to look is the IShellBrowser ot IShellExecute I think it was there that I saw related stuff to the IContextMenu etc...

Hope this helps a little...

Later
BoRiS

0
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 2806001
HI,
you can use it from url.dll
example:


unit UrlAPI;
 
interface
 
uses Windows;
 
function URLAssociationDialogA(
hwndParent: HWND;
  dwInFlags: DWORD;
  pcszFile: PAnsiChar;
  pcszURL: PAnsiChar;
  pszAppBuf: PAnsiChar;
  ucAppBufLen: UINT  ): Integer; stdcall;
 
function URLAssociationDialogW(
hwndParent: HWND;
dwInFlags: DWORD;
  pcszFile: PWideChar;
  pcszURL: PWideChar;
  pszAppBuf: PWideChar;
  ucAppBufLen: UINT ): Integer; stdcall;
 
function URLAssociationDialog(
hwndParent: HWND;
  dwInFlags: DWORD;
  pcszFile: PChar;
  pcszURL: Pchar;
  pszAppBuf: PChar;
  ucAppBufLen: UINT ): Integer; stdcall;
 
 
const
url = 'url.dll';
URLASSOCDLG_FL_USE_DEFAULT_NAME  = $0001;
URLASSOCDLG_FL_REGISTER_ASSOC    = $0002;
 
implementation
 
function URLAssociationDialogA; external url name 'URLAssociationDialogA'; function URLAssociationDialogW; external url name 'URLAssociationDialogW'; function URLAssociationDialog; external url name 'URLAssociationDialogA';
 
 
end.





unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,   StdCtrls, UrlAPI;

type
  TForm1 = class(TForm)
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
hwndParent : integer;
  dwInFlags : dword;
pcszFile : string;
pcszURL : string;
  pszAppBuf : array[0..255]of char;
  ucAppBufLen : integer;
begin
with opendialog1 do begin
  if (execute) then begin
  hwndParent := self.handle;
  pcszFile := filename;
  //pcszURL := 'file://c|/windows/notepad.exe';
  pcszURL := 'file://C|/Program Files/Microsoft Office/Office/excel.exe';
  ucAppBufLen := sizeof(pszAppBuf);
  URLAssociationDialog(
    hwndParent,
    URLASSOCDLG_FL_REGISTER_ASSOC,
    pchar(pcszFile),
    pchar(pcszURL),
    @pszAppBuf,
    ucAppBufLen);
  end;{if}
end;{with}
end;

end.



Regards Barry
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Expert Comment

by:ptmcomp
ID: 2806065
On WinNT4 and Win95 that was just a DLL call (you found it in the registry (look for "open with" and what's written in it's command line). But now (on W2k) this is a COM interface and I don't know how to get that.
Regards, ptm.
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 2806068
When you have found it, please put the line here. I'll test it on Win2k.
0
 
LVL 1

Author Comment

by:Fatman121898
ID: 2813987
It works. Thanks, Barry!
Ptcomp, Barry found it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now