Open a file with its default program

Hi All,

Is there any way to open a file using its default program registered
under windows. For-example for jpg, it may open ACDsee, for mpg it
opens Windows Media player and so fort. I have used Run function, but
the problem is that you have to specify/embed the program extension
which will not work in above case as the user can open file of any
type.

Is there any way i can achieve this.

Thanks in advance,

Haroon
0
hkhokhar
7/30/2009 7:11:18 AM
sybase.powerbuilder.general 62418 articles. 11 followers. Follow

4 Replies
304 Views

Similar Articles

[PageSpeed] 4

On Jul 30, 4:11=A0pm, hkhokhar <haroonkhok...@gmail.com> wrote:
> Hi All,
>
> Is there any way to open a file using its default program registered
> under windows. For-example for jpg, it may open ACDsee, for mpg it
> opens Windows Media player and so fort. I have used Run function, but
> the problem is that you have to specify/embed the program extension
> which will not work in above case as the user can open file of any
> type.
>
> Is there any way i can achieve this.
>
> Thanks in advance,
>
> Haroon

http://msdn.microsoft.com/en-us/library/bb762153%28VS.85%29.aspx
0
Jeremy
7/30/2009 12:21:34 PM
http://www.rgagnon.com/pbdetails/pb-0008.html
I think this needs to be updated to ShellExecuteW for Unicode if you are on 
PB 10 or above.

-- 
Report Bugs: http://case-express.sybase.com/cx/welcome.do
Product Enhancement Requests: 
http://my.isug.com/cgi-bin/1/c/submit_enhancement


"hkhokhar" <haroonkhokhar@gmail.com> wrote in message 
news:7b6f4cbe-55c0-4fa4-bf99-b231345f8169@v15g2000prn.googlegroups.com...
> Hi All,
>
> Is there any way to open a file using its default program registered
> under windows. For-example for jpg, it may open ACDsee, for mpg it
> opens Windows Media player and so fort. I have used Run function, but
> the problem is that you have to specify/embed the program extension
> which will not work in above case as the user can open file of any
> type.
>
> Is there any way i can achieve this.
>
> Thanks in advance,
>
> Haroon 


0
Jerry
7/30/2009 3:11:19 PM
On Jul 31, 1:11=A0am, "Jerry Siegel [TeamSybase]"
<jNOsSPAMsiegel@yahoo!.com> wrote:
> http://www.rgagnon.com/pbdetails/pb-0008.html
> I think this needs to be updated to ShellExecuteW for Unicode if you are =
on
> PB 10 or above.
>
> --
> Report Bugs:http://case-express.sybase.com/cx/welcome.do
> Product Enhancement Requests:http://my.isug.com/cgi-bin/1/c/submit_enhanc=
ement
>
> "hkhokhar" <haroonkhok...@gmail.com> wrote in message
>
> news:7b6f4cbe-55c0-4fa4-bf99-b231345f8169@v15g2000prn.googlegroups.com...
>
> > Hi All,
>
> > Is there any way to open a file using its default program registered
> > under windows. For-example for jpg, it may open ACDsee, for mpg it
> > opens Windows Media player and so fort. I have used Run function, but
> > the problem is that you have to specify/embed the program extension
> > which will not work in above case as the user can open file of any
> > type.
>
> > Is there any way i can achieve this.
>
> > Thanks in advance,
>
> > Haroon

Thanks Jeremy and Jerry,

Your examples really helped me out.

Thanks heaps,

Cheers
0
hkhokhar
7/30/2009 4:03:47 PM
If you "open" it from an embedded 'IExplorer' container (OLE) object, I 
believe it will use the default program assignment (i.e. acrobat, excel, 
word, ...)

"hkhokhar" <haroonkhokhar@gmail.com> wrote in message 
news:1c507ff7-ab45-4060-ac7f-9b71369f2939@x6g2000prc.googlegroups.com...
On Jul 31, 1:11 am, "Jerry Siegel [TeamSybase]"
<jNOsSPAMsiegel@yahoo!.com> wrote:
> http://www.rgagnon.com/pbdetails/pb-0008.html
> I think this needs to be updated to ShellExecuteW for Unicode if you are 
> on
> PB 10 or above.
>
> --
> Report Bugs:http://case-express.sybase.com/cx/welcome.do
> Product Enhancement 
> Requests:http://my.isug.com/cgi-bin/1/c/submit_enhancement
>
> "hkhokhar" <haroonkhok...@gmail.com> wrote in message
>
> news:7b6f4cbe-55c0-4fa4-bf99-b231345f8169@v15g2000prn.googlegroups.com...
>
> > Hi All,
>
> > Is there any way to open a file using its default program registered
> > under windows. For-example for jpg, it may open ACDsee, for mpg it
> > opens Windows Media player and so fort. I have used Run function, but
> > the problem is that you have to specify/embed the program extension
> > which will not work in above case as the user can open file of any
> > type.
>
> > Is there any way i can achieve this.
>
> > Thanks in advance,
>
> > Haroon

Thanks Jeremy and Jerry,

Your examples really helped me out.

Thanks heaps,

Cheers 


0
Jim
7/31/2009 12:23:16 AM
Reply:

Similar Artilces:

Open a file in default program
Hi, I am creating a .tex file with an extension. The user is presented a filePicker-dialog to chose the file. After creating, I want to open it in the editor that is associated to the file extension. How can I achieve this? I know it's easy on windows, and there are kde-open and gnome-open commands on these Desktops, too, but for choosing e.g. between kde and gnome (and all the others!), I need to determine the desktop environment. Desktop-independent commands like open need to be installed separately, so it's not the best idea. Does the extension API provide a feature t...

Choosing the default program to open files
I have an.exe file that I want to open in wine by default. I already did "open with" and chose wine file by accident. How to I make the default wine? -- FaiT ------------------------------------------------------------------------ Right click it > Properties > click the small spanner icon see image 'SUSE Paste' (http://paste.opensuse.org/75060183) -- Box: 11.4 | Gnome 2.3 | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM Lap #1: 11.4 | Duo T4300 | KDE 4.6.5 | Gnome 3/TWeed | Intel M4 Graphics | Lenovo G550 | 3GB RAM Lap#2: 12.1M3 | KDE 4....

default programs to open file types in LXDE
Hello there i've iregulare situation here i use LXDE and when i use chromium (for ex) and download a jpg file and then open it it starts FIREFOX and then asks me to open it i want chromium (for ex) to open that file type directly with images viewer another example when i installed awn and made some favorite applications shortcut on it when i try to open those shortcuts it opens firefox again and ask me to download or open O_O how can i remove firefox from all this proccess ? -- SAFAD ------------------------------------------------------------------------ UP...

How to open files with default programs?(Web C#)
My problem: When I used "Process.Start()" to open files(like .doc), but no any frame opened. When I checked the process, winword.exe was acturaly runing. Why? Searched from Google, someone said modify the IIS and Asp.net Account configuration may solve. But I did so, the process also runed, no frame opened yet. How to solve this problem? code:  ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName="winword.exe";  startInfo.Arguments=@"c:\07.doc";  startInfo.WindowStyle=ProcessWindowStyle.No...

Defaulting a directory/file when opening a file
Is there an easy way to default a directory and/or file using the GetFileOpen() function. Putting a valid path in the Pathname variable doesn't seem to work the way it does in GetFileSaveName(). Any thought? Thanks! Pete What version of PowerBuilder? PB 8 has a ChangeDirectory function that should do what you want (call it before calling GetFileOpenName). Regards, Dave Fish [TeamSybase] On Thu, 21 Feb 2002 18:49:28 -0500, PC wrote: > >Is there an easy way to default a directory and/or file using the >GetFileOpen() function. Putting a valid path in th...

how can i open a file without having the opening program?
I have a web application that uploads and downloads files in different formats. My question is: Is there a way for the user to download and open a file in specific format (i.e. PDF format), without dealing with the installation of the program that opens that format (i.e. the user doesn't have the acrobat reader program)? Is it possible that the downloading process of the file will also download and install the appropriate opening program? Browsers can't go around installing things on people's computers without their permission, so no, this isn't possible. I would suggest ...

Changing the default All Files (*.*) option to Adobe PDF Files (*.pdf) in a file open dialogue in ASP.net
In My file Upload page, I am using <input type=file> tag to browse a file from client machine.The Browse button by default is showing all files *.* in the file dialogue boxI have a requirement like the file dialogue should by default show just PDFs *.pdf, and have an option to show all files *.* as shown below:Adobe PDF Files (*.pdf)All Files (*.*)Is there a way to handle this using any web controls, or technique using ASP.net or HTML?Thanks in advanceAnsar I need answer to this one, too. As far as I know, there is no way to do this....

Reinstall defaults File Open/File Save to Groupwise
Following a reinstall of 7.0.1, my Microsoft applications (Excel, Word, etc.) now default to Groupwise inbox and Groupwise library options. How do I configure to permanently point back to the individual MS applications? On Thu, 25 Jan 2007 18:31:41 +0000, lgibb wrote: > Following a reinstall of 7.0.1, my Microsoft applications (Excel, Word, > etc.) now default to Groupwise inbox and Groupwise library options. How > do I configure to permanently point back to the individual MS > applications? You need to go to Tools->Options->Documents->Integrations and dis...

Start the default program file and put it in the window of my own program
How to start the default program file and put it in the window of my own program? Is the function ShellExecute can make this miracle? duf wrote: > How to start the default program file ShellExecute/Ex(). > and put it in the window of my own program? Why? That is very difficult to do properly. 1. because the Win32 API has no concept of a "main" window, so you have to hunt for it, ShellExecute/Ex() will not give it to you directly. 2. an app may create multiple windows at startup, so how do you identify the "main" window? 3. reparenting an ...

superreview requested: [Bug 363654] .url files opened via File:Open don't open/don't open properly on the 1.8.0 branch : [Attachment 248458] disables .url in file:open
Smokey Ardisson (unreliable; no bugmail) <alqahira@ardisson.org> has asked Stuart Morgan <stuart.morgan@alumni.case.edu> for superreview: Bug 363654: .url files opened via File:Open don't open/don't open properly on the 1.8.0 branch https://bugzilla.mozilla.org/show_bug.cgi?id=363654 Attachment 248458: disables .url in file:open https://bugzilla.mozilla.org/attachment.cgi?id=248458&action=edit ------- Additional Comments from Smokey Ardisson (unreliable; no bugmail) <alqahira@ardisson.org> Asking for sr on this 7-char patch in case we need to take it ...

superreview granted: [Bug 363654] .url files opened via File:Open don't open/don't open properly on the 1.8.0 branch : [Attachment 248458] disables .url in file:open
Stuart Morgan <stuart.morgan@alumni.case.edu> has granted Smokey Ardisson (unreliable; no bugmail) <alqahira@ardisson.org>'s request for superreview: Bug 363654: .url files opened via File:Open don't open/don't open properly on the 1.8.0 branch https://bugzilla.mozilla.org/show_bug.cgi?id=363654 Attachment 248458: disables .url in file:open https://bugzilla.mozilla.org/attachment.cgi?id=248458&action=edit ------- Additional Comments from Stuart Morgan <stuart.morgan@alumni.case.edu> Well, that kinda sucks. ...

Change "File, Open File" default location?
le, Open File" defaults to the users' home directory. I'd like to change it to something else for a user so she doesn't have to click up and down to get to where she needs to be :-) -- * John Oliver http://www.john-oliver.net/ * On 11/17/2006 06:01 PM, John Oliver wrote: > le, Open File" defaults to the users' home directory. I'd like to > change it to something else for a user so she doesn't have to click up > and down to get to where she needs to be :-) > In Firefox 1.5, in the Open File dialog, the...

[ilink64 Error] Fatal: Unable to open file 'PROGRAM FILES (X86)\FASTREPORT [Edit]
Hello, i managed to compile all source-code files of a larger project with bcc64 (C++Builder4Update1). After fixing a lot of code producing bbc64 and ilink64 errors I get now: [ilink64 Error] Fatal: Unable to open file 'PROGRAM FILES (X86)\FASTREPORTS\LIBD18X64;C:\USERS\PUBLIC\DOCUMENTS\RAD STUDIO\11.0\DCP\WIN64' I don't use FastReports! The whole project can be build with bcc32 and ilink32 without problem. (beside ) The output of ilink64 in the IDE is attached. Can someone give me a hint? The path "C:\Program Files (x86)\FastReports\LibD18x64" is adde...

Cannot open items in .pbl file using File
Hello, I am using InfoMaker version 8.0.3 and I cannot open items in a .pbl file using the File - Open routine. I can open them using the Library Painter window and the .pbl file is set as my current working library. I have switched the object type to see if the display was limiting my list of reports. The entire list is blank. Am I missing a setting somewhere? Thanks! I have no idea. My guess is that you have duplicate pbXXX80.dll's on your system. -- Terry Dykstra (TeamSybase) http://powerbuilder.codeXchange.sybase.com/ http://www.pb9books.com product enhancem...

Web resources about - Open a file with its default program - sybase.powerbuilder.general

Credit default swap - Wikipedia, the free encyclopedia
Sovereign credit default swap prices of selected European countries (2010-2011). The left axis is basis points, or 100ths of a percent; a level ...

INFOGRAPHIC: The History Of Facebook's Default Privacy Settings
INFOGRAPHIC: The History Of Facebook's Default Privacy Settings

Secure browsing by default
We now use https by default for all Facebook users. This feature, which we first introduced as an option two years ago , means that your browser ...

北方理財團隊的家園:http://group.hexun.com/m132312/default.html外汇交易员芬芳fenfang恭候您! - 芬芳FENFANG - 和讯博客
北方理財團隊的家園:http://group.hexun.com/m132312/default.html外汇交易员芬芳fenfang恭候您! - 芬芳FENFANG - 芬芳FENFANG的博客 - 和讯博客

Tab applications for musicians look to innovate after Facebook removes default landing function
... landing tabs. Most page applications have experienced significant drops in daily and monthly active users now that Facebook removed the default ...


Google AdWords Regional Targeting (Default for US) - Flickr - Photo Sharing!
Explore Tamar Weinberg's photos on Flickr. Tamar Weinberg has uploaded 4087 photos to Flickr.

[3DS] Bravely Default: AR (English Subs) - YouTube
Turn on Annotations For Subs -May redo them as real CC subtitles- ★EDIT☆ ☆上から撮影した映像はこちら ★The top view video is here http://www.youtube.com/w ...

Default password leaves tens of thousands of Optus cable subscribers at risk
When Alex* found flaw in his cable modem that allowed anyone to receive and make calls using his number, his jaw dropped.

Mortgage default risk rising
Moody's says housing affordability has 'deteriorated significantly', increasing default risk.

Resources last updated: 12/17/2015 5:29:26 AM