Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open picture with registored windows editor 1

Status
Not open for further replies.

waytech2003

Programmer
Jul 14, 2003
316
US
I need to open a picture for Editing (jpg).
I have tried this, but it opens a viewer and I want an editor. Any ideas?

Code:
Public Function OpenDocument(DocumentWithPath As String) As Long
    OpenDocument = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocumentWithPath, vbNormalFocus)
End Function
 
Have you tried pointing to the correct program by setting Folder Options, File Types, and set jpg to the desired program?
 
Tyson

Yes, and that works. However that is not an option on the users computers. I need a way to find out what windows has as the "EDIT" option for jpeg's
 
I think I'd be tempted to use the ShellExecute API rather than the Shell command
 
Strongm

Can you elaborate on this?

Will this get me into an "EDIT" choice?
 
>Will this get me into an "EDIT" choice?

Yes. In fact it will let you run any of the available options for a file association

Code:
[blue]
Private Const SW_NORMAL = 1
Private Const SW_MAXIMIZE = 3
Private Declare  Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 

Public Function EditDocument(DocumentWithPath As String) As Long
    EditDocument = ShellExecute(0&, "Edit", DocumentWithPath , "", "", SW_NORMAL)
End Function[/blue]

Other typical verbs might be "open" and "print", but obviously it depends on the file.


 
Thank strongm, that seems to do exactly what I need it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top