Welcome Guest!
 VB 6 Helper
 Previous Message All Messages Next Message 
VB 6 Helper Newsletter  Rod Stephens
 Aug 19, 2009 10:15 PDT 

I've had two DevX articles posted recently.
----------
The second part of my DevX WPF 3-D article posted.

WPF Wonders: 3D Drawing with Textures, Transformations, and Realism
(Part 2)</A>
http://www.devx.com/dotnet/Article/42450

To build realism into 3D scenes, you need to draw with the appropriate
materials--and transformations help make the drawing process much
simpler.

This article explains how to use textures to make scenes more realistic.
Textures let you cover 3-D objects with bricks, wood grain, and so
forth.

The article also explains how to use transformations to make building
complex scenes easier.

The final example draws a wooden maze with a stone floor, containing a
spinning globe.
----------
And a new article on transformations posted. The examples show how to
build some pretty cool robots!

WPF Wonders: Transformations (and Robots!)
http://www.devx.com/dotnet/Article/42497

WPF's transformations make it easy to move, scale, or rotate objects,
and simplify building complex moveable 3D shapes.

This very cool article explains how to use transformations to make it
easeir to produce complex drawings. It explains basic transformations
that produce effects such as rotated, stretched, and skewed text.

I then explains how to use transformations can make building advanced
3-D scenes easier. It explains how to use transformations to model the
parts of a complicated models such as robots and provides two 3-D
examples that build a complex robot arm and a stick figure robot.
----------
On the HowTo front, I've posted VB 6 and VB .NET versions of a Web page
image scraper that pulls all of the images from a Web page. The two have
slightly different features because some things are easier to do than
others in the two languages. You may want to compare them to see what
you might like to take from one to the other. (For example, the VB 6
version doesn't provide image previews because it doesn't have an
easy-to-use FlowLayoutPanel.)
----------
Have a great week and thanks for subscribing!
----------
Rod
RodSte-@vb-helper.com

Books To Keep: http://www.BooksToKeep.com
----------
*** Now Available ***

Beginning Database Design Solutions
http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/

Visual Basic 2008 Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
==========

    VB6 Contents:
1. New HowTo: Grab images from a Web page in Visual Basic 6

    Both Contents:
2. New Links
==========
++++++++++
   <VB6>
++++++++++
==========
1. New HowTo: Grab images from a Web page in Visual Basic 6
http://www.vb-helper.com/howto_grab_web_images.html
http://www.vb-helper.com/HowTo/howto_grab_web_images.zip

This description only touches on the most interesting parts of the
program. Download it to see the details.

You can click the links on the WebBrowser to navigate to a Web page, or
enter a URL and click the Go button to navigate there. The following
code shows how the program navigates.


Private Sub cmdGo_Click()
    On Error GoTo BadNavigate
    wbrWebSite.Navigate txtUrl.Text
    Exit Sub

BadNavigate:
    MsgBox "Error navigating to web site " & _
        txtUrl.Text & vbCrLf & Err.Description, _
        vbOKOnly Or vbExclamation, "Navigation Error"
End Sub

After you have navigated to the desired Web page, click the Save button
to execute the following code.
The code gets the WebBrowser's Document property, which returns an
HtmlDocument object representing the Web page, and loops through the
HtmlDocument's Images collection. It calls subroutine DownloadPicture
for each image, passing the routine the image's src property, which
contains the image's URL.

This routine also contains code to let you stop the loop before it
finishes. See the code for details.

Private Sub cmdSaveImages_Click()
Dim doc As HTMLDocument
Dim element As HTMLImg
Dim dir_name As String

    If cmdSaveImages.Caption = "Save" Then
        Me.MousePointer = vbHourglass
        cmdSaveImages.Caption = "Stop"
        cmdGo.Enabled = False
        DoEvents

        ' List the images on this page.
        dir_name = txtDirectory.Text
        If Right$(dir_name, 1) <> "\" Then dir_name = dir_name & "\"

        Set doc = wbrWebSite.Document
        m_Running = True

        For Each element In doc.images
            DownloadPicture dir_name, element.src

            DoEvents
            If Not m_Running Then Exit For
        Next element

        m_Running = False
        cmdSaveImages.Caption = "Save"
        cmdGo.Enabled = True
        Me.MousePointer = vbDefault
        lblFile.Caption = "Done"
        Beep
    Else
        m_Running = False
    End If
End Sub

The DownloadPicture subroutine uses an Internet Transfer Control to
download a picture. It calls the control's OpenURL method to download
the image into a byte array. It then opens the appropriate file and
writes the bytes into it.

Private Sub DownloadPicture(ByVal dir_name As String, ByVal url As
String)
Dim file_title As String
Dim file_name As String
Dim pos As Integer
Dim bytes() As Byte
Dim fnum As Integer

    url = Trim$(url)
    If LCase$(Left$(url, 7)) <> "http://" Then url = "http://" & url

    file_title = url
    pos = InStrRev(file_title, "/")
    If pos > 0 Then file_title = Mid$(file_title, pos + 1)
    file_name = dir_name & file_title

    Debug.Print "Copying " & url & " to " & file_name
    lblFile.Caption = file_title
    lblFile.Refresh

    ' Get the file.
    bytes() = inetDownload.OpenURL(url, icByteArray)

    ' Save the file.
    fnum = FreeFile
    Open file_name For Binary Access Write As #fnum
    Put #fnum, , bytes()
    Close #fnum
End Sub

This program still has a few weak spots. For example, it doesn't display
previews of the images so it doesn't let you pick the images you want to
download, it just downloads them all. The .NET version of this program
does a better job of letting you pick images for download.

The program also downloads images when it needs them rather than pulling
them from cache so it isn't as fast as it might be. It also probably
cannot save images that are generated on the fly by the Web server.
==========
++++++++++
<Both>
++++++++++
==========
2. New Links
http://www.vb-helper.com/links.html

Math Worksheets World
http://mathworksheetsworld.com/
1,200 printable K-12 math worksheets.

Online Binary-Decimal Converter
http://www.binaryconvert.com/
A quick online application that converts between decimal and binary.
==========
Archives:
    http://www.topica.com/lists/VBHelper
    http://www.topica.com/lists/VB6Helper
    http://www.topica.com/lists/VBNetHelper

Post questions at:
    http://www.topica.com/lists/VBHelperQA
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.