Click here to Skip to main content
15,886,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: A Data Structures Book Needed Pin
David Crow16-Nov-15 2:45
David Crow16-Nov-15 2:45 
AnswerRe: A Data Structures Book Needed Pin
Amr.Mohammad8719-Nov-15 6:56
Amr.Mohammad8719-Nov-15 6:56 
QuestionRe: A Data Structures Book Needed Pin
David Crow19-Nov-15 7:30
David Crow19-Nov-15 7:30 
AnswerRe: A Data Structures Book Needed Pin
Amr.Mohammad8719-Nov-15 12:58
Amr.Mohammad8719-Nov-15 12:58 
Question[Code Review] [SFML] Simple Breakout/Arkanoid Clone + Asking for some help Pin
Matthaeus Jumpertz15-Nov-15 0:08
Matthaeus Jumpertz15-Nov-15 0:08 
SuggestionRe: [Code Review] [SFML] Simple Breakout/Arkanoid Clone + Asking for some help Pin
Richard MacCutchan15-Nov-15 21:02
mveRichard MacCutchan15-Nov-15 21:02 
AnswerRe: [Code Review] [SFML] Simple Breakout/Arkanoid Clone + Asking for some help Pin
David Crow16-Nov-15 2:46
David Crow16-Nov-15 2:46 
QuestionWhy my TreeView cannot show icon Pin
joshua013711-Nov-15 23:49
joshua013711-Nov-15 23:49 
i create a treeview in a wnd derived from CWindowImpl ( i use atl), and i create a imglistctrl for the treeview,
everything seems ok of the imagelist, and i assign a image index for every node of the trewview, but no icon shows, and a small empty rect keeps at the left of every node's, anyone can help me?

C++
class CJMainForm : public CWindowImpl<CJMainForm>
{
public:
	DECLARE_WND_CLASS("JMainFrameClass") 

	CJMainForm(void);
	~CJMainForm(void);
	BOOL ShowForm(BOOL bShow = TRUE);

	BEGIN_MSG_MAP( CJMainForm )
		MESSAGE_HANDLER( WM_PAINT, OnPaint)
		MESSAGE_HANDLER(WM_LBUTTONDOWN,	OnLButtonDown)
		MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
		MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
		MESSAGE_HANDLER(WM_QUERYENDSESSION, OnQueryEndSession)
	END_MSG_MAP()

public:
	CXAnalogClock m_wndClock;
	CCalenderWnd m_wndCalender;
	CWindow m_wndPrjTree;
	HBRUSH m_brBackGround;
	SIZE m_szbrBackGround;

protected:
	LRESULT OnPaint( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
	LRESULT OnLButtonDown( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
	LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnQueryEndSession(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	
	HICON m_icoExit;
	HICON m_icoPrevYear;
	HICON m_icoNextYear;
	HICON m_icoPrevMonth;
	HICON m_icoNextMonth;
	HICON m_icoToday;
	HFONT m_icoTextFont;
	int m_CurrentRegion, m_nOldRegion;

	HICON m_icoNodeClosed;
	HICON m_cioNodeOpen;
	HICON m_icoAttrib;
	enum EnToolBtnState
	{
		tbs_normal = 0,
		tbs_hover,
		tbs_prress_down,
	}m_nToolBtnState[6];
	RECT m_rcToolBtn[6];

	HBRUSH m_brToolBtnHover;
	int m_nLastToolBtnHit;

	enum SKIN
	{
		cpbob = 0,
		cpnobob,
		darkblue,
		silver,
		gold,
		black,
		lightblue,
		green,
		red,
		rose,
		aqua,
		neonblue,
		bluestreak,
		crystalgreen,
		crystalblack,
		crystalblue,
		crystalred,
		crystalyellow,
		silverring,
		minimal,
		white,
	};

	void SetSkin();

	struct SKIN_MENU_DATA
	{
		UINT nID;
		UINT nClockFaceBitmapId;
		UINT nDateBitmapId;
		TCHAR *pszName;
	};
	static SKIN_MENU_DATA	m_Skins[];
	static int				m_nSkins;
	SKIN					m_eSkin;
	ATL::CString m_strSkin;

	SKIN GetSkinFromName(LPCTSTR lpszSkinName);

private:
	void ParseNode(IDispatch* pNode,HTREEITEM hParent);
	HTREEITEM CJMainForm::InsertTreeItem(HTREEITEM hItem, LPCTSTR lpszItem, int nImage,
	int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter = TVI_LAST);
	BOOL SetTreeItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage,
	int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam);

	CXmlDocumentWrapper m_xmlDoc;
	HIMAGELIST m_imageListTreeView;
};

extern CJMainForm* g_pMainForm;


C++
BOOL CJMainForm::ShowForm(BOOL bShow)
{
	if (!m_hWnd || !IsWindow())
		Create(::GetDesktopWindow(), 0, 0, (WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN) & (~WS_CAPTION), WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW);

	DWORD dw = GetLastError();
	if (m_hWnd && bShow && IsWindow())
	{
		RECT rectWorkArea;
		SystemParametersInfo(SPI_GETWORKAREA, 0, (LPVOID)&rectWorkArea, 0);
		MoveWindow(&rectWorkArea);
		SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
	}

	if (!m_wndCalender.m_hWnd)
	{
		RECT rc = {0};
		rc.left = 64;
		rc.right = rc.left + 64 * 7 + 1;
		rc.top = 12;
		rc.bottom = rc.top + 64 * 6 + 24 + 1;
		rc.bottom += 24;
		m_wndCalender.Create(m_hWnd, &rc,"", WS_CHILD | WS_VISIBLE);
	}

	if (!m_wndClock.m_hWnd)
	{
		RECT rc = {0};
		rc.left = 64 + 12;
		rc.right = rc.left + 100;
		rc.top = 12;
		rc.bottom = rc.top + 64 * 6 + 24 + 24 + 1;
		rc.top = rc.bottom + 12;
		rc.bottom = rc.top + 100;
		m_wndClock.Create(m_hWnd, &rc,"", WS_CHILD | WS_VISIBLE);
		m_wndClock.SetHourAdjust(0);

		if (!m_strSkin.IsEmpty())
		{
			m_eSkin = GetSkinFromName(m_strSkin);
			SetSkin();
		}

		// start the clock
		m_wndClock.Run();
	}

	if (!m_wndPrjTree.m_hWnd)
	{
		if (!m_imageListTreeView)
		{
			m_imageListTreeView = ::ImageList_Create(16, 16,ILC_COLOR24|ILC_MASK,3,1);
			m_icoNodeClosed = (HICON)::LoadImage(g_hInstance , MAKEINTRESOURCE(IDI_NODECLOSED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
			m_cioNodeOpen = (HICON)::LoadImage(g_hInstance , MAKEINTRESOURCE(IDI_NODEOPEN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
			m_icoAttrib = (HICON)::LoadImage(g_hInstance , MAKEINTRESOURCE(IDI_ATTRIB), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
			ImageList_AddIcon(m_imageListTreeView,m_icoNodeClosed);
			ImageList_AddIcon(m_imageListTreeView, m_cioNodeOpen);
			ImageList_AddIcon(m_imageListTreeView, m_icoAttrib);
		}

		RECT rc = {0};
		rc.left = 64 * 8 + 12;
		rc.right = rc.left + 64 * 4;
		rc.top = 12;
		rc.bottom = rc.top + 64 * 6 + 24 + 1;
		rc.bottom += 24;
		m_wndPrjTree.Create(WC_TREEVIEWA,m_hWnd, &rc,"prjview", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP
			| TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_INFOTIP |TVS_TRACKSELECT|TVS_SINGLEEXPAND| TVS_DISABLEDRAGDROP);
		//m_wndPrjTree.ModifyStyleEx(0L, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE);
		::SendMessage(m_wndPrjTree.m_hWnd, TVM_SETIMAGELIST, (WPARAM)TVSIL_NORMAL, (LPARAM)m_imageListTreeView);
		::SendMessage(m_wndPrjTree.m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)RGB(224, 255, 224));
		m_xmlDoc.Load("F:\\XmlView\\UpgradeLog.XML");
		ParseNode(m_xmlDoc.AsNode(),TVI_ROOT);
	}

	if (m_hWnd && !bShow && IsWindow())
		ShowWindow(SW_HIDE);

	return (m_hWnd != NULL);
} 

QuestionCalling a URL from an MFC - MDI application Pin
Member 1210848611-Nov-15 18:22
Member 1210848611-Nov-15 18:22 
AnswerRe: Calling a URL from an MFC - MDI application Pin
Richard MacCutchan11-Nov-15 21:17
mveRichard MacCutchan11-Nov-15 21:17 
AnswerRe: Calling a URL from an MFC - MDI application Pin
David Crow12-Nov-15 2:26
David Crow12-Nov-15 2:26 
QuestionVS 2010 C++ Debug Pin
Harry_D11-Nov-15 5:02
Harry_D11-Nov-15 5:02 
AnswerRe: VS 2010 C++ Debug Pin
Richard Andrew x6411-Nov-15 6:27
professionalRichard Andrew x6411-Nov-15 6:27 
Questionmemory allocation error Pin
Member 1208345310-Nov-15 20:34
Member 1208345310-Nov-15 20:34 
AnswerRe: memory allocation error Pin
CPallini10-Nov-15 21:54
mveCPallini10-Nov-15 21:54 
GeneralRe: memory allocation error Pin
Member 1208345311-Nov-15 0:28
Member 1208345311-Nov-15 0:28 
GeneralRe: memory allocation error Pin
CPallini11-Nov-15 0:30
mveCPallini11-Nov-15 0:30 
QuestionRe: memory allocation error Pin
David Crow11-Nov-15 2:43
David Crow11-Nov-15 2:43 
GeneralRe: memory allocation error Pin
Stefan_Lang13-Nov-15 4:23
Stefan_Lang13-Nov-15 4:23 
QuestionStandalone Windows Application using Visual C++ and SQL DB is possible? Pin
Member 1212982010-Nov-15 11:36
Member 1212982010-Nov-15 11:36 
AnswerRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Garth J Lancaster10-Nov-15 12:14
professionalGarth J Lancaster10-Nov-15 12:14 
PraiseRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
David Crow10-Nov-15 14:40
David Crow10-Nov-15 14:40 
QuestionRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
David Crow10-Nov-15 14:41
David Crow10-Nov-15 14:41 
AnswerRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Richard MacCutchan10-Nov-15 23:02
mveRichard MacCutchan10-Nov-15 23:02 
GeneralRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Member 1212982016-Nov-15 11:02
Member 1212982016-Nov-15 11:02 

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.