473,388 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Sending a jpg file to internet explorer from my VB program, How???

I have a VB program which loads a jpg file into a picture box. I want to be
able to d/click on the picture box and have Internet Explorer show this jpg
file.
What code do I put into the Image1_DblClick() function to show this pic in
IExplorer??
Help would be appreciated.

Thanks
Trevor.
Jul 17 '05 #1
9 3967
The easy way is to poke a browser onto your form, and on d/click, do a
BrowserName.Navigate2 "filename of picture".

The harder (and possibly more rewarding way) would be to
have your program throw together an HTML file with all all your
formatting (still using the source file), and do a ShellExecute on
the .htm file.

"The Roys" <tr*****@hotmail.com> wrote in message
news:7j*********************@news-server.bigpond.net.au...
I have a VB program which loads a jpg file into a picture box. I want to be able to d/click on the picture box and have Internet Explorer show this jpg file.
What code do I put into the Image1_DblClick() function to show this pic in
IExplorer??
Help would be appreciated.

Thanks
Trevor.

Jul 17 '05 #2
"CajunCoiler (http://www.cajuncoiler.tk)"
<po**********@totallyspamless.cox.net> wrote in message
news:hhZgb.63466$a16.50139@lakeread01...
The easy way is to poke a browser onto your form, and on d/click, do a
BrowserName.Navigate2 "filename of picture".

The harder (and possibly more rewarding way) would be to
have your program throw together an HTML file with all all your
formatting (still using the source file), and do a ShellExecute on
the .htm file.

"The Roys" <tr*****@hotmail.com> wrote in message
news:7j*********************@news-server.bigpond.net.au...
I have a VB program which loads a jpg file into a picture box. I want to

be
able to d/click on the picture box and have Internet Explorer show this

jpg
file.
What code do I put into the Image1_DblClick() function to show this pic in IExplorer??
Help would be appreciated.


I don't know the exact syntax, but can't he just use the shell command
calling the browser, and passing the images path as a parameter?
Adrian
Jul 17 '05 #3

"Adrian Parker" <no@addy.com> wrote in message
news:GJ*******************@news20.bellglobal.com.. .
"CajunCoiler (http://www.cajuncoiler.tk)"
<po**********@totallyspamless.cox.net> wrote in message
news:hhZgb.63466$a16.50139@lakeread01...
The easy way is to poke a browser onto your form, and on d/click, do a
BrowserName.Navigate2 "filename of picture".

The harder (and possibly more rewarding way) would be to
have your program throw together an HTML file with all all your
formatting (still using the source file), and do a ShellExecute on
the .htm file.

"The Roys" <tr*****@hotmail.com> wrote in message
news:7j*********************@news-server.bigpond.net.au...
I have a VB program which loads a jpg file into a picture box. I want
to
be
able to d/click on the picture box and have Internet Explorer show
this jpg
file.
What code do I put into the Image1_DblClick() function to show this
pic in IExplorer??
Help would be appreciated.


I don't know the exact syntax, but can't he just use the shell command
calling the browser, and passing the images path as a parameter?
Adrian


In theory, it can be done that way, but it's quite haphazard as final
distribution
goes. The end user may have more than one browser installed. The way I
described, whichever browser is set as the default, will take the image. If
shelling out to a specific browser is used, what happens if that browser is
uninstalled? Using the ShellExecute API eliminates the need. If you're not
sure how to impliment it, I have written a module that interfaces with your
code like: ShellExec.RunFile "picture.htm". I can send to you via e-mail.
c a j u n c o i l e r @ c o x . n e t
Jul 17 '05 #4
>>I don't know the exact syntax, but can't he just use the shell command
calling the browser, and passing the images path as a parameter?
Adrian

In theory, it can be done that way, but it's quite haphazard as final
distribution
goes. The end user may have more than one browser installed. The way I
described, whichever browser is set as the default, will take the image. If
shelling out to a specific browser is used, what happens if that browser is
uninstalled? Using the ShellExecute API eliminates the need. If you're not
sure how to impliment it, I have written a module that interfaces with your
code like: ShellExec.RunFile "picture.htm". I can send to you via e-mail.
c a j u n c o i l e r @ c o x . n e t


You rely on the association of .HTM, IMHO that's even worse...
What if you set the execution of .HTM to Notepad, like I did?
Then no image will be shown :D
I don't know the code either, but this should be used to be 'almost'
fail-proof: ShellExec.DefaultBrowser "picture.htm"
And then you can use: ShellExec.DefaultBrowser "picture.jpg"

Cookie

Jul 17 '05 #5

"Cookie" <co******@SPAMyucom.be> wrote in message
news:bm**********@news.worldonline.be...
I don't know the exact syntax, but can't he just use the shell command
calling the browser, and passing the images path as a parameter?
Adrian

In theory, it can be done that way, but it's quite haphazard as final
distribution
goes. The end user may have more than one browser installed. The way I
described, whichever browser is set as the default, will take the image. If shelling out to a specific browser is used, what happens if that browser is uninstalled? Using the ShellExecute API eliminates the need. If you're not sure how to impliment it, I have written a module that interfaces with your code like: ShellExec.RunFile "picture.htm". I can send to you via e-mail. c a j u n c o i l e r @ c o x . n e t


You rely on the association of .HTM, IMHO that's even worse...
What if you set the execution of .HTM to Notepad, like I did?
Then no image will be shown :D
I don't know the code either, but this should be used to be 'almost'
fail-proof: ShellExec.DefaultBrowser "picture.htm"
And then you can use: ShellExec.DefaultBrowser "picture.jpg"


Setting the OPEN method of .htm files to notepad was not a very
smart thing to do. If you're going to play around with associations,
it's a LOT better to create an EDIT option for that, instead.

That edit method should read...
"c:\windows\notepad.exe" "%1"
....do not use DDE

Jul 17 '05 #6
CajunCoiler (http://www.cajuncoiler.tk) wrote:
"Cookie" <co******@SPAMyucom.be> wrote in message
news:bm**********@news.worldonline.be...
I don't know the exact syntax, but can't he just use the shell command
calling the browser, and passing the images path as a parameter?
Adrian

In theory, it can be done that way, but it's quite haphazard as final
distribution
goes. The end user may have more than one browser installed. The way I
described, whichever browser is set as the default, will take the
image. If
shelling out to a specific browser is used, what happens if that browser
is
uninstalled? Using the ShellExecute API eliminates the need. If you're
not
sure how to impliment it, I have written a module that interfaces with
your
code like: ShellExec.RunFile "picture.htm". I can send to you via
e-mail.
c a j u n c o i l e r @ c o x . n e t


You rely on the association of .HTM, IMHO that's even worse...
What if you set the execution of .HTM to Notepad, like I did?
Then no image will be shown :D
I don't know the code either, but this should be used to be 'almost'
fail-proof: ShellExec.DefaultBrowser "picture.htm"
And then you can use: ShellExec.DefaultBrowser "picture.jpg"

Setting the OPEN method of .htm files to notepad was not a very
smart thing to do. If you're going to play around with associations,
it's a LOT better to create an EDIT option for that, instead.

That edit method should read...
"c:\windows\notepad.exe" "%1"
....do not use DDE


Excuse me, but I'm not 'playing' around... I know exactly what I'm doing...

I have an whole bunch of alternative associations.
I tweak the register a lot. I'm not an avarage user.

I edit html-pages a lot, that's why I changed the default association to
notepad. When I want to view an HTM in the browser I choose 'View'
(which I also created). BTW, links in documents etc. to html-pages still
works fine, cause they all use the method they should use. This means
not relying on the associations, but start the (defaul)browser with the
right parameters....

Cookie

Jul 17 '05 #7
On Wed, 8 Oct 2003 21:56:05 -0500, "CajunCoiler
\(http://www.cajuncoiler.tk\)" <po**********@totallyspamless.cox.net>
wrote:

<snip>
In theory, it can be done that way, but it's quite haphazard as final
distribution
goes. The end user may have more than one browser installed. The way I
described, whichever browser is set as the default, will take the image. If
shelling out to a specific browser is used, what happens if that browser is
uninstalled? Surely if that is the case then finding the default browser will fail
or come up with crud

My understanding is that ShellExecute calls FindExecutable
Using the ShellExecute API eliminates the need. If you're not
sure how to impliment it, I have written a module that interfaces with your
code like: ShellExec.RunFile "picture.htm".


There is a pretty good case for knowing that the 'viewer' one is going
to launch is _not_ the default viewer for the extension

There is nothing wrong with launching a browser to view a JPG
- but it is unlikely that ShellExecute would launch a browser ...

Jul 17 '05 #8
There is nothing wrong with launching a browser to view a JPG
- but it is unlikely that ShellExecute would launch a browser ...


If the file you're trying to execute is something browseable, such as a
website URL, or a mailto, then it would... that's how I put links on
forms.

Put this code in a module called "ShellExec" ...

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Public 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 Const SW_SHOWNORMAL = 3
Public Function RunFile(ByVal strDocName As String) As Long
Dim Scr_hDC As Long
Dim lngRes As Long
Scr_hDC = GetDesktopWindow()
RunAssociateFile = ShellExecute(Scr_hDC, "Open", strDocName, "", "C:\",
SW_SHOWNORMAL)
End Function

Now you can do things like...

Go to a website: ShellExec.RunFile " http://www.cajuncoiler.tk "
Send an email: ShellExec.RunFile " mailto:ca*********@cox.net "
Jul 17 '05 #9
On Sat, 11 Oct 2003 17:59:21 -0500, "CajunCoiler
\(http://www.cajuncoiler.tk\)" <po**********@totallyspamless.cox.net>
wrote:
There is nothing wrong with launching a browser to view a JPG
- but it is unlikely that ShellExecute would launch a browser ...
If the file you're trying to execute is something browseable, such as a
website URL, or a mailto, then it would... that's how I put links on
forms.

Put this code in a module called "ShellExec" ...


I think you misunderstood what I was saying.

My point was that ShellExecute is useless if you want to use a
different App to display (say a JPG) than the one associated in the
Registry

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Public 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 Const SW_SHOWNORMAL = 3
Public Function RunFile(ByVal strDocName As String) As Long
Dim Scr_hDC As Long
Dim lngRes As Long
Scr_hDC = GetDesktopWindow()
RunAssociateFile = ShellExecute(Scr_hDC, "Open", strDocName, "", "C:\",
SW_SHOWNORMAL)
End Function

Now you can do things like...

Go to a website: ShellExec.RunFile " http://www.cajuncoiler.tk "
Send an email: ShellExec.RunFile " mailto:ca*********@cox.net "


Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Kubaton Lover | last post by:
I have a pdf file (syllabus.pdf) on the server. I have written the following PHP code. It correctly finds the file, but it is sending the file back as text I think because I'm seeing the binary...
2
by: Raymond H. | last post by:
Hello, I create a vb4 project which can also naviger on Internet via the WebBrowser control which I put on my form. My question is: if this program is installed on a station having already...
5
by: Michael Brennan | last post by:
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
2
by: Frostillicus | last post by:
I'm trying to get an ASP to return a zip file to the remote browser from an Image (BLOB) field in SQL Server 2000 but Internet Explorer keeps saying: Cannot open C:\Documents and...
6
by: harry | last post by:
Hi, I have a program that runs on multiple client pc's. Occasionally one or more of those pc's use VPN to connect to another corporate network. When using VPN they need to set proxy server in...
0
by: Reimar Bauer | last post by:
Dear all I have written a data handling tool in php and probably you all know already what are my problems. Lets explain: I have found some strange behaviour in Internet Explorer filling...
4
by: tshad | last post by:
At work we are setting up a new web site and had a problem with running a page when using URL: \\phoenix\cdrive\inetpub\wwwroot\hrworkshop\index.aspx It would start up notepad to edit the...
3
by: BASSPU03 | last post by:
Private Sub FilePath_Click() Rem Me! Dim stAppName As String Dim stlink As String stlink = Me! stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE...
7
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.