Click here to Skip to main content
15,890,043 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: window placement and restoration query Pin
Jonathan Davies20-Mar-09 5:24
Jonathan Davies20-Mar-09 5:24 
QuestionObject properties - control embedded in web page Pin
AssemblySoft16-Mar-09 6:13
AssemblySoft16-Mar-09 6:13 
AnswerRe: Object properties - control embedded in web page Pin
«_Superman_»16-Mar-09 18:59
professional«_Superman_»16-Mar-09 18:59 
GeneralRe: Object properties - control embedded in web page Pin
AssemblySoft16-Mar-09 22:10
AssemblySoft16-Mar-09 22:10 
GeneralRe: Object properties - control embedded in web page Pin
«_Superman_»17-Mar-09 1:32
professional«_Superman_»17-Mar-09 1:32 
GeneralRe: Object properties - control embedded in web page Pin
AssemblySoft17-Mar-09 4:12
AssemblySoft17-Mar-09 4:12 
GeneralRe: Object properties - control embedded in web page Pin
«_Superman_»17-Mar-09 23:49
professional«_Superman_»17-Mar-09 23:49 
QuestionAdding to CFolderDialogImpl Pin
joboodi313-Mar-09 7:09
joboodi313-Mar-09 7:09 
In the wizard I'm working on I need to bring up a window that allows our users to select a folder to gather files from. I figured that CFolderDialogImpl would work just dandy. However, I wanted to remove the 'Make New Folder' button (which I was able to do by using Spy++ to find out it's ID and hide it) and replace it with a check box that the user can check to specify whether or not to recurse into subdirectories of the selected folder. I created a dialog in the resource editor with just a checkbox in it (IDC_CHECK_RECURSE is the resource ID for the checkbox, and it belongs to IDD_ENHANCED_FOLDER_DIALOG).

My problem is that I can't, for the life of me, get the check box that I created in the resource editor to show up! I know that I haven't set anything up to handle the messages for my check box. I'm more concerned with just getting the dang thing to show up first.

Here is what the class looks like...

class CFolderDialogEx : public CFolderDialogImpl<CFolderDialogEx>
{
protected:
	typedef CFolderDialogImpl<CFolderDialogEx>	baseClass;
	typedef CFolderDialogEx					thisClass;
public:
	// Enumerations
	enum DialogIds
	{
		// NOTE: Dialog IDs found using SPY++
		_IDC_STATUSTEXT = 0x00003741,
		_IDC_TITLE      = 0x00003742,
		_IDC_NEW_FOLDER = 0x00003746,
	};

	enum { IDD = IDD_ENHANCED_FOLDER_DIALOG };

	// Constructor
	CFolderDialogEx(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT)
		: baseClass(hWndParent, lpstrTitle, uFlags)
	{

	}

	BEGIN_MSG_MAP(thisClass)
		//NOTIFY_HANDLER(IDC_CHECK_RECURSE, BN_CLICKED, OnRecurseChecked)
	END_MSG_MAP()

	// Overrides from base class
	void OnInitialized()
	{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//			*****************	Copied from FolderDialogStatusText.h	**********************

		// NOTE: We compensate for the issue where BIF_STATUSTEXT
		//  isn't honored if BIF_NEWDIALOGSTYLE is present.
		//  Some would say its a bug, some would say its by design...
		if((m_bi.ulFlags & BIF_NEWDIALOGSTYLE) == BIF_NEWDIALOGSTYLE &&
			(m_bi.ulFlags & BIF_STATUSTEXT) == BIF_STATUSTEXT)
		{
			int fontHeight = 11;  // 8 point Tahoma at 96 DPI

			CWindow title = ::GetDlgItem(m_hWnd, _IDC_TITLE);
			RECT rcTitle = {0};
			if(title)
			{
				CFontHandle titleFont = title.GetFont();
				CLogFont logFont;
				titleFont.GetLogFont(logFont);
				if(logFont.lfHeight < 0)
					fontHeight = -1*logFont.lfHeight;

				title.GetWindowRect(&rcTitle);
				::MapWindowPoints(NULL, title.GetParent(), (LPPOINT)&rcTitle, 2);
				rcTitle.top -= 1;
				rcTitle.bottom -= fontHeight + 1;
				title.SetWindowPos(NULL, &rcTitle, (SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW));
			}

			CWindow status = ::GetDlgItem(m_hWnd, _IDC_STATUSTEXT);
			if(status)
			{
				status.EnableWindow(TRUE);
				status.ModifyStyle(0,SS_PATHELLIPSIS|SS_NOPREFIX);

				rcTitle.top = rcTitle.bottom + 2;
				rcTitle.bottom = rcTitle.top + fontHeight + (fontHeight/2);

				status.SetWindowPos(NULL, &rcTitle, (SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW));
			}

			// NOTE: We'd really like to have the status window resize appropriately
			//  when the dialog resizes, but currently that doesn't happen.
		}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		CRect		rect;
		CWindow		makeNewFolderButton = ::GetDlgItem(m_hWnd, _IDC_NEW_FOLDER);

		if ( makeNewFolderButton.IsWindow() )
		{
			makeNewFolderButton.ScreenToClient( &rect );
			makeNewFolderButton.ShowWindow( SW_HIDE );


			CWindow		recurseBox = ::GetDlgItem( this->m_hWnd, IDC_CHECK_RECURSE );
			DWORD		error;

			error = GetLastError();

			if ( recurseBox.IsWindow() )
			{
				recurseBox.MoveWindow( &rect );
				recurseBox.ShowWindow( SW_NORMAL );
			}
		}
	}

....


recurseBox.m_hWnd is NULL, which makes the if ( recurseBox.IsWindow() ) fail.
error is ERROR_CONTROL_ID_NOT_FOUND

I'm completely aware that I may be going about this all wrong. All I want to do is have a folder dialog with the checkbox that let's the user specify whether or not to recurse into subdirectories. I don't really care how it gets done, as long as it gets done. Any help would be very much appreciated!

Thanks!
AnswerRe: Adding to CFolderDialogImpl Pin
Stuart Dootson14-Mar-09 5:04
professionalStuart Dootson14-Mar-09 5:04 
Questionthe question that relate to CreateInstance Pin
weifirst12-Mar-09 21:03
weifirst12-Mar-09 21:03 
AnswerRe: the question that relate to CreateInstance Pin
Stuart Dootson12-Mar-09 22:12
professionalStuart Dootson12-Mar-09 22:12 
Generalthanks. this query is resolves. it is not relate com, it is other question. Pin
weifirst15-Mar-09 21:46
weifirst15-Mar-09 21:46 
QuestionDynamic UUID? Pin
lucyh3h12-Mar-09 7:37
lucyh3h12-Mar-09 7:37 
AnswerRe: Dynamic UUID? Pin
«_Superman_»12-Mar-09 19:56
professional«_Superman_»12-Mar-09 19:56 
QuestionEquivalent for CPtrList in ATL Pin
Elsie9-Mar-09 21:45
Elsie9-Mar-09 21:45 
AnswerRe: Equivalent for CPtrList in ATL Pin
Jonathan Davies10-Mar-09 0:21
Jonathan Davies10-Mar-09 0:21 
GeneralRe: Equivalent for CPtrList in ATL Pin
Elsie10-Mar-09 4:06
Elsie10-Mar-09 4:06 
GeneralRe: Equivalent for CPtrList in ATL Pin
Jonathan Davies10-Mar-09 4:22
Jonathan Davies10-Mar-09 4:22 
AnswerRe: Equivalent for CPtrList in ATL Pin
Stuart Dootson10-Mar-09 2:04
professionalStuart Dootson10-Mar-09 2:04 
AnswerCPtrList is not in c++, it is in vc++ Pin
weifirst12-Mar-09 21:42
weifirst12-Mar-09 21:42 
QuestionRegarding Adobe Acrobat Reader6.0 Add-in Pin
NATARAJAN VENKATARAMANI5-Mar-09 4:03
NATARAJAN VENKATARAMANI5-Mar-09 4:03 
QuestionHow can we create a dynamic button, label and a listview control on a window created in ATL/WTL ? Pin
Dharmendra Bhargava4-Mar-09 22:03
Dharmendra Bhargava4-Mar-09 22:03 
AnswerRe: How can we create a dynamic button, label and a listview control on a window created in ATL/WTL ? Pin
Jonathan Davies8-Mar-09 5:40
Jonathan Davies8-Mar-09 5:40 
GeneralRe: How can we create a dynamic button, label and a listview control on a window created in ATL/WTL ? Pin
Dharmendra Bhargava9-Mar-09 21:57
Dharmendra Bhargava9-Mar-09 21:57 
GeneralRe: How can we create a dynamic button, label and a listview control on a window created in ATL/WTL ? Pin
Jonathan Davies10-Mar-09 1:13
Jonathan Davies10-Mar-09 1:13 

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.