visual-c++

Reusing enum values in separate enum types

坚强是说给别人听的谎言 提交于 2020-01-12 04:21:05
问题 Is there a way to reuse the same enum value in separate types? I'd like to be able to something like the following: enum DeviceState { UNKNOWN, ACTIVE, DISABLED, NOTPRESENT, UNPLUGGED }; enum DeviceType { UNKNOWN, PLAYBACK, RECORDING }; int _tmain(int argc, _TCHAR* argv[]) { DeviceState deviceState = DeviceState::UNKNOWN; DeviceType deviceType = DeviceType::UNKNOWN; return 0; } This makes sense to me, but not to the C++ compiler- it complains: error C2365: 'UNKNOWN' : redefinition; previous

How to properly set target OS version when building a library on Windows using Visual C++ compiler

和自甴很熟 提交于 2020-01-12 03:53:08
问题 I'm building a cross-platform library using Visual C++ 2013 compiler with C++11 features on Windows platform specifically, using CMake (NMake generator) for build system. I'm using Windows 7. My library uses some of functions/enum values/structure members available only in Windows 8/7. I want to be able to build the library for Windows XP, Windows Vista, Windows 7 and Windows 8/8.1 OS versions and x86, x64 and arm architectures, i.e. not a single build that just targets Windows XP and works

How to properly set target OS version when building a library on Windows using Visual C++ compiler

我们两清 提交于 2020-01-12 03:52:14
问题 I'm building a cross-platform library using Visual C++ 2013 compiler with C++11 features on Windows platform specifically, using CMake (NMake generator) for build system. I'm using Windows 7. My library uses some of functions/enum values/structure members available only in Windows 8/7. I want to be able to build the library for Windows XP, Windows Vista, Windows 7 and Windows 8/8.1 OS versions and x86, x64 and arm architectures, i.e. not a single build that just targets Windows XP and works

Hiding an MFC dialog box

ぐ巨炮叔叔 提交于 2020-01-12 03:42:05
问题 Ok so I am using this code to hide the taskbar icon of a dialog based MFC application(VC++). The taskbar icon and the dialog box hide whenever I click on the cross or the close buttons. But I can’t get this one thing right. Whenever I hit the close or the cross button from title bar, the dialog box first flickers and shows a sort of intermediate dialog box and then hides. This is very annoying. I am posting my code here after two days of vain effort. So guys please help me. Thanks in advance.

how can I set static controls background color programmatically

て烟熏妆下的殇ゞ 提交于 2020-01-11 13:10:27
问题 I want to change label background color within a function, I tried this code but nothing changed after calling changecolor function HWND hWndLabel; LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: hWndLabel = CreateWindowEx(WS_EX_TRANSPARENT, L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | WS_SYSMENU, 75, 75, 70, 70, hWnd, (HMENU)labelId, hInst, NULL); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_COMMAND: //

how can I set static controls background color programmatically

一世执手 提交于 2020-01-11 13:10:08
问题 I want to change label background color within a function, I tried this code but nothing changed after calling changecolor function HWND hWndLabel; LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: hWndLabel = CreateWindowEx(WS_EX_TRANSPARENT, L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | WS_SYSMENU, 75, 75, 70, 70, hWnd, (HMENU)labelId, hInst, NULL); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_COMMAND: //

MSBuild AfterBuild Step

送分小仙女□ 提交于 2020-01-11 12:49:08
问题 I have added the following code to a VisualC++ 2010 .vcxproj file just inside the first <project> tag: <PropertyGroup> <PilotStationDirectory>\..\..\PilotStation\PilotStationApp\$(Configuration)</PilotStationDirectory> </PropertyGroup> <ItemGroup> <MySourceFiles Include="$(TargetName).dll;$(TargetName).lib;$(TargetName).pdb" /> </ItemGroup> <Target Name="AfterBuild"> <MakeDir Directories="$(PilotStationDirectory)" /> <Copy SourceFiles="@(MySourceFiles)" DestinationFolder="$

error: command 'C:\\ Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

强颜欢笑 提交于 2020-01-11 12:47:08
问题 Hi so I was trying to pip install python-ldap using my git bash but at first it told me that i don't have cl.exe so i downloaded the visual studio C++ pack now it's showing this error error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2 I never coded with C++ so I'm not sure what the error is. I downloaded the CLI tools for C++ too and I don't think it's because the cl.exe isn't in

Why `is_constructible<function<int(int)>, int(*)(int,int)>::value` is true under VC2015RC

房东的猫 提交于 2020-01-11 12:30:12
问题 #include <functional> using namespace std; int main() { static_assert(is_constructible<function<int(int)>, int(*)(int,int)>::value, "error"); } The code doesn't compile with GCC and Clang, but passed with Visual C++ 2015 RC. Is this standard compliant behavior or just a bug? 回答1: std::function 's constructor used to accept everything under the sun (it was a template<class F> function(F f) ). Then it got constrained in the standard (by LWG issue 2132), but implementing that constraint requires

Targetting Windows xp from visual studio 2015 enterprise update 1

大兔子大兔子 提交于 2020-01-11 12:18:31
问题 I would like to know whether we can build the projects/binaries using visual studio 2015 which can run on Windows xp ? If its supported then how we can build ? 回答1: Configuring C++ 11 Programs for Windows XP The Windows XP platform toolset that's included in Visual Studio is a version of the Windows 7 SDK that was included in Visual Studio 2010, but it uses the current C++ compiler. It also configures project properties to appropriate default values—for example, the specification of a