Notices

Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2010
    Location
    vancouver island BC Canada
    Posts
    104

    how to make browser larger with the window in vc++ 2008

    hello,
    I am an absolute begginer making my first programs with help from youtube tutorials and such. I am making a basic web browser and have it looking pretty, but when i maximize the window, the web browser stays the same size and there is just a big gray area to the sides. How can i make the web browser grow and shrink with the window?

    I am using vc++ 2008 express from microsoft.

    Include way more detail than you think you should, I barely grasp the basics of c++

  2. #2
    Join Date
    Nov 2009
    Location
    Seattle
    Posts
    341
    Windows programming isnt exactly straight forward, especially to a newb to C++. You will need to handle all the re-drawing of the browser window yourself, as it wont do it for you. Essentially, you need to handle the WM_SIZE message in your WndProc and use the parameters of that message to resize the browser window appropriately.

    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    You might want to spend some time reading up on the basic concepts of Windows programming. MSDN is a good resource:

    http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx

    Also: what is the goal of this project? Are you merely attempting to learn programming, learn C++, or learn Windows programming? Depending on your goal, you might be better off starting in a different environment (C# and WPF, Java, etc.).

  3. #3
    Join Date
    May 2002
    Location
    Beautiful BC
    Posts
    2,713
    Like ey_allen said, MSDN is a good resource with lots of examples. With the graphical side of Windows (or any GUI) you need to remember two things:
    -- there a huge directed graph (tree structure) of windows within windows within windows. The application window contains windows (like the title bar) which contains windows (text, icons, buttons) which have properties (colour, visibility transparency...) and methods to do things (set text, set background, redraw...).

    -- There's an endless stream of events that get passed around to (and generated in) these windows. So a window will recieve MOUSE_ENTER, MOUSE_MOVE, MOUSE_DOWN, MOUSE_UP, MOUSE_LEAVE events (for example) and if it's a button window then the handler will change the appearance and maybe generate some events of it's own.

    In your case you've changed the window and now you have to tell all the window elements to redraw. Or you have to fix your redraw handler to passthough the REDRAW event to all the child windows.
    If you have a problem & think that someone else is going to solve it for you then you have two problems.

Posting Permissions

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