Click here to Skip to main content
15,914,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problem with 3-State Check Box (push style) with common controls 6.0 Pin
Software200715-Jan-09 15:33
Software200715-Jan-09 15:33 
Questionhow to contact outlook calender from VC++ ? Pin
spicy_kid200015-Jan-09 6:32
spicy_kid200015-Jan-09 6:32 
AnswerRe: how to contact outlook calender from VC++ ? Pin
Cedric Moonen15-Jan-09 7:15
Cedric Moonen15-Jan-09 7:15 
AnswerRe: how to contact outlook calender from VC++ ? Pin
Stuart Dootson15-Jan-09 9:11
professionalStuart Dootson15-Jan-09 9:11 
Questionlimiting print margins Pin
TClarke15-Jan-09 4:43
TClarke15-Jan-09 4:43 
AnswerRe: limiting print margins Pin
Iain Clarke, Warrior Programmer15-Jan-09 5:17
Iain Clarke, Warrior Programmer15-Jan-09 5:17 
GeneralRe: limiting print margins Pin
TClarke15-Jan-09 5:48
TClarke15-Jan-09 5:48 
AnswerRe: limiting print margins Pin
Rajkumar R15-Jan-09 7:16
Rajkumar R15-Jan-09 7:16 
If you are discussing about the page Setup dialog that you use in your own application, i also think so, you may need to subclass the dialog.

First of all, obviously, if the margins are overbound it messes up, that is known to the user, do you need to correct it?

If you want to disable the margin fields, simply use PSD_DISABLEMARGINS flags in [PageSetupDlg Function^].

Or you can validate the margin data entry, by subclassing it. That is setting the hook procedure.
PAGESETUPDLG psd;    // common dialog box structure
		// Initialize PAGESETUPDLG
	ZeroMemory(&psd, sizeof(psd));
	psd.lStructSize = sizeof(psd);
	psd.hwndOwner   = 
        ....
	psd.Flags       = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS | 
		<code>PSD_ENABLEPAGESETUPHOOK</code>;
	psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)PageSetupHook;

	if (PageSetupDlg(&psd)==TRUE) {


And in the hook procedure you can validate the text entry,

BOOL CALLBACK PageSetupHook(HWND hwndDlg, UINT uMsg, WPARAM wParam,
    LPARAM lParam) 
{ 
	
   switch (uMsg)
	{
	case WM_INITDIALOG:
		return (INT_PTR)TRUE;

	case WM_COMMAND:
		if ((LOWORD(wParam) == 1155 // ID of LEFT MARGIN EDIT CTRL (from PrnSetup.Dlg)
			&& HIWORD(wParam) == EN_CHANGE)
		{ 
                      // write the validation code


You can completely customise the page setup dialog with your own dialog by create a dialog template resource by modifying the default template available in VC\PlatformSDK\Include\PrnSetup.Dlg by specifying the flags,
psd.Flags       = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS | 
		PSD_ENABLEPAGESETUPHOOK | <code>PSD_ENABLEPAGESETUPTEMPLATE</code>; 
	....
	psd.lpPageSetupTemplateName = MAKEINTRESOURCE(IDD_PAGESETUP); // your dialog template 
	psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)PageSetupHook;
        psd.hInstance = hInstance;



see also [Customizing the Page Setup Dialog Box^]
GeneralRe: limiting print margins [modified] Pin
TClarke15-Jan-09 23:14
TClarke15-Jan-09 23:14 
QuestionWM5 dev, Problem with C++ FindFirstFile returning 0xffffffff Pin
uzziah015-Jan-09 3:48
uzziah015-Jan-09 3:48 
AnswerRe: WM5 dev, Problem with C++ FindFirstFile returning 0xffffffff Pin
Randor 15-Jan-09 4:20
professional Randor 15-Jan-09 4:20 
GeneralRe: WM5 dev, Problem with C++ FindFirstFile returning 0xffffffff Pin
uzziah015-Jan-09 4:46
uzziah015-Jan-09 4:46 
QuestionAccess Database: Create Table Pin
SutterA15-Jan-09 3:14
SutterA15-Jan-09 3:14 
AnswerRe: Access Database: Create Table Pin
David Crow15-Jan-09 4:20
David Crow15-Jan-09 4:20 
Questionwindows Loader Pin
Member 342050915-Jan-09 1:44
Member 342050915-Jan-09 1:44 
AnswerRe: windows Loader Pin
Iain Clarke, Warrior Programmer15-Jan-09 2:04
Iain Clarke, Warrior Programmer15-Jan-09 2:04 
AnswerRe: windows Loader Pin
Naveen15-Jan-09 2:07
Naveen15-Jan-09 2:07 
QuestionCan i fix the size of splitted view? Pin
Le@rner15-Jan-09 1:29
Le@rner15-Jan-09 1:29 
AnswerRe: Can i fix the size of splitted view? Pin
SandipG 15-Jan-09 1:40
SandipG 15-Jan-09 1:40 
GeneralRe: Can i fix the size of splitted view? Pin
Le@rner15-Jan-09 1:52
Le@rner15-Jan-09 1:52 
QuestionSuggestions: need an Outlook 2003 style of navigation class Pin
josip cagalj15-Jan-09 0:28
josip cagalj15-Jan-09 0:28 
AnswerRe: Suggestions: need an Outlook 2003 style of navigation class Pin
Code-o-mat15-Jan-09 5:58
Code-o-mat15-Jan-09 5:58 
AnswerRe: Suggestions: need an Outlook 2003 style of navigation class Pin
josip cagalj15-Jan-09 21:20
josip cagalj15-Jan-09 21:20 
Questionhow to hide internal component of a class Pin
pedefetoll15-Jan-09 0:23
pedefetoll15-Jan-09 0:23 
AnswerRe: how to hide internal component of a class Pin
sashoalm15-Jan-09 0:34
sashoalm15-Jan-09 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.