Results 1 to 9 of 9

Thread: how to set size for popup window

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    104

    how to set size for popup window

    Hi everyone, I use
    Code:
    lngOpenPage = ShellExecute(Frm1.hwnd, "Open", lblurl.Caption, 0&, 0&, 0&)
    to open a new window. I saw only a "SW_SHOWNORMAL" parameter before. I have two questions:

    1, How can I set the size for the window?
    2, Is it possible to hide some parts of the URL in the browser (only show a part of it)?

    Thanks for any help.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how to set size for popup window

    Quote Originally Posted by VBKit
    I saw only a "SW_SHOWNORMAL" parameter before.
    Actually, there are a number of parameters that can be used.

    Here is description of the API and all of its possible parameters.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: how to set size for popup window

    1. You wouldnt use ShellExecute to set the size of a window. You would need to use SetWindowPlacement after the ShellExecute call for that.
    If you wanted to set the size to maximized then use the SW_SHOWMAXIMIZED parameter. If you want it to set the size of the form to some specific normal size then you need to do as I stated with the SetWindowplacement API.

    See my code in this thread for positioning the window.
    http://www.vbforums.com/showpost.php...0&postcount=18


    2. Where does a browser come into the picture here?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    104

    Re: how to set size for popup window

    Thanks for your replies. I am opening up a browser based on a URL generated by VB, eg. http://www.productmates.com/index.ph...1&txtSTORE=151.

    The image return will be always the same size (600x600px) in the new popup IE window. I am thinkinf it will be good if I can fix the window size; and I don't want to show the user the full product ID and STORE detail in the URL, possible to hide that part of info in the URL?

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    104

    Re: how to set size for popup window

    I manage to set the browser’s size in the Javascript when the php is called by VB. But this cause a problem of double windows opening (one from VB another one from Javescript).

    My question now is: how to get VB to only call the php but not opening a new IE window??

    Thanks for yor help.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: how to set size for popup window

    Are you using a browser control on a form or just launching a default browser?

    Whats this with php? Can you explain more of what you are doing so we can get the entire picture?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    104

    Re: how to set size for popup window

    Ok.

    The only way I know to open a webbrowser, beside webbrowse.navigate, is the API, so I use
    Code:
    lngOpenPage = ShellExecute(Frm1.hwnd, "Open", lblurl.Caption, 0&, 0&, 0&)
    to open a default browser to the "lblurl.caption". That URL is written in PHP and Javacript and open a fixed size image all the time. My VB code opens a window. Because I could not figure out a way how to fix the window's size, which I can do in the php behind that. Since I am going to open the window when the php is loaded, I don't need the window to be opened from VB.

    However, if I can set the browser size from VB I don't have to worry about much... just load the normal php is fine.

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: how to set size for popup window

    But that is what I posted, my code on resizing a window just as you need.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    104

    Re: how to set size for popup window

    Rob, I have done as you suggested:

    Quote Originally Posted by RobDog888
    You would need to use SetWindowPlacement after the ShellExecute call for that.
    You said
    Quote Originally Posted by RobDog888
    If you want it to set the size of the form to some specific normal size then you need to do as I stated with the SetWindowplacement API.
    Not seem working, it still opens a new tab under the opened window (firefox).
    Last edited by VBKit; Oct 23rd, 2008 at 04:56 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width