This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
static HANDLE myCreateProcess(TCHAR* cmd, BOOL sync) | |
{ | |
PROCESS_INFORMATION ProcInfo = {0}; | |
STARTUPINFO StartUp = {sizeof(STARTUPINFO)}; | |
if (CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &StartUp, &ProcInfo)) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
bool shift = !!(GetKeyState(VK_SHIFT) & 0x8000); | |
cout << hex; | |
while (!( GetKeyState(VK_F7) & 0x8000 )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
int main() | |
{ | |
SendMessage(GetForegroundWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <iostream> | |
#include <string> | |
enum mode {unknown, open, playing, paused, stopped }; | |
class MCI | |
{ | |
// davidxl.blogspot.com | |
private: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#define CTRL_ALT_F1 101 | |
#define CTRL_F2 102 | |
#define ALT_F3 103 | |
#define CTRL_UP 104 | |
#define CTRL_DOWN 105 | |
#define CTRL_RIGHT 106 | |
#define CTRL_LEFT 107 | |
#define EXIT_KEYS 108 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> | |
int main() | |
{ | |
// GetCursorPos | |
puts("Press F8 to next example\n"); | |
POINT p; | |
while(!GetAsyncKeyState(VK_F8)) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <mmsystem.h> | |
#include <stdio.h> | |
int main() | |
{ | |
sndPlaySound("file.wav", SND_ASYNC | SND_FILENAME | SND_LOOP); | |
getchar(); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#define MONITOR_ON -1 | |
#define MONITOR_OFF 2 | |
#define MONITOR_STANBY 1 | |
int main() | |
{ | |
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool ispow2(int x) | |
{ | |
return !((~(~0U>>1)|x)&x -1) ; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <string.h> | |
#include <wchar.h> | |
static char* utf16_to_utf8 (const wchar_t *src) | |
{ | |
size_t len = wcslen(src), si, di; | |
char *dst = (char*)malloc(sizeof(*dst)*(3*len+1)); |