LEFEVRE Damien .net

Tuesday 19 April 2011, 09:36

VisualStudio - Post build commands

A small syntax reminder for the copy post-build command I like to add on certain DLL projects.

Copy $(OutDir)\$(TargetName).lib %TARGET_DIR%
Copy $(OutDir)\$(TargetName).dll %TARGET_DIR%

Sunday 10 January 2010, 15:41

Icons on CMFCPropertySheet missing.

When recently trying to use the CMFCPropertySheet class with CMFCPropertySheet::PropSheetLook_Tree, I ran into the problem that the class does not give any options to customize the look the the tree control on the left side.

With CMFCPropertySheet, it is possible to set a list of icons or an empty list. In both cases there is no options to have the buttons (+ or - square) or the line in the tree.

Here is one way to fix this problem.


Friday 18 December 2009, 12:48

MFC - Get application directory from anywhere (main exe, DLLs)

BOOL GetApplicationDirectory(CString& _sApplicationDirectory)
	TCHAR szPathName[_MAX_PATH];
	if (FAILED(::GetModuleFileName(NULL, szPathName, _MAX_PATH)))
		return FALSE;

	TCHAR szDirectory[_MAX_DIR];
	TCHAR szFileName[_MAX_FNAME];
	TCHAR szExtension[_MAX_EXT];

	// Split path
	_tsplitpath_s(szPathName, szDrive, _MAX_DRIVE, szDirectory, _MAX_DIR, 
		szFileName, _MAX_FNAME, szExtension, _MAX_EXT);

	// Make safe path
	_tmakepath_s(szPathName, _MAX_PATH, szDrive, szDirectory, _T(""), _T(""));

	_sApplicationDirectory = szPathName;

	return TRUE;