Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

I figured it out, here's how if anyone is interested...

phph Member Posts: 393
[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 :D

(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 #1
Put #1, , b()
Close #1
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]


Comments

  • DjSpiritDjSpirit Member Posts: 371
    [grey]Have you ever tried the Internet Transfer Control. It downloads only the source code.

    DjSpirit, <% Response.Write WordOfWisdom(Int(Rnd * 274)) %>[/grey]
  • phph Member Posts: 393
    : [grey]Have you ever tried the Internet Transfer Control. It downloads only the source code.
    :
    : 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]

  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : : [grey]Have you ever tried the Internet Transfer Control. It downloads only the source code.
    : :
    : : 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?
  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : [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 :D
    :
    : (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...
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    // http://forcoder.org // free video tutorials and ebooks about || Delphi, MATLAB, C, PHP, PL/SQL, Java, Visual Basic, Python, Visual Basic .NET, C#, Assembly, Go, JavaScript, R, Swift, Scratch, Perl, Objective-C, C++, Ruby Apex, Julia, Prolog, D, LabVIEW, Kotlin, Transact-SQL, Awk, Scala, Bash, Fortran, Hack, Lisp, Erlang, Clojure, Crystal, Alice, Lua, F#, ML, Ada, Rust, ABAP, Logo, Dart, FoxPro, SAS, COBOL, Scheme, VBScript || __________

Sign In or Register to comment.