Solved

EASY POINTS!!!!!!!!!!! OPEN Start up HTMLfile in VB

Posted on 2007-03-24
20
210 Views
Last Modified: 2010-04-06
HI
I'm using VB 6 to program a browser.
I set my program as the default program to open a HTML file.
When I clicked the HTML file, it opened my program, but doesn't show the file in the webbrowser control.
Is there any way to open the file by clicking it on my desktop?

Thanks
0
Comment
Question by:Mathwiz314
20 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18785670
How did you set it up?
Usually there's a reference like
appname.exe "%1"
to denote to open the target with your app...
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18786676
what do you mean?
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18786711
Well, usually when you set a file type to open with a specific app, the registry is updated to reflect this...
For instance, if you check your HKCR\txtfile\shell\open\command
you'll find a value there to determine that notepad opens %1 - the parameter passed to it (i.e, the file name):

%SystemRoot%\system32\NOTEPAD.EXE %1

Check your extension under that hive...
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 1

Author Comment

by:Mathwiz314
ID: 18789586
I already did that.
It's just that it doesn't display that file in the webbrowser control
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18790036
never mind I didn't read your comment carefully
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18790045
I don't understand you
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18790477
"I set my program as the default program to open a HTML file."
How did you do this?
0
 
LVL 3

Expert Comment

by:tang_tzuchi
ID: 18790619
hi, please correct me if im wrong.... you want to open your program from the desktop like clicking on the icon right? then you can export your program to exe. in vb 6 there is a command to export the program to exe format.
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18796932
@ tang tzuchi
no, I want open an html file by clicking the icon

@sirbounty
I right clicked to html icon and clicked "open with ..." > "choose program"
then I browsed for my program exe ,
next I checked "Alway use  the selected program ..."
and clicked ok
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18796944
Okay, so if you search for you program in the registry, you should find the reference in the HKey_Classes_Root hive path that I mentioned before...
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18797198
yes
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18797210
I need to display the file I'm opening in the webbrowser control
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18833505
Where is everyone?
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18833931
I'm not sure how to further assist here...I had hoped that someone else would chime in...
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18902165
I'm increasing the value of this Question
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18902210
You might try placing some pointer questions...
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18911433
what?
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 250 total points
ID: 18968801

okay, when your program starts, you are loading a form?

let's call that form1

now place this code in form1:


Private sub Form_Load()
   dim str as string
   str = Command$
   if len(trim(str)) <> 0 then
      'place here your code to navigate to the url,
       ' it is stored in str
       'could be something like Webbrowser1.navigate str
   end if
end sub

what you are doing here:
reading the commandline (Command$) and place it in the string str
check if str is not empty (the program was started by clicking on a file!)
and then you have to fill in your own code to do somthing with the url you just obtained
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18981009
it knows the string but it navigates
file:///"filename"
the quotes are still there
0
 
LVL 1

Author Comment

by:Mathwiz314
ID: 18981189
never mind
i did this
strOpenFile = Mid$(strOpenFile, 2, lenFile - 2)
thanks
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
countHi challenge 25 120
Live mode in DW, need to creae Session 4 94
word0 challenge 4 68
Message not shown 5 50
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question