#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    18
    Rep Power
    0

    Change browser size with Delphi code asp.net Delphi 8


    Hey all,
    I know there is a way I can change the size of the browser using javascript, etc. But what I would like to be able to do is change the size of an asp.net web form with Delphi code on the onload attributes of the new web form or before I do the Response.Redirect on the page preceding the new one. Does anybody have any source on how to do this? Thanks for your time...
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,642
    Rep Power
    4247
    Assuming you've already opened the window and you know the title of the window (or have another way to get the window handle of the browser window you just opened), you can do this. In the following code, I use FindWindow to find the specific window by title, so I can get its window handle. Then I call SetWindowPos to set the size.
    Code:
    var
    	hwnd : THandle;
    begin
    	hWnd := FindWindow(nil, 'Google - Microsoft Internet Explorer');
    	if (hWnd > 0) then
    		SetWindowPos(hWnd, HWND_TOP, 10, 10, 200, 200, SWP_NOMOVE);
    end;
    Since I've specified SWP_NOMOVE, the call ignores the values I used for the window position and only resizes the window. If you want the window to move as well as resize, take out the SWP_NOMOVE. You might want to read the help docs for SetWindowPos to see what the various options are.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    18
    Rep Power
    0
    Thank you

IMN logo majestic logo threadwatch logo seochat tools logo