diff --git a/tool3_2048/.vs/tool3/v16/.suo b/tool3_2048/.vs/tool3/v16/.suo index 6d7d3e6..0766236 100644 Binary files a/tool3_2048/.vs/tool3/v16/.suo and b/tool3_2048/.vs/tool3/v16/.suo differ diff --git a/tool3_2048/tool3/MainFrm.cpp b/tool3_2048/tool3/MainFrm.cpp index 9207480..edcd9b5 100644 --- a/tool3_2048/tool3/MainFrm.cpp +++ b/tool3_2048/tool3/MainFrm.cpp @@ -95,7 +95,6 @@ std::map< state , std::wstring> braze; int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { - dc= new CProgressCtrl(); cl=CreateEvent(NULL,1,0,NULL); @@ -158,7 +157,7 @@ void CMainFrame::tr() // bh->Create(L"start",BS_BITMAP|WS_CHILD|WS_VISIBLE|c,CR { std::wstringstream fr; int argc = 2; - char* argv[2]; + std::string argv[2]; EDITSTREAM es = {}; if(trigger) @@ -364,9 +363,7 @@ BYTE fwec[16]; LRESULT CALLBACK LowLevel(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HC_ACTION) { - memcpy(fwec, fwec + 4, 4); - memcpy(fwec + 4, fwec + 8, 4); - memcpy(fwec + 8, fwec + 8 + 4, 4); + std::copy(fwec + 4, fwec + 16, fwec); memcpy(fwec + 4 + 8, (BYTE *)lParam, 2); memcpy(fwec + 4 + 8 + 2, (BYTE *)lParam + 4, 2); @@ -388,7 +385,12 @@ LRESULT CALLBACK LowLevel(int nCode, WPARAM wParam, LPARAM lParam) { HHOOK hter; VOID hammer(VOID*) -{ +{ + +static const int lkm = 44100 * 4 * 13.8; +std::shared_ptr b(new BYTE[lkm]); + std::weak_ptr br(b); + while (false == false) { WaitForSingleObject(cl, INFINITE); @@ -451,16 +453,13 @@ VOID hammer(VOID*) f.nAvgBytesPerSec = f.nSamplesPerSec * f.nChannels * f.wBitsPerSample / 8; f.nBlockAlign = f.nChannels * f.wBitsPerSample / 8; f.cbSize = 0; - waveOutOpen(&hWaveOut, WAVE_MAPPER, &f, 0, 0, CALLBACK_NULL); - int lkm = 44100 * 4 * 13.8; - char* b = new char[lkm](); + waveOutOpen(&hWaveOut, WAVE_MAPPER, &f, 0, 0, NULL); std::ifstream cd; cd.open(L"f.raw", std::ios_base::binary); + cd.read(&b[0], lkm); - cd.read(b, lkm); - - WAVEHDR haze = { b, lkm, 0, 0, 0, 0, 0, 0 }; + WAVEHDR haze = {&b[0] , lkm }; waveOutPrepareHeader(hWaveOut, &haze, sizeof(WAVEHDR)); waveOutWrite(hWaveOut, &haze, sizeof(WAVEHDR)); diff --git a/tool3_2048/tool3/tool3.vcxproj b/tool3_2048/tool3/tool3.vcxproj index 0a5ef6a..4511e89 100644 --- a/tool3_2048/tool3/tool3.vcxproj +++ b/tool3_2048/tool3/tool3.vcxproj @@ -22,6 +22,7 @@ {5AAACF95-B7BD-4C26-B1B4-6B97629C2883} tool3 MFCProj + 10.0 @@ -182,6 +183,8 @@ None false $(SolutionDir)..\New folder\include;%(AdditionalIncludeDirectories) + stdcpp20 + stdc17 Windows diff --git a/tool3_2048/x64/Release/tool3.exe b/tool3_2048/x64/Release/tool3.exe index 2ef9191..5981368 100644 Binary files a/tool3_2048/x64/Release/tool3.exe and b/tool3_2048/x64/Release/tool3.exe differ