msbuild, how to set environment variables?

The coded task can be put right at the project file since MSBuild v4.0. Like this: <UsingTask TaskName=”SetEnvironmentVariableTask” TaskFactory=”CodeTaskFactory” AssemblyFile=”$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll”> <ParameterGroup> <Name ParameterType=”System.String” Required=”true” /> <Value ParameterType=”System.String” Required=”true” /> </ParameterGroup> <Task> <Using Namespace=”System” /> <Code Type=”Fragment” Language=”cs”> <![CDATA[ Environment.SetEnvironmentVariable(Name, Value); ]]> </Code> </Task> </UsingTask> Note that in MSBuild 14+, the AssemblyFile reference should be just: … Read more

How to detect a CListCtrl selection change?

Also try: BEGIN_MESSAGE_MAP(cDlgRun, CDialog) ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2) END_MESSAGE_MAP() /* … */ void cDlgRun::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; if ((pNMListView->uChanged & LVIF_STATE) && (pNMListView->uNewState & LVIS_SELECTED)) { // do stuff… } }

VC++ resources in a static library

The only thing you need to do to use resources (images, dialogs, etc…) in a static library in Visual C++ (2008), is include the static library’s associated .res file in your project. This can be done at “Project settings/Linker/Input/Additional dependencies”. With this solution, the resources of the static library are packed into the .exe, so … Read more

warning C4996: ‘GetVersionExW’: was declared deprecated

The basic question is “why are you calling GetVersionExW in the first place?” The answer to that question determines what you should do instead. The deprecation warning is there to give developers a heads-up about the appcompat behavior change that started in Windows 8.1. See Windows and Windows Server compatibility cookbook: Windows 8, Windows 8.1, … Read more

Runtime error R6034 in embedded Python application

The problem was caused by third-party software that had added itself to the path and installed msvcr90.dll in its program folder. In this case, the problem was caused by Intel’s iCLS Client. Here’s how to find the problem in similar situations: Download Process Explorer here. Start your application and reproduce runtime error R6034. Start Process … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)