bugfixing GUI

This commit is contained in:
NtQuery 2014-03-13 18:30:51 +01:00
parent b4217f1d11
commit 3f824021eb
2 changed files with 38 additions and 19 deletions

View File

@ -133,27 +133,44 @@ INT_PTR CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
case IDC_COPY: { case IDC_COPY: {
//get lines //get lines
int cnt = SendMessage(hLogBox, LB_GETCOUNT, 0, 0); LRESULT cnt = SendMessage(hLogBox, LB_GETCOUNT, 0, 0);
TCHAR buf[MAX_LOG_LINE_LENGTH] = {0};
TCHAR copy[MAX_LOG_LINE_COUNT*MAX_LOG_LINE_LENGTH] = {0};
for(int i=0; i<MAX_LOG_LINE_COUNT; i++) { if (cnt != 0 && cnt != LB_ERR)
SendMessage(hLogBox, LB_GETTEXT, i, (LPARAM)buf); {
lstrcat(copy, buf); TCHAR buf[MAX_LOG_LINE_LENGTH] = {0};
lstrcat(copy, L"\n"); TCHAR copy[MAX_LOG_LINE_COUNT*MAX_LOG_LINE_LENGTH*3] = {0};
for(LRESULT i=0; i<cnt; i++) {
if (SendMessage(hLogBox, LB_GETTEXT, i, (LPARAM)buf) != LB_ERR)
{
_tcscat(copy, buf);
_tcscat(copy, L"\r\n");
}
} }
//copy to clipboard //copy to clipboard
HGLOBAL clipbuffer; HGLOBAL clipbuffer;
TCHAR* buffer; TCHAR* buffer;
clipbuffer = GlobalAlloc(GMEM_DDESHARE, sizeof(copy)); clipbuffer = GlobalAlloc(GMEM_MOVEABLE, (_tcslen(copy) + 1) * sizeof(TCHAR));
if (clipbuffer)
{
buffer = (TCHAR*)GlobalLock(clipbuffer); buffer = (TCHAR*)GlobalLock(clipbuffer);
wcscpy(buffer, copy); _tcscpy(buffer, copy);
GlobalUnlock(clipbuffer); GlobalUnlock(clipbuffer);
OpenClipboard(NULL); OpenClipboard(NULL);
EmptyClipboard(); EmptyClipboard();
SetClipboardData(CF_UNICODETEXT,clipbuffer); UINT format;
#ifdef UNICODE
format = CF_UNICODETEXT;
#else
format = CF_OEMTEXT;
#endif
SetClipboardData(format, clipbuffer);
}
CloseClipboard(); CloseClipboard();
}
break; break;
} }

View File

@ -122,6 +122,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -142,6 +143,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>