[b][red]This message was edited by pht at 2002-10-19 13:45:14[/red][/b][hr]
view source of the currently viewed webpage in your webbrowser control
woohoo im so proud
(also, if anyone can figure out how to put the source into a textbox control instead of using notepad, please post a reply showing how
im working on it as i speak but its not looking good :O)
Add a webbrowser control, an Inet control and a command button.
module code :
[code]
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Const SW_SHOW = 5
Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hWnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
[/code]
form code
[code]
Private Sub Command1_Click()
On Error Resume Next
Dim lrs As String
lrs = "C:windows emp.htm"
Dim b() As Byte
Inet1.Cancel
Inet1.Protocol = icHTTP
Inet1.URL = WebBrowser1.LocationURL
If Inet1.URL <> "" Then
b() = Inet1.OpenURL(, icByteArray)
Open lrs For Binary Access Write As
#1Put
#1, , b()
Close
#1Dim retval As Long
retval = ShellExecute(Me.hWnd, "open", "C:windows
otepad.exe", lrs, "C:windows", SW_SHOW)
Else
MsgBox "There is no source code for this. It may be a System File"
End If
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "www.programmersheaven.com"
End Sub
[/code]
[red]ph[/red][blue][/blue][red]t[/red]
[red]
http://fade.to/phet[/red][blue]12d.hypermart.net[/blue]
[red]toadthefreak@hotmail.com[/red]
Comments
DjSpirit, <% Response.Write WordOfWisdom(Int(Rnd * 274)) %>[/grey]
:
: DjSpirit, <% Response.Write WordOfWisdom(Int(Rnd * 274)) %>[/grey]
:
kool i diddnt know that, could u post a bit of info on how?
[red]ph[/red][blue][/blue][red]t[/red]
[red]http://fade.to/phet[/red]
[blue]12d.hypermart.net[/blue]
[red]toadthefreak@hotmail.com[/red]
: :
: : DjSpirit, <% Response.Write WordOfWisdom(Int(Rnd * 274)) %>[/grey]
: :
:
: kool i diddnt know that, could u post a bit of info on how?
: [red]ph[/red][blue][/blue][red]t[/red]
: [red]http://fade.to/phet[/red]
: [blue]12d.hypermart.net[/blue]
: [red]toadthefreak@hotmail.com[/red]
:
:
Unless I miss my guess, isn't that what [red]ph[/red][blue][/blue][red]t[/red] is already doing?
: view source of the currently viewed webpage in your webbrowser control woohoo im so proud
:
: (also, if anyone can figure out how to put the source into a textbox control instead of using notepad, please post a reply showing how im working on it as i speak but its not looking good :O)
:
: Add a webbrowser control, an Inet control and a command button.
:
: module code :
: [code]
: Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
:
: Public Const SW_SHOW = 5
:
: Type SHELLEXECUTEINFO
: cbSize As Long
: fMask As Long
: hWnd As Long
: lpVerb As String
: lpFile As String
: lpParameters As String
: lpDirectory As String
: nShow As Long
: hInstApp As Long
: lpIDList As Long
: lpClass As String
: hkeyClass As Long
: dwHotKey As Long
: hIcon As Long
: hProcess As Long
: End Type
: [/code]
:
: form code
: [code]
: Private Sub Command1_Click()
: On Error Resume Next
[b]Dim t As String[/b]
: Dim lrs As String
: lrs = "C:windows emp.htm"
: Dim b() As Byte
: Inet1.Cancel
: Inet1.Protocol = icHTTP
: Inet1.URL = WebBrowser1.LocationURL
: If Inet1.URL <> "" Then
: b() = Inet1.OpenURL(, icByteArray)
: Open lrs For Binary Access Write As #1
: Put #1, , b()
: Close #1
[b]t = StrConv(b(), vbToUnicode)
Text1.Text = t[/b]
: Dim retval As Long
: retval = ShellExecute(Me.hWnd, "open", "C:windows
otepad.exe", lrs, "C:windows", SW_SHOW)
: Else
: MsgBox "There is no source code for this. It may be a System File”"
: End If
:
: End Sub
:
: Private Sub Form_Load()
: WebBrowser1.Navigate "www.programmersheaven.com"
: End Sub
: [/code]
: [red]ph[/red][blue][/blue][red]t[/red]
: [red]http://fade.to/phet[/red]
: [blue]12d.hypermart.net[/blue]
: [red]toadthefreak@hotmail.com[/red]
:
:
:
You might have to mess with the StrConv line a bit, I never remember how to pass arrays...