|
-
July 26th, 2004, 11:07 PM
#1
Tab control in a Dialog
Hi!
After consulting a number of articles/tutorials regarding property sheet, property pages, tab control... I decided to start this thread and ask for futher help. Sorry but I really find it hard to come up with what I want to make.
I am using Visual C++ Resource Editor, here I can make a dialog and I can make individual PROPERTY PAGES. My problem, I do not know how to makes these PROPERTY PAGES look like a tab control placed into my dialog.
Please someone help me. Thank You.
-
July 27th, 2004, 07:24 AM
#2
There was a thread about this just a week or so ago:
http://www.codeguru.com/forum/showthread.php?t=302355
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-
July 27th, 2004, 03:41 PM
#3
Here is a class that I use, that helps a lot
Code:
class PROPERTYSHEET{
public:
_declspec (dllexport) PROPERTYSHEET();
_declspec (dllexport) ~PROPERTYSHEET();
_declspec (dllexport) BOOL DoDialog(LPCTSTR caption, HWND hwnd);
_declspec (dllexport) BOOL AddPage(LPCTSTR title, HINSTANCE hInst, LPCTSTR pszTemplate, DLGPROC pfnDlgProc);
private:
PROPSHEETPAGE pPages[MAX_PROP_PAGES];
PROPSHEETHEADER psh;
int nPages;
};
/******************************************************************************
PROPERTYSHEET();
Constructs a property sheet object
******************************************************************************/
_declspec (dllexport) PROPERTYSHEET::PROPERTYSHEET(){
nPages=0;
}
/******************************************************************************
~PROPERTYSHEET();
Destroys the property sheet object
******************************************************************************/
_declspec (dllexport) PROPERTYSHEET::~PROPERTYSHEET(){}
/******************************************************************************
DoDialog();
Invokes a modal property sheet
LPCTSTR caption = Caption of the dialog
HWND hwnd = Parent window of the dialog
******************************************************************************/
_declspec (dllexport) BOOL PROPERTYSHEET::DoDialog(LPCTSTR caption, HWND hwnd){
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_DEFAULT | PSH_PROPSHEETPAGE | DS_SYSMODAL;
psh.hwndParent = hwnd;
psh.hInstance = NULL;
psh.pszCaption = caption;
psh.nPages = nPages;
psh.nStartPage = 0;
psh.ppsp = pPages;
return ::PropertySheet(&psh);
}
/******************************************************************************
AddPage();
Adds a page (tab) to the property sheet
LPCTSTR title = Caption of the tab
HINSTANCE hInst = Instance handle for the page
LPCTSTR pszTemplate = Address of a resource template for the page's dialog
DLGPROC pfnDlgProc = Address of dialog procedure for the page
******************************************************************************/
_declspec (dllexport) BOOL PROPERTYSHEET::AddPage(LPCTSTR title, HINSTANCE hInst, LPCTSTR pszTemplate, DLGPROC pfnDlgProc){
if(nPages >= MAX_PROP_PAGES){
return FALSE;
}
pPages[nPages].dwSize = sizeof(PROPSHEETPAGE);
pPages[nPages].dwFlags = PSP_DEFAULT | PSP_USETITLE;
pPages[nPages].pszTitle = title;
pPages[nPages].hInstance = hInst;
pPages[nPages].pszTemplate = pszTemplate;
pPages[nPages].pfnDlgProc = pfnDlgProc;
nPages++;
return TRUE;
}
-
July 28th, 2004, 01:04 AM
#4
I appreciate your answers.
I am starting to learn creating windows purely using API calls.
I am doing it "the hard way"
Once I'm done, I will make my own tutorial for this. I also want to help those
who cannot easily figure it out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|