# VBForums UtilityBank > UtilityBank - Utilities >  [VB6] Picture/Video Viewer

## MartinLiss

Utility: Viewer/modifier for JPEG photographs and AVI and MPEG movies

Title: Picture Viewer

Description: Allows the user to view JPEG format photographs and AVI and MPG movies. It allows the JPEGs to be viewed in a variety of ways, to add descriptions to them, and to rotate, crop, print and delete them if desired.

Note: In order to run the Picture Viewer you will need to download the FreeImage.dll from here and place it in the App.Path since it's too big to attach, or PM me and I'll send you a copy.

Version 1.7 - 02/22/10:
 Added picture print function Add ability to change the size of of a movie while it is paused Added scrolling thank you's to Vb Forums members in Help|About Got rid of annoying beep heard when jumping to a specific image number Improved the thumbnail display Added sort by date Picture Created option Moved Select parent Folder option to File menu Corrected several minor bugs
Version 1.6 - 09/24/08:
 Add picture names to thumbnails Corrected bug involved in changing parent folder
Version 1.5 - 08/18/08:
 Added the ability to view movies Descriptive placeholder images now show up instead of "invalid picture" messages and in situations like the slideshow where a movie can't be shown. Added code so that the name of the picture or video always shows up in the screen caption. Corrected tab order of forms.
Version 1.4 - 08/03/08:
 Implemented a much faster method of finding the pictures in a folder Added Horizontal scrollbar for use with thumbnails, and changed the thumbnail exiting method to Esc to be consistent Load cursors and variable icons from a resource file instead of hard drive Added pause/resume feature in slideshow Removed "Normal" and "Full Screen" radio buttons in favor of a ControlBox Added more right-click popup menu items Corrected major problem where the addition of a long description would damage a photo. Corrected by removing PlanetSourceCode code with functions from the FreeImage library. Tested successfully with 3000 character description. Corrected a small bug where in rare instances a division by zero error could occur when creating a crop rectangle Corrected a small bug where the display of long comments was being cut off Corrected a small bug where in a long node list if the selected node required scrolling to get to then the selected node would go out of view after a slideshow Corrected a small bug where treeview width was not restored after running slideshow from Expanded view Corrected a small bug where when entering slideshow from full screen, the current photo wasn't resized
Version 1.3 - 07/25/08:
 Added image cropping function Added tooltips to main form Corrected a problem where the same starting tooltip was always shown depending on how the tips were closed Added more tips
Version 1.2 - 07/15/08:
Made several changes and corrections to zoom function including the prevention of the zoomed image from becoming too large, or smaller than the original size, implementation of Ctrl_R as a way to re-center the zoomed image, and the use of a "magnifying glass" cursorReduced picture flutter during resizing. (Thanks to Half Flung Pie)Added "Comments to be Ignored" menu item and dialog so that a list of camera manufacturer's comments can be maintained.Corrected problems the occurred when opening the app after the app had been closed in "Full Screen" modeMade corrections and improvements to slideshow picture description processing Added more tips
Version 1.1 - 07/12/08:
Made changes to accommodate 1024 x 768 and other resolutionsReplaced vbuSplitter2 (vbuSplitter2.ocx no longer needed) with codeAdded right-click popup menuAdded progress bar when loading picturesAdded option to set the number of photos that will trigger the display of the progress bar while loading the picturesMade a small change to the "Select the parent folder..." dialogAdded code to save form positionCorrected small bug where direction buttons had to be pressed twice after ending slideshowCorrected thumbnail display processing so that the thumbnail always displays the whole pictureMade small correction for Apple cameras. At least one Apple camera was placing "AppleMark" in the description area of the photo and the change was to not show that text. It will be overridden by any description added by this app. Added more tips
Version 1.0 - 07/07/08:
View photos one at a time or in a slide showView photos in "normal" or full screen modeAdd a description to a photo. Note: the description is stored in the photo. I've never had a problem with this but test it first with a photo you don't care about.View all the thumbnails at once for the photos in a folderZoom in or out on a photoRotate a photoSend a photo to the recycle bin

Known Problems:
When a picture is rotated, the internal thumbnail is not kept in sync, in other words it is not rotated.There may be some color distortion in the preview crop picture when one dimension is significantly larger than in the other. The distortions do not however show up in the final JPEG.

Screen-shots: See below

Author Name: Martin Liss

Thanks: See Help|About

----------


## half flung pie

MartinLiss, I believe we also need an OCX called vbusplitter2 and one called NumberBox. I'm assuming this "NumberBox.ocx" is the one linked to in your signature, but I don't know where to find vbusplitter2. 

The screenshot looks promising though!  :Smilie:

----------


## MartinLiss

Yes it is, but I've attached it here in a zip file along with VBUSplitter2. I'm also going to update my original zip above so that it includes them.

----------


## half flung pie

I'm not entirely sure why, but when I run Picture Viewer, I get only a screen with the directories and the picture. In other words, I have none of the buttons at the bottom of the screen. I'm wondering if this is a resolution issue, as I'm only running at 1024x768.

Another small thing I should point out: There is no indication to the user that the program is "loading...". When I click on "My Documents" or "My Pictures" there is a small amount of time when the program loads things from that directory. The program will appear to freeze for less than a second, and that is good. However, if I travel to a sub-directory in "My Pictures" called "Kodakz," Picture Viewer will appear to freeze for about a minute and a half while it processes 1.09GB (or 777 files) of images. All I'm proposing is placing a {"loading..." / "processing..." / whatever} image in the picDisplay before the processing happens. 

Another thing I just noticed,

VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)     cmdExit_Click    End Sub
Does not seem to work. I can click "X" many times and nothing happens. However, if I go to File, Exit, the program shuts down quickly. 

Otherwise, the program seems stable. If it didn't crash while going through my collection of pictures, I'm not sure it CAN crash. (I refuse to delete pictures)

----------


## MartinLiss

I'll fix the resolution issue.

As for "loading" indication, don't you see an hourglass?

As for cmdExit_Click, that's a holderover from when the form had a ControlBox and I'll remove that line, but that begs the question - what "x" are you clicking since there's none on the form?

----------


## half flung pie

There is indeed an hourglass, however since there are no "DoEvents", Picture Viewer appears frozen while processing large amounts of data. In fact, even Windows Task Manager labels it as "Not Responding."
Try finding a folder on your computer with many files. While Picture Viewer begins to load from that folder, leave the Picture Viewer window (for this window, perhaps.) Upon returning to Picture Viewer, you are presented with nothing but a white screen throughout the entire form. I know now that the program is not frozen (or in an infinite loop, perhaps) but when I first ran it, I was worried. 

In regards to the "x", my apologies. I use a window skinner (WindowBlinds 4.5) that skins every window on my screen. While it can be a very helpful (and stylish) tool, it apparently has its flaws  :Wink:

----------


## MartinLiss

Updated to V1.1

----------


## MartinLiss

hfp, please let me know how it works.

----------


## half flung pie

I love it! It works very fluidly for me now.

I changed picRightPane's AutoRedraw property to True because if you put something in front of it, the picturebox would turn black. 

Changing that property also messed with the picture flutter, although I'm not sure whether to call it a "helpful" or "harmful" change. The Picturebox no longer flutters, but the actual resizing of the form jitters now. 

I've thought of a way that could reduce the picture flutter, but I'm not sure how practical it is (or even if it is a good idea). Tell me what you think.

I believe right now you have something to the effect of

Pseudo Code:
Private Sub Form_Resize()
    Resize picRightPane    
End Sub
(In simplest form.)

Could something like this be used?

Pseudo Code:
Private Sub Form_Resize()
    If (Left mouse button isn't down) Then
        Resize picRightPane
    End If
End Sub
That way the form can be resized to your heart's content, but the picture won't redraw until you're actually done resizing (you lift the left mouse button). I'm not sure how practical this "method" is. It might look ugly, I'm not sure. Anyways, that's my take on the fluttering picture thing.

 :Smilie:  Great app!

----------


## MartinLiss

Thanks, I'll look into those things. I've also found and corrected some problems with the zooming function and I'll have an update soon.

----------


## MartinLiss

Updated to V1.2

----------


## MartinLiss

Updated to Version 1.3

----------


## MartinLiss

Please see post #1 concerning a serious problem.

----------


## MartinLiss

> Please see post #1 concerning a serious problem.


Updated and corrected to Version 1.4

----------


## MartinLiss

Updated to Version 1.5

----------


## MartinLiss

Updated to version 1.7

----------


## rajbdilip

Hello.
I downloaded it with MissingOCX.zip but when I open the project, it says NumberBox.ocx couldn't be loaded.

----------


## MartinLiss

You can create your own by compiling this.

----------


## RayComp

Greetings from South Africa. I came across  Picviewer code and downloaded the zip file containing the code, NumberBox.ocx and freeimage.dll

Both files are in the directory where the Picture Viewer.vbp is located.
I then registered NumberBox.ocx from the apps directory -  result DIIRegisterServer in D:\Picview\numberbox.ocx succeeded

Loading the Picture Viewer.vbp get message D:\Picview\NumberBox.ocx could not be loaded.

Running the project in any case I received error message when clicking on the  treeview and had to remove all references in the code referring to nbrGoTo.Text before I could run the project. After that the program worked OK except that I can not access the files inside the folders.

Should I do something (register?) freeimage.dll or not?
What else do I need to do?


Running Windows 7

----------


## Andrewpeter

Hi MartinLiss, thank you for your sharing, it's nice. If I want to zoom (in or out) by mousewheel then what do I do? How? Thanks. 
(It likes "windows picture and fax viewer" of windows).

----------


## MartinLiss

You'll have to make code changes of course and I can't do that since I don't have a mousewheel, but perhaps this thread or others you could search for here will help.

----------


## Andrewpeter

Thank MartinLiss, that is my need. It's very nice.

----------


## MartinLiss

Your welcome. If you have any suggestions to improve it please let me know.

----------


## Nightwalker83

Does this project allow for the modification of videos too or just photos?

----------


## MartinLiss

It's been 3 or 4 years since I last did anything with this and so I'm not sure, but I don't think so. Besides there are probably better utilities out there for doing that.

----------


## Nightwalker83

> It's been 3 or 4 years since I last did anything with this and so I'm not sure, but I don't think so. Besides there are probably better utilities out there for doing that.


Ah, I ask because I wondering is it is possible to create  a Video Editor in  VB6.0?

----------


## Bobbles

I am getting an error when trying to load the project into the IDE
It gets about 25% loaded, then displays this msgbox
"Visual Basic has encountered a problem and needs to close"

I am running in XP Pro 32bit SP3
I am using VB6 SP5  <==

I suspect one of two causes -
- I did not understand the FreeImage.dll instructions
All I did was place FreeImage.dll in the same folder as Picture Viewer.vbp.  FreeImage.dll is3296 KB. was that all I was meant to do ?
- Or, It is a SP problem  

I wonder if it is a SP5 vs SP6 problem ?
Does the IDE require SP6 for your project to load ?

The reasons that I have stuck with SP 5
- I avoid most dependencies, especially MS extra controls. Most of the SP6 fixes appeared to relate to them. Thus I did not need them.
- I do not install my programs. I just compile an EXE, and place it into a folder in their C directory
If any of my programs have a couple of dependencies (EG SGrid2), I just create an empty project (No source code, just dependencies), and use the P&D Wizard to make an installer.
They only ever have to run that installer once.
I never distribute/Install the the VB6 runtimes, as they are present in every Windows since W98SE
Some of those earlier Windows may not have VB6 SP6 runtimes.
By me sticking with SP5, I do not have to care which runtimes the user has, Thus I never need to 'Install' the runtimes.

----------


## MartinLiss

I also use XP Professional 32-bit SP3 but I don't remember how to find out my SP level for VB6. My FreeImage.dll is in the same folder as Picture Viewer.vbp, however my version of the dll is much smaller at 1892 KB so much may have changed since I developed this tool in 2008. If you'd like to discuss this further with me, please send me a private message.

----------

