Win32 - Controls on main window

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2005
Posts: 188
Reputation: bops is an unknown quantity at this point 
Solved Threads: 3
bops bops is offline Offline
Junior Poster

Win32 - Controls on main window

 
0
  #1
Dec 17th, 2005
Hi, I have recently started windows programming in C/C++, I understand most of it, but 1 thing i cant find out how to do is to put controls on the main window of the application, not in a popup dialog box...can anyone give me any tips on how to do this ? thanks in advance ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,672
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1502
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Win32 - Controls on main window

 
0
  #2
Dec 17th, 2005
during the window's initialization, use the control's Create function, in which you specify the parent HWND, RECT containing the location and height, and the control's ID, among other things. The instance object of the control must NOT be local to a function, but global in the c++ class or program file in which it is used because it must stay in scope during the lifetime of the window.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 188
Reputation: bops is an unknown quantity at this point 
Solved Threads: 3
bops bops is offline Offline
Junior Poster

Re: Win32 - Controls on main window

 
0
  #3
Dec 17th, 2005
Thanks, that makes a lot of sense lol...I will give that a go...is there any way of specifying the design of the window in the resource file in the way you can design your dialog box and menus etc ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 188
Reputation: bops is an unknown quantity at this point 
Solved Threads: 3
bops bops is offline Offline
Junior Poster

Re: Win32 - Controls on main window

 
0
  #4
Dec 17th, 2005
Oh also, do you have any good links on where I can get lists of styles etc for dialog boxes (Im not sure what they are called) and all fo the other kinds of controls etc for example...

  1. DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  2. MB_OK | MB_ICONERROR
  3. //and lots more...
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: Win32 - Controls on main window

 
0
  #5
Dec 17th, 2005
well, if the number of controls is small, using global variables is okay. but i prefer to create them locally inside the create function and then use GetDialogItem API to get the handles of the controls when i need them. this eliminates the need of global window handles and makes the program less messy.

the best site regarding the apis is the msdn site itself.
Individual Controls
dialogs
The list of values can be obtained in CreateWindow

as for specyfing the design of the window like a dialog box, i have found a way to do that yet using a resource editor.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,672
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1502
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Win32 - Controls on main window

 
0
  #6
Dec 18th, 2005
Originally Posted by bops
.is there any way of specifying the design of the window in the resource file in the way you can design your dialog box and menus etc ?
use CFormView instead of CView and the view will look and act like a dialog box -- and you can design it like one too.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: Win32 - Controls on main window

 
0
  #7
Dec 19th, 2005
Originally Posted by me
as for specyfing the design of the window like a dialog box, i have found a way to do that yet using a resource editor.
I meant i have NOT found a way to do that yet. at least not in pure win32.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 188
Reputation: bops is an unknown quantity at this point 
Solved Threads: 3
bops bops is offline Offline
Junior Poster

Re: Win32 - Controls on main window

 
0
  #8
Dec 20th, 2005
Hello again guys, I am having a lot of trouble simply setting the properties of controls on a dialog box, for example setting a command button to enabled and disabled, i have spent hours on msdn looking for ways of doing this but i still manage to get confused....also what is CView and CFormView and do you have any links to download a free decent resource editor? thanks.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,672
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1502
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Win32 - Controls on main window

 
0
  #9
Dec 20th, 2005
CView and CFormView are MFC c++ classes. But you need to use VC++ 6.0 or newer to use them. Call the win32 api function EnableWindow() to enable and disable buttons and most other windows too.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 188
Reputation: bops is an unknown quantity at this point 
Solved Threads: 3
bops bops is offline Offline
Junior Poster

Re: Win32 - Controls on main window

 
0
  #10
Dec 21st, 2005
oh i see, i have tried all kinds of ways including enablewindow(); function, could you give me an example on using it to disable a command button please?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum


Views: 6417 | Replies: 10
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC