This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathshared.h
66 lines (59 loc) · 1.75 KB
/
shared.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* MoveToDesktop
*
* Copyright (C) 2015-2016 by Tobias Salzmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define MAXDESKTOPS 255
#define MOVETOMENU_ID (0xDE100)
#define MOVETOMENU_NEW (MOVETOMENU_ID + 1)
#define MOVETOMENU_START (MOVETOMENU_NEW + 1)
#define MOVETOMENU_LAST (MOVETOMENU_START + MAXDESKTOPS)
#define MOVETOMENU_LEFT (MOVETOMENU_LAST + 1)
#define MOVETOMENU_RIGHT (MOVETOMENU_LEFT + 1)
#define INIFILE "%APPDATA%\\MoveToDesktop.ini"
#define MAX_HOTKEY_SIZE 128
#ifdef _DEBUG
#define LOGFILE "%temp%\\MoveToDesktop.log"
#include <stdarg.h>
inline void Log(char *message, ...)
{
FILE *file;
TCHAR logFile[MAX_PATH] = { 0 };
ExpandEnvironmentStrings(LOGFILE, logFile, _countof(logFile));
fopen_s(&file, logFile, "a");
if (file == NULL) {
return;
}
else
{
char exepath[MAX_PATH];
char inpmsg[1024] = "";
char finalmsg[1024 + MAX_PATH] = "";
va_list ptr;
va_start(ptr, message);
vsprintf_s(inpmsg, sizeof(inpmsg), message, ptr);
va_end(ptr);
GetModuleFileName(0, exepath, MAX_PATH);
sprintf_s(finalmsg, sizeof(finalmsg), "%s: %s\n", exepath, inpmsg);
fputs(finalmsg, file);
fclose(file);
}
if (file)
fclose(file);
}
#else
#define Log
#endif