Windows API C++ | Problem with GetOpenFileName / OPENFILENAME

I’m new to C++ I need to return the path to the file that the user has selected. For this i use winapi -> OPENFILENAME. When i try to return file path, i get only 1 character ("C" for disk C). My code: LPWSTR fileBuffer = new wchar_t[256]; OPENFILENAME ofn = { 0 }; ofn.lStructSize… Read More Windows API C++ | Problem with GetOpenFileName / OPENFILENAME

static_assert in templated member function of non-template class

I finally switched to MSVC 2022 in the last couple days and am getting a static_assert from code that had previously been working fine. I have a type that needs to have a member implemented differently based on whether a template parameter type is trivally constructable and destructable or not, but have not yet actually… Read More static_assert in templated member function of non-template class

What's the association between vc100 (default generator for Visual Studio 2010) and C++11/C++14?

I’m a new hand in C++ and I’ve got a question about some Visual Studio version names. C++98, C++11 and C++14 are versions of the ISO/IEC 14882 standard for the C++ programming language; this means, for example, C++11 has some new features added or modified compared to C++98, C++14 has some new features added or… Read More What's the association between vc100 (default generator for Visual Studio 2010) and C++11/C++14?

MSVC insists on using inaccessible member from private-inherited base class, although it was re-defined as public

Consider this code (godbolt example): #include <cstddef> template< std::size_t… sizes > class Impl { public: static constexpr std::size_t getDimension() { return sizeof…( sizes ); } }; template< std::size_t… sizes > class Wrapper : private Impl< sizes… > { using BaseType = Impl< sizes… >; public: //using BaseType::getDimension; static constexpr std::size_t getDimension() { return BaseType::getDimension(); }… Read More MSVC insists on using inaccessible member from private-inherited base class, although it was re-defined as public

Running a C++ Script In Visual Studio 2022 keeps deleting text within a file, not sure what's wrong with the code

I’ve been stuck working on this painful program for a few hours now in Visual Studio 2022, and am struggling to wrap my head around why it keeps deleting text in a different file each time I run it. For reference: For a C++ related assignment I have, I have to design a program that… Read More Running a C++ Script In Visual Studio 2022 keeps deleting text within a file, not sure what's wrong with the code

How to get size_t value out of std::thread::id on Windows?

How to get size_t value out of std::thread::id on Windows? The thread-id is 9120 (id and this_id). I tried a few ANSI C++ ways, but they resulted in a different id: Code: int main() { // Win API: const auto id = Concurrency::details::platform::GetCurrentThreadId(); // OK // ANSI C++: const std::thread::id this_id = std::this_thread::get_id(); // OK… Read More How to get size_t value out of std::thread::id on Windows?

Where are the Microsoft Visual C++ 2015-2022 Redistributable (x64) packages installed?

I know visual C++ 2015-2022 is installed because: A. I see it in Apps & Features (Microsoft Visual C++ 2015-2022 Redistributable (x64) – 14.31.31103 B. I see it in registry HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64 but %VCINSTALLDIR% is not set on my path, and I cant find the dll’s anywhere. I need to be really specific with my IT… Read More Where are the Microsoft Visual C++ 2015-2022 Redistributable (x64) packages installed?