A Few More Questions

Discussion in 'Programming General' started by 0h n035, May 6, 2008.

A Few More Questions
  1. Unread #1 - May 6, 2008 at 6:09 PM
  2. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    Hullo. I've been progressing quite nicely with my client, but now I'm deciding to make a Web Browser.

    Just wondering, will this work for all resolutions?

    Code:
    Private Sub Form_Resize()
    ' 21480 - client width
    ' 21600 - browser width
    ' 12690 - client height
    ' 11250 - browser height
    Wweb.Width = Browser.Width - 120
    Wweb.Height = Browser.Height - 1927
    End Sub
    My Resolution is 1440 x 990 and it looks perfect, but would it look the same for someone with a resolution of 1024 x 768?

    Secondly, could someone explain each line of this code:

    Code:
    AUWstr = Shares.Inet1.OpenURL("http://money.ninemsn.com.au/shares-and-funds/quotes?subsectionid=4068&subsectionname=Researchacompany_Quotes&code=AUW&ctry=AX&inforeq=Quotes")
    AUW1() = Split(AUWstr, "<td class=")
    AUW2() = Split(AUW1(1), "<td class=""quoteChangeUp"">")
    AUW3() = Split(AUW2(0), """quoteLastSale"">")
    AUW4() = Split(AUW3(1), "</td>")
    To be honest, I ripped it, but I got it to grab numbers from a shares page for my Dad. Now I'd like to know exactly what I've done :p The things that confused me were the (1) and (0) parts. So far, all I know is that it's making the Inet in the Shares Form navigate to te page up there and the source code of that page becomes AUWstr. Then AUW1, 2, 3 and 4 split it up to find exactly what I want. The main thing I want is an explanation (If mine is wrong) and what the (1) and (0) parts are for. My guess is that its Before and after or between.

    My last question is about the Mozilla Control. I've added it to my Web Browser and in the installation I've included the ocx and mozctlx.dll. Yet when installing it asks for you to search for a Bin Folder and when run, my users (Not me, but the rest of my users [Even the ones with FireFox]) get this error:

    http://img413.imageshack.us/img413/7894/againon9.jpg

    When I got this Mozilla Control, It downloaded a bunch of files in my Program files directory. I included ALL of them in the installation, but still no success.

    Any idea?
     
  3. Unread #2 - May 6, 2008 at 7:46 PM
  4. demonavenger
    Joined:
    Feb 25, 2007
    Posts:
    536
    Referrals:
    0
    Sythe Gold:
    0

    demonavenger Forum Addict
    $5 USD Donor

    A Few More Questions

    Hmm why dont u make the web browser fit to the forms width?

    Code:
    Wweb.width = me.scalewidth
    Wweb.height = me.scaleheight
    
    Code:
    AUWstr = Shares.Inet1.OpenURL("http://money.ninemsn.com.au/shares-and-funds/quotes?subsectionid=4068&subsectionname=Researchacompany_Quotes&code=AUW&ctry=AX&inforeq=Quotes")
    The String AUWstr has been set to make inet open up a URL... not sure bout the Shares.inet1...

    Code:
    AUW1() = Split(AUWstr, "<td class=")
    AUW2() = Split(AUW1(1), "<td class=""quoteChangeUp"">")
    AUW3() = Split(AUW2(0), """quoteLastSale"">")
    AUW4() = Split(AUW3(1), "</td>")
    This is grabbing the source code of the page to find out sales or something and splitting it so viewers can find out in like a label, textbox, etc.
     
  5. Unread #3 - May 7, 2008 at 2:54 AM
  6. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    I got bits and pieces around the place so that works for me.

    That's because this function is in another file. It's Shares.Inet because the Inet is in the Shares Form.

    Cool, that's what I thought. Just need an explanation about the (0) and (1) bits.
     
  7. Unread #4 - May 7, 2008 at 3:10 AM
  8. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A Few More Questions

    Yours will not work on all screen res's as the "-120" part is in twips. Now your screen resolution is the same as mine and our twips per pixel is 15. But it varies from monitor to monitor and size to size. So you this method.

    Code:
    Private Sub Form_Resize()
    ' 21480 - client width
    ' 21600 - browser width
    ' 12690 - client height
    ' 11250 - browser height
    Wweb.Width = Browser.Width - (8 * Screen.TwipsPerPixelX)
    Wweb.Height = Browser.Height - (128.46666 * Screen.TwipsPerPixelY)
    End Sub
     
  9. Unread #5 - May 7, 2008 at 5:35 AM
  10. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    Thank you very very much. You're a legend ;)
     
  11. Unread #6 - May 11, 2008 at 6:08 PM
  12. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    Hmm... Another Question. I've got a frame which I want to be draggable. I've tried lots of different things, but it won't work. I don't want it to only be draggable into certain parts, I want it to be draggable across the whole form.

    Anyone know how I could do that?
     
  13. Unread #7 - May 12, 2008 at 3:24 AM
  14. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A Few More Questions

    Set the following properties on your Frame:
    DragMode: 1 - Automatic
    OLEDropMode: 1 - Manual

    The add this to your Form:
    Code:
    Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
        Source.Left = X
        Source.Left = Y
    End Sub
    That is a dodgy way to do it, but it does the job (roughly).
    You can fine tune it by getting the Co-ordinates of where the control was before you starting to drag it. You can do that in the following Frame Event.
    Code:
    Private Sub Frame1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
    
    End Sub
     
  15. Unread #8 - May 12, 2008 at 3:29 AM
  16. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    A Few More Questions

    I'm sure cruel posted a source for that a long time ago (about a year) mind you it was a simple, x1-x2 source, but still nifty none-the-less
     
  17. Unread #9 - May 12, 2008 at 4:33 AM
  18. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    1. You did Source.Left twice XD
    2. It didn't work. Here's the settings I have:

    Appearance: Flat
    Border Style: 0 - None
    ClipControls: True
    DragMode: 1 - Automatic
    OLEDropMode: 1 - Manual
    Enabled: True

    It's a frame with a square around another frame. Inside that inside frame is a webbrowser. Whenever I drag the Outer Frame, it moves back when I lift my finger off the Mouse Button

    I'll look for it. If you find it (Or something Similar, let me know).
     
  19. Unread #10 - May 12, 2008 at 6:13 AM
  20. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    A Few More Questions

    Tried to search, tried 3 times, no results. Heres my version

    Code:
    Dim sStoredX As Single, sStoredY As Single
    
    
    Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
        Frame1.Move X - sStoredX, Y - sStoredY
    End Sub
    
    Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Frame1.Drag 1
        sStoredX = X
        sStoredY = Y
    End Sub
    
     
  21. Unread #11 - May 12, 2008 at 6:14 AM
  22. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A Few More Questions

    My bad
    Also set the Form's OLEDropMode to 1 - Manual
     
  23. Unread #12 - May 14, 2008 at 3:11 AM
  24. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    That won't work either.

    And Covey, I've done that :(

    EDIT: Nvm that question. I'll just make a drag-able, border-less form instead ;)

    EDIT2: Next Question. How do I keep my Border-Less Form Visible even when my Main form has the focus. At The moment when it loses focus, it minimizes. How do I stop that and keep it on top.

    EX: I Have this Border-less frame open. I then click my main form. At the moment, my Border-Less frame disappears. I would like it so that it doesn't disappear, but the Form I clicked still has focus. I tried the same thing as my splash form, but then when I minimize my main form, my Border-Less form still shows up (The thing I have on my splash makes it stay on top of EVERYTHING [Unminimizable]).
     
  25. Unread #13 - May 15, 2008 at 2:25 AM
  26. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A Few More Questions

    Use the SetParent API, i can't be assed posting an example.
     
  27. Unread #14 - May 15, 2008 at 2:31 AM
  28. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    Okay. Unlike most people, I like (And am willing) to learn.

    I'll look it up and see what I can do :D

    Thanks for all your help by the way. Without you guys, my client would be nothing :p
     
  29. Unread #15 - May 15, 2008 at 2:59 AM
  30. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    A Few More Questions

    Sounds like you are going too round-a-bout with this, a dragable frame would suffice (But for some raisin it doesn't work for you)


    To keep your form on top, either Google or search for SetWindowPos API, many websites will give you an instant example on how to set it to either ontop, onbotton, or normal.
     
  31. Unread #16 - May 15, 2008 at 4:08 AM
  32. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    Well I found out a code to put forms on top and can be turned on and off (Unlike my splash), but I can't get this to work:

    Code:
    If Main.WindowState = vbMinimized Then
    MakeTopmost Me, False
    Else
    MakeTopmost Me, True
    End If
    Is there some thin wrong? Should it be in a certain sub? Why won't it work?

    NOTE: Yes, I did have that in a sub, but I know it's wrong.
     
  33. Unread #17 - May 15, 2008 at 8:44 AM
  34. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A Few More Questions

    Err if that "MakeTopmost" sub is using the SetWindowsPos API it will only set the window position on the screen (i believe) not fix it to your other form like SetParent would do.

    :D
     
  35. Unread #18 - May 15, 2008 at 5:31 PM
  36. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    Yup it's SetWindowPos. I'll keep looking for SetParent ;)

    EDIT: Alright, I have SetParent and it's ALMOST Perfect.. It stays inside my Main form just like I want it to, but...

    1. I can't drag it like I used to be able to. If you're wondering, It's a borderless form and I have a command button (For now) that you can drag it along with.
    2. There's a Webbrowser inside this child form and when I click th textboxes on the page it loads, nothing happens. You can't type anything into them.

    So yeah. All it's doing is putting the form there... And I can't do ANYTHING with it... Except look at it...
     
  37. Unread #19 - May 16, 2008 at 2:59 AM
  38. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    A Few More Questions

    Ok forget SetParent ill just make you a demo dragable frame.

    EDIT:
    This is a very poor way of doing it.
    Code:
    Option Explicit
    Private blnMouseDown As Boolean
    
    Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        blnMouseDown = True
    End Sub
    
    Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If blnMouseDown = True Then
            Frame1.Left = X
            Frame1.Top = Y
        End If
    End Sub
    
    Private Sub Frame1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        blnMouseDown = False
    End Sub
     
  39. Unread #20 - May 16, 2008 at 3:07 AM
  40. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    A Few More Questions

    Wow, thank you very much :D

    EDIT: I've gotta go to my dad's, but I'll try it out when I get there. It looks like it'd work though :D

    Thank you very much! As I've said before, you're a legend :)
     
< Beginner needs help with VERY basic C++ program | Executing and external program? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site