|
-
Jan 13th, 2008, 11:13 PM
#1
Thread Starter
Frenzied Member
[2005] Open picture and fax viewer
i have this code
Code:
Dim image As Image = PictureBox1.Image
System.Diagnostics.Process.Start("PictureViewer.exe")
Is is possible to send the image I want to the program so it will open with it?
-
Jan 13th, 2008, 11:18 PM
#2
Re: [2005] Open picture and fax viewer
You'd have to save the Image as a file and then pass the path of that file as a second argument to Process.Start. You could create a temp file with IO.Path.GetTempFileName or My.Computer.FileSystem.GetTempFileName.
-
Jan 13th, 2008, 11:36 PM
#3
Re: [2005] Open picture and fax viewer
I take it that you are using Windows XP?
It would be the same as opening a image in any graphics program. They all accept filenames as arguments.
If you are running Vista or need to handle that option too then you will want to use ...
"%ProgramFiles%\Windows Photo Gallery\WindowsPhotoGallery.exe"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 13th, 2008, 11:54 PM
#4
Thread Starter
Frenzied Member
Re: [2005] Open picture and fax viewer
How could I open it in picture and fax viewer??? whats this program called?
-
Jan 14th, 2008, 12:15 AM
#5
Re: [2005] Open picture and fax viewer
Ah, I didn't realise that PictureViewer.exe wasn't it. I just opened an image in that viewer and then had a look in the Task Manager and it showed up as rundll32.exe, so the Picture& Fax Viewer itself is a DLL, not an EXE. Exactly which DLL I couldn't say.
-
Jan 14th, 2008, 12:28 AM
#6
Re: [2005] Open picture and fax viewer
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 14th, 2008, 12:46 AM
#7
Re: [2005] Open picture and fax viewer
Here's the syntax for running rundll32.exe.
Code:
rundll32.exe <dllname>,<entrypoint> <optional arguments>
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 14th, 2008, 01:32 PM
#8
Re: [2005] Open picture and fax viewer
Got it working.
Here is the complete syntax for passing an image filepath and name to open with the picture and fax viewer.
rundll32.exe %SystemRoot%\system32\shimgvw.dll,ImageView_Fullscreen C:\SomeFolder\SomePicture.jpg
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 14th, 2008, 02:52 PM
#9
Thread Starter
Frenzied Member
Re: [2005] Open picture and fax viewer
 Originally Posted by RobDog888
Got it working.
Here is the complete syntax for passing an image filepath and name to open with the picture and fax viewer.
rundll32.exe %SystemRoot%\system32\shimgvw.dll,ImageView_Fullscreen C:\SomeFolder\SomePicture.jpg
Do I run this into System.Diagnostics.Process.Start or some other way?
-
Jan 14th, 2008, 05:31 PM
#10
Re: [2005] Open picture and fax viewer
Yes, use the Process.Start and fill it in like so.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sysDir As String = Environment.GetFolderPath(Environment.SpecialFolder.System).ToString
System.Diagnostics.Process.Start(sysDir & "\rundll32.exe", sysDir & "\shimgvw.dll,ImageView_Fullscreen C:\SomeFolder\SomeImage.jpg")
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 14th, 2008, 05:51 PM
#11
Re: [2005] Open picture and fax viewer
That's accurate Rob, but more verbose than necessary. System.Diagnostics is imported by default and system32 is in the Path environment variable. I guess some users might remove it but assuming they haven't this is enough:
vb.net Code:
Process.Start("rundll32", "shimgvw.dll,ImageView_Fullscreen " & imagePath)
Obviously the imagePath can come from wherever you like, including an OpenFileDialog. Nice job tracking down the particulars though.
-
Jan 14th, 2008, 06:22 PM
#12
Re: [2005] Open picture and fax viewer
Thanks 
Yes, true you can shorten the System.Diagnostics part but I think what happened was I was debugging getting it to run and it was puking back at me about paths and files not being found that I just qualified them all to get it working 
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 14th, 2008, 06:30 PM
#13
Thread Starter
Frenzied Member
Re: [2005] Open picture and fax viewer
Okay dumb question AGAIN... I need to have a file path as a string to enable it to show my selected picture.... so I would use IO.Path.GetTempFileName() but how to get the temp file name of an image in my picturebox?
Code:
Dim imagePath As String = IO.Path.GetTempFileName()
-
Jan 14th, 2008, 07:02 PM
#14
Re: [2005] Open picture and fax viewer
Is the image in your picturebox loaded at runtime or is it a resource image?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 14th, 2008, 07:35 PM
#15
Re: [2005] Open picture and fax viewer
The Image in your PictureBox is NOT a file. It's an Image object. If it didn't come from a file in the first place then you have to save it to one. GetTempFileName gives you the path of a uniquely named, empty file. Have you saved your Image to that file?
-
Jan 14th, 2008, 07:47 PM
#16
Re: [2005] Open picture and fax viewer
If you do use a temp file don't forget to delete it afterwards too.
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
|