visual-c++

VC.net String to LPWSTR

我与影子孤独终老i 提交于 2020-01-17 06:16:08
问题 How can I transform from string to LPWSTR String^ str= "hello world"; LPWSTR apppath= (LPWSTR)(Marshal::StringToHGlobalAnsi(str).ToPointer()); But it doesn't work.After transformed: 回答1: You're trying to read single-byte characters (that's what Marshal::StringToHGlobalAnsi is returning) as wide characters (that's what an LPWSTR type points to), and you're getting whatever is in memory interpreted as a wide-character string. You need to marshal the appropriate type, and you need to be aware of

MAC addresses on a machine / filtering out the MAC addresses of plug and play devices

痞子三分冷 提交于 2020-01-17 06:14:51
问题 I have the following code which runs through and populates a character array with up to 3 WiFi and Ethernet adapter MAC addresses on a Windows machine: IP_ADAPTER_INFO *info = NULL, *pos; DWORD size = 0; if (GetAdaptersInfo(info, &size) != ERROR_BUFFER_OVERFLOW) return; info = (IP_ADAPTER_INFO *)malloc(size); if (GetAdaptersInfo(info, &size) != ERROR_SUCCESS) return; char addresses[1024]; char buffer[1024]; memset(addresses, 0, sizeof(addresses)); memset(buffer, 0, sizeof(buffer)); int

How to get MFC serialization going without a CWinApp-derived class?

送分小仙女□ 提交于 2020-01-17 06:04:19
问题 I am writing a C++/CLI wrapper for an old MFC application, so far i have been able to read most of the data and convert the same into C# readable format. As of now i am only struggling with reading data and am worried will writing data back to old MFC code affect serialization ? Can you guys share/mention any other risks i might face while writing C++/CLI wrapper for MFC code ? Thanks for your inputs. this question is a continuation of "Redirecting data from MFC CArchive to boost::archive:

Run-Time Check Failure #0: Using C-exports from MinGW dll in VC++ (or: Using libclang MinGW build in VC++ application)

依然范特西╮ 提交于 2020-01-17 04:54:05
问题 This question is about using C-Functions from a MinGW dll in a VC++ project, which fails with the following error: Run-Time Check Failure #0 . I successfully build clang and more importantly libclang using MinGW (to have a libclang.dll that uses the MinGW standard library). My application previously used a VC++-build of libclang, that I now want to exchange with the MinGW build. To do that, I created a def-file and afterwards an import library from the MinGW dll file: dlltool -z libclang.def

Access violation on std::function assignement using lambdas

Deadly 提交于 2020-01-17 03:55:07
问题 Hy everyone, here again. Continuing the code from my previous question : Is this a bad hack? memcpy with virtual classes I corrected that, using the Clone approach as suggested, but I'm having an error that also happened before I tried the memcpy thing(read question above). What I'm trying to do is to create a lambda that captures the current script and executes it, and then pass and store that lambda in an object ( Trigger*), in the member InternalCallback. I get an access violation error on

how to implement icmpsendecho2 asynchronous with callback example vc

雨燕双飞 提交于 2020-01-17 03:44:32
问题 I have a need to use the IcmpSendEcho2 API command asynchronously using the ApcRoutine callback routine. A question I have is what would the signature look like for the ApcRoutine callback routine I need to define? When I call IcmpSendEcho2 what would the third parameter look like? I have some 15 proxy request to be sent. should I request with IcmpSendEcho2 only once or multiple times. If I will need to send many IcmpSendEcho2 requests at one time. How will the callback ApcRoutine know which

Why isn't cl.exe producing a valid Windows module?

拈花ヽ惹草 提交于 2020-01-17 03:24:11
问题 I have a simple C DLL that exposes functions from a static library. The DLL compiles without errors and I can run DUMPBIN on it to see the exports. However, when I attempt to load it with DllImport in C#, it says this: System.DllNotFoundException: Unable to load DLL 'ei.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E). It's in the correct directory, for sure. So, I read that it might be a good idea to try Dependency Walker, in case I need to include

Tweaking NppAutoIndent, or is there a good customizable alternative?

江枫思渺然 提交于 2020-01-17 02:39:12
问题 I recently started using the NppAutoIndent plugin for Notepad++, and have been fairly pleased with the Smart Indent mode, but I find its lack of customizable preferences to be annoying as there are a few behaviors in Smart Indent mode that I'd like to tweak/modify. I thought about modifying the plugin's source code and recompiling it to try to get the behavior I want, but I have Visual Studio 2010 and the project for the plugin seems to be a VS 2003 project, and as I'm a complete beginner to

Setting up VST Steinberg SDK on Windows

江枫思渺然 提交于 2020-01-16 20:00:13
问题 I need to write a basic VST plugin (2.4) in Visual C++. I Googled it, but what I found is lots of deprecated descriptions with dead links. Could anyone recommend me a good step by step guide which helps setting up the environment in Windows 7 (I would like to use Code Blocks) and test the plugin with the test host? This blogpost says that it's possible to build the plugin in Code Blocks. I followed the instructions, but in the latest Steinberg SDK the files are different. 回答1: VST2.4 and VST3

GetCurrentDirectory for startup App. c++ [duplicate]

心不动则不痛 提交于 2020-01-16 19:17:50
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: Win32: Find what directory the running process EXE is stored in How to get the application executable name in Windows (C++ Win32 or C++/CLI)? hi, i want to make my application run on statup,it uses some of files in the same directory.it works good but when it start at startup the GetCurrentDirectory is "c:\Documents and Settings\User\"..but i want the actual path of the exe file.how i can get it in c++. please