-
Jan 31st, 2018, 11:06 AM
#1
Thread Starter
Junior Member
[RESOLVED] opening Jpg or any picture file in windows photo viewer from within my app
Hi All
I am developing an app that can list a lot of folders in my hard drive (each folder contains a picture file) and I want my app can open the picture in folders by windows photo viewer when I click the folder name in combobox.
I tried the code below ,but this just open the windows explore with picture file in it that it is not focused.
Code:
Private Sub C_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles C.KeyPress
Select Case e.KeyChar
Case Chr(Keys.Enter)
Process.Start("j:\bimaran\" & C.SelectedItem)
End Select
End Sub
that is a dead end for me so any help appreciated.
thanks
bayat
-
Jan 31st, 2018, 12:17 PM
#2
Re: opening Jpg or any picture file in windows photo viewer from within my app
-
Jan 31st, 2018, 12:26 PM
#3
Thread Starter
Junior Member
Re: opening Jpg or any picture file in windows photo viewer from within my app
Originally Posted by jdc2000
thanks for reply but that was not thing I was asking for.
-
Jan 31st, 2018, 12:32 PM
#4
Re: opening Jpg or any picture file in windows photo viewer from within my app
Think this through. You say your ComboBox contains folder names. So C.SelectedItem will return a folder name. So
Code:
"j:\bimaran\" & C.SelectedItem
will contain a path to a folder, such as "j:\bimaran\OneOfYourFolderNames"
You are then passing that path to Process.Start. The result you describe of Windows Explorer opening that folder is exactly what I would expect to happen. You aren't referencing Windows Photo Viewer, or an image file name.
Now, the links jdc2000 posted are absolutely relevant to your question. The fact that you dismissed them is troubling, since it suggests that you might not have fully thought through the specifics of what you are trying to accomplish (hint: Step 1 is to write code that will simply open Windows Photo Viewer. Step 2 is to modify that code to pass the full path, including filename, of the image that you want opened in Windows Photo Viewer) In any event, I'm unable to assist further with this, so good luck.
Last edited by OptionBase1; Jan 31st, 2018 at 01:00 PM.
-
Jan 31st, 2018, 12:36 PM
#5
Re: opening Jpg or any picture file in windows photo viewer from within my app
Dim strCommand As String
strCommand = "rundll32" & Chr$(34) & "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll " & Chr$(34) & Chr$(34) & "j:\bimaran\" & C.SelectedItem & Chr$(34)
Process.Start(strCommand)
-
Feb 1st, 2018, 04:26 AM
#6
Thread Starter
Junior Member
Re: opening Jpg or any picture file in windows photo viewer from within my app
Originally Posted by jdc2000
Dim strCommand As String
strCommand = "rundll32" & Chr$(34) & "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll " & Chr$(34) & Chr$(34) & "j:\bimaran\" & C.SelectedItem & Chr$(34)
Process.Start(strCommand)
thank you for your code , each folder has a picture file with a different name , can I use ? or * to address each picture file I want to open with rundll32 or not. how?
-
Feb 1st, 2018, 11:56 AM
#7
Re: [RESOLVED] opening Jpg or any picture file in windows photo viewer from within my
You would need to get the full file name to open it. This can be done using the Dir statement. See the link below for an idea on how to use it.
http://www.vbforums.com/showthread.p...-just-partname
-
Feb 1st, 2018, 03:14 PM
#8
Thread Starter
Junior Member
Re: [RESOLVED] opening Jpg or any picture file in windows photo viewer from within my
-
Feb 1st, 2018, 06:11 PM
#9
Re: [RESOLVED] opening Jpg or any picture file in windows photo viewer from within my
Surely there is a more .Net-ish way to do that instead of using Dir
-
Feb 1st, 2018, 06:36 PM
#10
Re: [RESOLVED] opening Jpg or any picture file in windows photo viewer from within my
-
Feb 2nd, 2018, 12:55 AM
#11
Thread Starter
Junior Member
Re: [RESOLVED] opening Jpg or any picture file in windows photo viewer from within my
Originally Posted by Arve K.
Surely there is a more .Net-ish way to do that instead of using Dir
Which one do you mean?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|