Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-06-2005, 10:55 PM   #1
BSOD
 
Computergen's Avatar
 
Join Date: Dec 2004
Posts: 3,175
Default Visual Basic Web Browser Help

http://www.futuregencomputers.com/br...uild%20007.zip

Yeah, thats the browser I made, quite bootleg but I want to get more features, I was wondering how I would do the following:

Make it so it has aset home page

And

Make it so it can have links like that google one.

Heres a screenshot of the beast:

__________________

Computergen is offline   Reply With Quote
Old 12-07-2005, 02:49 PM   #2
BSOD
 
Computergen's Avatar
 
Join Date: Dec 2004
Posts: 3,175
Default Re: Visual Basic Web Browser Help

bump
__________________

Computergen is offline   Reply With Quote
Old 12-07-2005, 04:39 PM   #3
Golden Master
 
135791's Avatar
 
Join Date: May 2004
Location: No
Posts: 5,427
Send a message via MSN to 135791
Default Re: Visual Basic Web Browser Help

dude thats awesome

i was looking at making something cool in visual basic for a project outside of college so far i started a encryption program

i might try and make my own browser now lol sorry to steel the idea

by the links do you mean ones that people can add or ones that are always there?
135791 is offline   Reply With Quote
Old 12-08-2005, 10:05 AM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: Visual Basic Web Browser Help

Can I assume that you are using the browser object?
(Webbrowser1).
so to navigate you have a text box called addess
and you navigate to a page you simply call the line
Code:
webbrowser1.navigate address.text
If so there are two ways you could do this...

to set a static home page that you can't change see this code...

Code:
address.text = "http://www.google.com"
webbrowser1.navigate address.text
To have a home page that you can set I suggest you use an INI file to store the variable page...


to do this...

frist create a module insode the program with this code in it
Module1
Code:
' Below function is used to READ from INI file
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

' Below function is used to WRITE to INI file
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long

Now put this code into the main form code...

To set the homepage from an address that is in the addressbar (address)

Code:
'global variables
Dim lpAppName As String
Dim lpKeyName As String
Dim lpBuffer As String
Dim lpFileName As String
Dim ret As Long
Dim nSize As Long

Form_load()

temp$ = Dir("C:\windows\browsersettings.ini")
'the file size should only be that of the title, if this has changed the file already exist so take no action.
If temp$ <> "browsersettings.ini" Then

'create blank file
Open "C:\windows\browsersettings.ini" For Output As #1

'print text in INI file
Print #1, "[Homepage]"
Print #1, "address=http://www.google.com"
Close #1 'Close the file...

End If

'Fill the INI variables with the appropriate info...
lpAppName = "Homepage" 'The section of the INI...
lpKeyName = "address" 'The line in the section of the INI...

lpFileName = "C:\windows\browsersettings.ini" 'The location of the INI...

address.text = lpKeyName

End Sub

private Sub Goto-home-page_click()
lpbuffer = space(255)
'read homepage values from INI file
ret = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpBuffer, nSize, lpFileName)

webbrowser1.navigate lzbuffer

endsub
*note this isn't tested...
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 12-08-2005, 01:27 PM   #5
Golden Master
 
135791's Avatar
 
Join Date: May 2004
Location: No
Posts: 5,427
Send a message via MSN to 135791
Default Re: Visual Basic Web Browser Help

now that would store its permantly yes?

if say the computer was restarted as it would look to that file?
135791 is offline   Reply With Quote
Old 12-08-2005, 02:21 PM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: Visual Basic Web Browser Help

yes,
the code looks for the INI file... and if it's not fuond it writes it and stores google as the home page...


next time the user clicks tha home button it'll read that from the INI file and go to whatever the store page is...

I might have got some things wrong, cause it was very much from the top of my head and taken from an old project I was working on... but all the functions are correct... so if it doesn't work, thn a little poking around coding sites will give the answers... at least you have the right questions to ask now though.
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 12-08-2005, 03:50 PM   #7
Golden Master
 
135791's Avatar
 
Join Date: May 2004
Location: No
Posts: 5,427
Send a message via MSN to 135791
Default Re: Visual Basic Web Browser Help

looks why to over complicated to me

:-/
__________________

135791 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:18 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0