Results 1 to 3 of 3
08-30-2011, 06:48 PM #1Registered User
- Join Date
- Nov 2010
- vancouver island BC Canada
how to make browser larger with the window in vc++ 2008
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++
08-31-2011, 12:24 PM #2
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.
You might want to spend some time reading up on the basic concepts of Windows programming. MSDN is a good resource:
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.).
08-31-2011, 07:31 PM #3
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.