|
-
Oct 14th, 2001, 03:36 PM
#1
Thread Starter
Junior Member
Writing my first program. Seeking veteran VB user help.
Hi, I am a 16 year old who just decided to create a program with my dad's VB6, I have been interested in making programs before but I've never got my mind set to do so.
The program itself shouldn't be very complex (But what do I know about VB? ) it is a personalized image viewer of sort.
First I want to make a splash screen for my program, but as I run the program, it goes straight to my frmMain and skips the splash screen completely.
If anyone out there is willing to help me. I will send you my progress as I go along, explain what I'm trying to achieve with my program via pictures, and I will most definately be grateful and include a thanks to you in my program. (It's not much, but I guess a way of showing gratitude.)
Hopefully someone out there will be willing to help me build my program step by step. All help will be appreciated.
-
Oct 14th, 2001, 03:43 PM
#2
Hyperactive Member
this is how u can set the spash screen to be the first screen to show:
Select project in the menu, choose project properties.
There u can select which form is the startup form, choose your splash screen
-
Oct 14th, 2001, 03:53 PM
#3
Frenzied Member
I Just turned 17 and i have to save your in for the time of your life cuz vb is fun and easy . I have created complex and simple programs.
About the splash screen if you want have it load when your form loads and have it load it MODAL to your form like
Code:
Private Sub Form_Load()
frmSplash.Show Modal, Me
End Sub
try it.
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 04:14 PM
#4
Thread Starter
Junior Member
Thank you schuurke28 and JasonLpz for your help in the beginning of my first program. Your help does not go unappreciated.
What I want to achieve in my program, is to create an image viewer.
So in frmMain I will have imgMain which will show images which have been pre-selected by an existing database. There will be 2 buttons, cmdNext and cmdPrevious and a drop-down list for navigation through the images.
Now, my dad has told me that to do that I need to create the database first and link it to the controls.
Could anyone help me out to create a database and how to link them with my controls?
PS. Once again, the splash screen help worked succesfully. Thank you for your help.
-
Oct 14th, 2001, 04:41 PM
#5
Fanatic Member
Here is an example of images in a database. Courtesy of Beacon.
-
Oct 14th, 2001, 05:14 PM
#6
Frenzied Member
at the moment i just finished createing a image viewer if you would like some code or the program tell me its a simple image viewer no complex sH** lol. heres a image of it
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 05:38 PM
#7
Lively Member
I'm 16, been doing VB since version 3, it is pretty simple. I reccomend for simple database replacement the INI API, rather than worry about SQL and all INI's just make it really easy.
I don't konw if I totally understand what you want, but eMail me if you want help, my eMail is in my profile...
Josh
[EDIT: I noticed that in the tutorial you actually have the image in the database, you can't do that with an INI file, it just saves the path, this is what I would recomend unless you actually want to use a database.]
Last edited by Zevlag; Oct 14th, 2001 at 05:45 PM.
Josh -- Name
Zevlag13 -- AIM
www.WotsIt.org for all your file format spec questions!
-
Oct 14th, 2001, 05:38 PM
#8
Thread Starter
Junior Member
Wow I am very impressed. May I get the code for your program so I could take a closer look at it?
My e-mail address is [email protected]
-
Oct 14th, 2001, 05:40 PM
#9
Fanatic Member
i would also recommend writing and reading a ini file. A LOT easier than working with Databases.
You can also e-mail me if ya need help. (see below)
-
Oct 14th, 2001, 07:05 PM
#10
Thread Starter
Junior Member
Thanks for all your help. I have yet more questions about VB, is it possible to make my program search an assigned folder for all files with the *.bmp extention whenever the program is started and put it in a list in a combo alphabetically so I could navigate them with ease?
Also, is it possible for me to cue a sound clip as the splash screen is launched?
-
Oct 14th, 2001, 07:14 PM
#11
PowerPoster
Originally posted by Almasy
Thanks for all your help. I have yet more questions about VB, is it possible to make my program search an assigned folder for all files with the *.bmp extention whenever the program is started and put it in a list in a combo alphabetically so I could navigate them with ease?
Drop a FileList control on a form, set the path and pattern properties.
Also, is it possible for me to cue a sound clip as the splash screen is launched?
See this tip http://www.vbsquare.com/graphics/tip402.html
Last edited by chrisjk; Oct 14th, 2001 at 07:20 PM.
-
Oct 14th, 2001, 07:16 PM
#12
Fanatic Member
To play a sound use this.
VB Code:
'Play A sound
'Paste this code into a bas module
'
'API Function to play the sound
'
Declare Function sndPlaySound Lib "winmm" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
'
' play synchronously (default)
Public Const SND_SYNC = &H0
' play asynchronously
Public Const SND_ASYNC = &H1
' loop the sound until next
Public Const SND_LOOP = &H8
'=====================================================
'Paste this code into the main
'from your main program (button or load or whatever):
'call the function using your wave file & location..replace "A:\whoosh.wav"
'
Call sndPlaySound(ByVal "a:\whoosh.wav", SND_ASYNC)
'to stop it playing
call sndPlaySound("")
-
Oct 14th, 2001, 07:33 PM
#13
Thread Starter
Junior Member
Where would I enter the path properties? I can't seem to find it.
Plus, How would I make it so that my imgMain will load the first item on the filelist and to navigate the filelist with cmdPrevious and cmdNext buttons?
-
Oct 14th, 2001, 07:41 PM
#14
Fanatic Member
http://www.vbsquare.com/graphics/tip402.html
that tip is for playing a sound not the folder thing.
I would just use the code i listed above to play the sound.
-
Oct 14th, 2001, 07:47 PM
#15
PowerPoster
Zevlag:
"[EDIT: I noticed that in the tutorial you actually have the image in the database, you can't do that with an INI file, it just saves the path, this is what I would recomend unless you actually want to use a database.]"
And this is in reference to what!
Look at the title: "Storing Images in an Access Database" i dont say anything about a .ini file! But you do make a good point though i'm pretty sure you could store an image in an .ini file but why the hell would you! Not the image but the binary data!
Stickman:
I disagree learn databases!
-
Oct 14th, 2001, 07:48 PM
#16
Fanatic Member
Originally posted by Beacon
Stickman:
I disagree learn databases! [/B]
I didn't say he shouldn't learn them, but i think ini files would work fine for the job all that is needed is storing the path to the pictures.
Maybe i misunderstand what he wants to do.
Does he want to actually store the picture or just store where they are located so they can be viewed with the viewer?
-
Oct 14th, 2001, 08:10 PM
#17
PowerPoster
oh sorry!!!
Perhaps but what if he wants to say have them indexed as well by filename, title, description, extension, size, project etc etc. surely there's more extended choices in dtabases than in a .ini file.
-
Oct 14th, 2001, 08:11 PM
#18
-
Oct 14th, 2001, 08:24 PM
#19
Frenzied Member
Almasy I have sent you the source hope it helps you and plz no one else ask me for the source. If anyone needs help though tell me.
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 08:26 PM
#20
Thread Starter
Junior Member
Ok maybe I should have been more clear on what I wanted to achieve. What I want is a Filelistbox which will show all the *.bmp files in an assigned folder. And when the program is first launched, it will automatically view the first item on the filelistbox.
I want 2 commands cmdPrevious and cmdNext to allow navigation through the .bmp files of the filelistbox with ease. The pictures will be displayed in the imgMain
I would like to be able to designate the folder and make presets (assigned directories i.e. c:\downloads\pictures1)
P.S. I would like the filelistbox to list the files in alphabetical order
-
Oct 14th, 2001, 08:26 PM
#21
Fanatic Member
1 question did u make that program layout/skin or is it because the way your windows is setup?
-
Oct 14th, 2001, 08:29 PM
#22
Frenzied Member
yeah its a skin. So anyone can enjoy it lol
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 08:34 PM
#23
Thread Starter
Junior Member
JasonLPZ, your program sure is impressive. I like how you created a custom skin for the program. What seemed annoying is it kept telling me I should register my ActiveSkin file . I'm very wowed by your skinning job and I was wondering how did you enforce it into your program, will it do that annoying register thing in the .exe form, and are there any other skins you can use.
-
Oct 14th, 2001, 08:45 PM
#24
PowerPoster
Originally posted by Almasy
Where would I enter the path properties? I can't seem to find it.
Just enter them at runtime
VB Code:
Private Sub Form_Load()
File1.Path = "C:\My Documents\"
File1.Pattern = "*.jpg;*.bmp"
End Sub
-
Oct 14th, 2001, 08:47 PM
#25
Frenzied Member
Hey JasonLpz could you send me the code and stuff for your menus and Close, Minimize, and Restore buttons? I really like that effect..e-mail it to me at [email protected]. Thanks.
-
Oct 14th, 2001, 08:49 PM
#26
PowerPoster
Originally posted by Almasy
I want 2 commands cmdPrevious and cmdNext to allow navigation through the .bmp files of the filelistbox with ease. The pictures will be displayed in the imgMain
VB Code:
Private Sub cmdBack_Click()
If File1.ListIndex >= 1 Then File1.ListIndex = File1.ListIndex - 1
End Sub
Private Sub cmdNext_Click()
If File1.ListIndex < File1.ListCount - 1 Then File1.ListIndex = File1.ListIndex + 1
End Sub
-
Oct 14th, 2001, 08:49 PM
#27
Thread Starter
Junior Member
Originally posted by chrisjk
Just enter them at runtime
VB Code:
Private Sub Form_Load()
File1.Path = "C:\My Documents\"
File1.Pattern = "*.jpg;*.bmp"
End Sub
I put them exactly as you told but it resulted in runtime error '424' object required.
*Edit* I fixed the name of the Filelistbox and it works wonders. Sorry for confusion
Last edited by Almasy; Oct 14th, 2001 at 08:53 PM.
-
Oct 14th, 2001, 08:50 PM
#28
PowerPoster
Did you put a FileListBox on the form. It must be a filelist box, not a normal listbox
-
Oct 14th, 2001, 08:52 PM
#29
PowerPoster
adding to chris's code:
Private Sub Form_Load()
File1.Path = "C:\My Documents\"
File1.Pattern = "*.jpg;*.bmp"
image1.picture = loadpicture(file1.list(0))
End Sub
off the top of me head!
And chris r u on whizz??? What the time there?
-
Oct 14th, 2001, 08:54 PM
#30
PowerPoster
Originally posted by Beacon
And chris r u on whizz??? What the time there?
No E's or Whizz...it's only 10 to 3
-
Oct 14th, 2001, 08:57 PM
#31
Frenzied Member
ok its a skin program by soft shape.
http://www.softshape.com/activeskin/
Its $99 (wow alot not really if you look around you can get it free) Ya all didnt hear it from me lol
Anyway its asking you for the ocx registering cuz its not installed on your pc when the exe is made and you install it on your PC with the setup program, it will not ask for it it will be perfect (Hopefully lol)
Almasy check your mail and
chrisjk
Its a FileListBox & DriveListBox & Text Box be creative and it will be worth it i had fun doing this program.
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 08:59 PM
#32
Thread Starter
Junior Member
Thank you everyone for your support so far. Beacon, your addon to view the first image on the top of the list doesn't work for some reason it says the picture file does not exist.
Now I would like to add a feature on the program. Is it possible to make an in program button, namely cmdDirectory to change the paths in the program?
-
Oct 14th, 2001, 09:00 PM
#33
Fanatic Member
Almasy - Here is a small portion of code to get you thinking of how to accomplish a image viewer.
-
Oct 14th, 2001, 09:02 PM
#34
PowerPoster
Originally posted by JasonLpz
chrisjk
Its a FileListBox & DriveListBox & Text Box be creative and it will be worth it i had fun doing this program.
Come again?
Is it possible to make an in program button, namely cmdDirectory to change the paths in the program?
Yes, just set the path like I showed you. You could use this code to enhance the usability by letting them chose from the Standard Windows dialog
VB Code:
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo
With udtBI
'Set the owner window
.hWndOwner = Me.hWnd
'lstrcat appends the two strings and returns the memory address
.lpszTitle = lstrcat("C:\", "")
'Return only if the user selected a directory
.ulFlags = BIF_RETURNONLYFSDIRS
End With
'Show the 'Browse for folder' dialog
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'Get the path from the IDList
SHGetPathFromIDList lpIDList, sPath
'free the block of memory
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
MsgBox sPath
End Sub
-
Oct 14th, 2001, 09:02 PM
#35
Frenzied Member
Private Sub Form_Load()
File1.Path = "C:\My Documents\"
File1.Pattern = "*.jpg;*.bmp"
image1.picture = loadpicture(file1.list(0))
End Sub
IS NOT WHAT I USE
Code:
I Use the below
Private Sub SkinButton1_Click()
If File1.FileName = "" Then
MsgBox "No File Selected", vbCritical, "No File"
Unload Me
Else
Dim FileName As String
If Text1.Text = "C:\" Then
FileName = Text1 & File1.FileName
Form1.Image1.Picture = LoadPicture(FileName)
Unload Me
Else
FileName = Dir1.Path & "\" & File1.FileName
Form1.Image1.Picture = LoadPicture(FileName)
Unload Me
End If
End If
End Sub
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 09:04 PM
#36
PowerPoster
Originally posted by JasonLpz
IS NOT WHAT I USE
A) I don't care
B) Don't shout at me
-
Oct 14th, 2001, 09:05 PM
#37
Frenzied Member
WHY DO YOU GUYS TURN SOMETHING SIMPLE INTO A HELL > ALL THAT CODE ISNT NEEDED MAN JUST KEEP IT LOW
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 09:07 PM
#38
PowerPoster
You need to take some pills man, now let the grown ups discuss VB whilst you play with your Action Man.
-
Oct 14th, 2001, 09:07 PM
#39
Frenzied Member
Originally posted by chrisjk
A) I don't care
B) Don't shout at me
If i was shouting at you i would put !!!!!!!!!!!!!!! im just making sure you all know what i dont use ok and too bad if you dont care . Do you get mood swings ?? LOL DONT Bark at me man.
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Oct 14th, 2001, 09:09 PM
#40
Frenzied Member
You say
You need to take some pills man, now let the grown ups discuss VB whilst you play with your Action Man
yet your a grown up ?????????????
I Dont think so!
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
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
|