Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

...I enjoy spending time on it for personal growth (I learn from the questions I don't answer, and I reinforce/stay sharp on the topics I do answer), and to give back to humanity at large...

Geography

Where in the world do Tek-Tips members come from?
kennedymr2 (Programmer)
14 Apr 12 1:49
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 (Programmer)
14 Apr 12 8:34
see
http://allapi.mentalis.org/apilist/SetParent.shtml

page has a link to an example using notepad.exe
 
kennedymr2 (Programmer)
14 Apr 12 16:37
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

 
Helpful Member!  JustinEzequiel (Programmer)
15 Apr 12 22:51
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: http://www.allapi.net/
    '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, Me.PB1.hwnd
    
    'Put the focus on notepad
    Putfocus mWnd
    'Unlock windowupdate
    LockWindowUpdate False
    
    '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)
    
End Sub
 
kennedymr2 (Programmer)
16 Apr 12 2:23
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
 
Helpful Member!  strongm (MIS)
16 Apr 12 4:29
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)
kennedymr2 (Programmer)
16 Apr 12 16:45
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

 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close