-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths.cpp
36 lines (30 loc) · 1.22 KB
/
s.cpp
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
#include <Windows.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
//This code is taken and modified from memz virus: https://github.com/Leurak/MEMZ
int main(int argc, char* argv[]) {
HWND hwnd = GetDesktopWindow();
HDC hdc = GetWindowDC(hwnd);
srand (time(NULL));
HICON hIcon = (HICON) LoadImage( // returns a HANDLE so we have to cast to HICON
NULL, // hInstance must be NULL when loading from a file
"icon7.1.ico", // the icon file name
IMAGE_ICON, // specifies that the file is an icon
0, // width of the image (we'll specify default later on)
0, // height of the image
LR_LOADFROMFILE| // we want to load a file (as opposed to a resource)
LR_DEFAULTSIZE| // default metrics based on the type (IMAGE_ICON, 32x32)
LR_SHARED // let the system release the handle when it's no longer used
);
RECT rekt;
GetWindowRect(hwnd, &rekt);
int w = rekt.right - rekt.left;
int h = rekt.bottom - rekt.top;
while(true){
int ix = GetSystemMetrics(SM_CXICON) / 2;
int iy = GetSystemMetrics(SM_CYICON) / 2;
if((rand() % 10) >4)DrawIcon(hdc, rand()%(w-ix), rand()%(h-iy), hIcon);
Sleep(250);
}
}