Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Web Page in a form 2

Status
Not open for further replies.

kennedymr2

Programmer
May 23, 2001
594
AU
I have a program running and would like to open say Firefox in a position on the existing form.

I am trying to avoid using webbrowser....,

ie.
Shell ("C:\Program Files\Mozilla Firefox\firefox.exe c:\submit.html")

Can i put say a ???picturebox on my form... and place the above shell exactly where the picture box is located.

Would appreciate some help with the code. if this is possible..


Regards Kennedymr2
 
JustinEzequiel...
Thanks a lot , this has pointed me in the right direction.

I need to position eg notepad ...in an exact position on the form..

The example just places the notepad over the top of the main form.

I was thinking i could create say a picturebox on say the bottom of the form , then somehow getting the coordananaces of the picturebox and getting eg notepad to go exactly where the picturebox is..

Would appreciate any ideas, as the if this is possible.

What is happening is.. i am opening a https: web page in webbrowser on the form..its loading all ok. but not functioning as it should.

If i load the same page in say Firefox or IE directly
it does work all ok.

My idea is the shell but get it to look like i am using webbrowser on the form.

Regards kennedymr2

 
there should be an example for SetWindowPlacement on the same site
so, combining this with the SetParent sample, with minor tweaking...
(oh and I added a picture box named PB1)
Code:
Private Const SW_MAXIMIZE As Long = 3
Code:
Private Sub Form_Load()
    'KPD-Team 1999
    'URL: [URL unfurl="true"]http://www.allapi.net/[/URL]
    'E-Mail: KPDTeam@Allapi.net
    Dim Pid As Long
    'Lock the window update
    LockWindowUpdate GetDesktopWindow
    'Execute notepad.Exe
    Pid = Shell("c:\windows\notepad.exe", vbMaximizedFocus)
    If Pid = 0 Then MsgBox "Error starting the app"
    'retrieve the handle of the window
    mWnd = InstanceToWnd(Pid)
    'Set the notepad's parent
    SetParent mWnd, [COLOR=green]Me.PB1.hwnd[/color]
    
    'Put the focus on notepad
    Putfocus mWnd
    'Unlock windowupdate
    LockWindowUpdate False
[COLOR=green]    
    'Tip submitted by pyp99 (pyp99@hotmail.com)
    Dim WinEst As WINDOWPLACEMENT
    Dim rtn As Long
    WinEst.Length = Len(WinEst)
    'get the current window placement
    rtn = GetWindowPlacement(mWnd, WinEst)
    Rectan = WinEst.rcNormalPosition
    
'    Dim WinEst As WINDOWPLACEMENT
    Dim Punto As POINTAPI
'    Dim rtn As Long
    'set the new min/max positions
    Punto.x = 0
    Punto.y = 0
    'initialize the structure
    WinEst.Length = Len(WinEst)
    WinEst.showCmd = SW_MAXIMIZE
    WinEst.ptMinPosition = Punto
    WinEst.ptMaxPosition = Punto
    WinEst.rcNormalPosition = Rectan
    'set the new window placement (minimized)
    rtn = SetWindowPlacement(mWnd, WinEst)
[/color]    
End Sub
 
JustinEzequiel,

Many thanks... i can now see how to do what i am trying....

Appreciate you time in looking into it for me.


Regards Kennedymr2
 
A search in this forum will find a number of threads discussing the use of SetParent.

And I wouldn't use LockWindowUpdate; that's using a global command to control a local state, and can lead to trouble. LockWindowUpdate is not the best way to stop repainting a window. It really should only be used during drag/drop operations; see Raymond Chen's excellent articles about this.

Instead try

SendMessage(hwnd, WM_SETREDRAW, FALSE, 0)

and

SendMessage(hwnd, WM_SETREDRAW, TRUE, 0)

(assuing you need to prevent window painting, which I'm not convinced abotu here)
 
strongm ,

I originally thought i had worked out the solution, but i found i walked into some problems., i can see what you are getting at.

I will have a good look at SendMessage(hwnd, WM_SETREDRAW, FALSE, 0)

All that i am trying to achieve is run firefox or ie using shell in order to get ssl https working properly (webbrowser does not seem to handle it)... and place it on my form in a predefined position ??frame,picturebox,textbox ??..so it looks like its part on my form rather than a seperate window.

The only thing worrying me THEN is if the form is moved i guess the firefox,ie would stay where it was before moving the form ????

If its too complicated, probably will just wear running firefox,ie in its own world., seperate to my form!!!

Appreciate to help being offered..

Regards Kennedymr2

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top