how to make my photo viewer open when user open drive C and get all photo in the drive to be shown i

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi
I made an app wich view photo using this code
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
Imports
</font>
<span style="font-size:x-small Microsoft.Win32
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
Public
</font>
<span style="font-size:x-small <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Class<span style="font-size:x-small Form1<font size="2" style="font-size:x-small


</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Private<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Sub<span style="font-size:x-small Form1_Load(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small ByVal<span style="font-size:x-small
sender <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small System.Object,
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small ByVal<span style="font-size:x-small e
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small System.EventArgs)
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Handles<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small MyBase<font size="2 .Load</font>

<span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small If<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small My<span style="font-size:x-small .Application.CommandLineArgs.Count > 0
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Then<span style="font-size:x-small OpenPicture(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small My<font size="2 .Application.CommandLineArgs(0))</font><span style="font-size:x-small <font size="2" style="font-size:x-small
RegisterForAllFiles(
</font><span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small """"<span style="font-size:x-small & Application.ExecutablePath &
<span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small """"<span style="font-size:x-small &
<span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small " ""%1"""<span style="font-size:x-small ,
<span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small "Open with Max Photo Viewer"<font size="2 )</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<font size="2" color="#0000ff <font size="2" color="#0000ff Sub</font></font><span style="color:#0000ff; font-size:x-small <span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Private<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Sub<span style="font-size:x-small OpenPicture(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small ByVal<span style="font-size:x-small
imgFile <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small String<font size="2 )</font><span style="font-size:x-small
PictureBox1.Image = Image.FromFile(imgFile)
PictureBox1.Width = PictureBox1.Image.Width
PictureBox1.Height = PictureBox1.Image.Height
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
<font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<font size="2" color="#0000ff <font size="2" color="#0000ff Sub</font></font><span style="color:#0000ff; font-size:x-small <span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Private<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Sub<span style="font-size:x-small PictureBox1_Click(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small ByVal<span style="font-size:x-small
sender <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small System.Object,
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small ByVal<span style="font-size:x-small e
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small System.EventArgs)
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Handles<font size="2 PictureBox1.Click</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Dim<span style="font-size:x-small ofd
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small New<font size="2 OpenFileDialog</font><span style="font-size:x-small <font size="2" style="font-size:x-small
ofd.InitialDirectory =
</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small My<font size="2 .Computer.FileSystem.SpecialDirectories.Desktop</font><span style="font-size:x-small <font size="2" style="font-size:x-small
ofd.Filter =
</font><font size="2" color="#800000 <font size="2" color="#800000 "Images|*.jpg;*.tif;*.BMP;*.GIF;*.ico;*.PNG;*.TIF"</font></font><span style="color:#800000; font-size:x-small <span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small If<span style="font-size:x-small ofd.ShowDialog() = Windows.Forms.DialogResult.OK
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Then<font size="2 OpenPicture(ofd.FileName)</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<font size="2" color="#0000ff <font size="2" color="#0000ff Sub</font></font><span style="color:#0000ff; font-size:x-small <span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Public<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Shared<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Sub<span style="font-size:x-small RegisterForAllFiles(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small ByVal<span style="font-size:x-small
menuCommand <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small String<span style="font-size:x-small ,
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small ByVal<span style="font-size:x-small MenuText
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small String<font size="2 )</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Dim<span style="font-size:x-small key
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<font size="2 RegistryKey</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><font size="2" color="#0000ff <font size="2" color="#0000ff Try</font></font><span style="color:#0000ff; font-size:x-small <span style="font-size:x-small <font size="2" style="font-size:x-small
key = Registry.ClassesRoot.CreateSubKey(
</font><span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small "*shell"<font size="2 )</font><span style="font-size:x-small
key.Close()
<font size="2" style="font-size:x-small
key = Registry.ClassesRoot.CreateSubKey(
</font><span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small "*shell"<font size="2 & MenuText)</font><span style="font-size:x-small
key.Close()
<font size="2" style="font-size:x-small
key = Registry.ClassesRoot.CreateSubKey(
</font><span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small "*shell"<span style="font-size:x-small & MenuText &
<span style="color:#800000; font-size:x-small <span style="color:#800000; font-size:x-small "command"<font size="2 )</font><span style="font-size:x-small <font size="2" style="font-size:x-small
key.SetValue(
</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Nothing<font size="2 , menuCommand)</font><span style="font-size:x-small
key.Close()
<font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Catch<span style="font-size:x-small ex
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small As<font size="2 Exception</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<font size="2" color="#0000ff <font size="2" color="#0000ff Try</font></font><span style="color:#0000ff; font-size:x-small <span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small If<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Not<span style="font-size:x-small key
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Is<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Nothing<span style="font-size:x-small
<font size="2" color="#0000ff <font size="2" color="#0000ff Then</font></font><span style="color:#0000ff; font-size:x-small <span style="font-size:x-small
key.Close()
<font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<font size="2" color="#0000ff <font size="2" color="#0000ff If</font></font><span style="color:#0000ff; font-size:x-small <span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small End<span style="font-size:x-small
<font size="2" color="#0000ff <font size="2" color="#0000ff Sub</font></font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
End
</font>
<span style="font-size:x-small <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small Class
<span style="font-size:x-small <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small now how to make my photo viewer open
when user open drive C and get all photo in the drive to be shown in it ?
<span style="color:#0000ff; font-size:x-small

View the full article
 
Back
Top