rebuild
rebuild
This commit is contained in:
parent
a5e6d46015
commit
c476690af7
8
Overlay/Include/Include.h
Normal file
8
Overlay/Include/Include.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include <Windows.h>
|
||||||
|
#include <chrono>
|
||||||
|
#include <Dwmapi.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#pragma comment(lib, "dwmapi.lib")
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
#pragma once
|
5
Overlay/Include/Options.h
Normal file
5
Overlay/Include/Options.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Include.h"
|
||||||
|
const MARGINS margins = { -1 ,-1, -1, -1 };
|
||||||
|
const char g_szClassName[] = "overlay";
|
||||||
|
bool isVisible = true;
|
5
Overlay/Include/Overlay.h
Normal file
5
Overlay/Include/Overlay.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Include.h"
|
||||||
|
#include "Options.h"
|
||||||
|
#include "../functions/addWatermark.h"
|
||||||
|
#include "../functions/captureScreen.h"
|
@ -130,6 +130,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="functions\addWatermark.h" />
|
||||||
|
<ClInclude Include="functions\captureScreen.h" />
|
||||||
|
<ClInclude Include="Include\Include.h" />
|
||||||
|
<ClInclude Include="Include\Options.h" />
|
||||||
|
<ClInclude Include="Include\Overlay.h" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -3,4 +3,29 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Include">
|
||||||
|
<UniqueIdentifier>{84d30480-42d9-4793-b08b-1bb6712fd72b}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="functions">
|
||||||
|
<UniqueIdentifier>{140481ac-0012-4a9a-803c-5f6ddcde3cca}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="Include\Include.h">
|
||||||
|
<Filter>Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="functions\addWatermark.h">
|
||||||
|
<Filter>functions</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="functions\captureScreen.h">
|
||||||
|
<Filter>functions</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Include\Options.h">
|
||||||
|
<Filter>Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Include\Overlay.h">
|
||||||
|
<Filter>Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
26
Overlay/functions/addWatermark.h
Normal file
26
Overlay/functions/addWatermark.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "../Include/Include.h"
|
||||||
|
|
||||||
|
void addWatermark(HDC hdc, HDC hdcDIB, BITMAPINFO bmi)
|
||||||
|
{
|
||||||
|
HFONT hFont;
|
||||||
|
LOGFONT lf = { 0 };
|
||||||
|
lf.lfHeight = -MulDiv(20, GetDeviceCaps(hdc, LOGPIXELSY), 72); // ðàçìåð øðèôòà
|
||||||
|
lf.lfWeight = FW_NORMAL; // æèðíîñòü øðèôòà
|
||||||
|
lf.lfCharSet = DEFAULT_CHARSET;
|
||||||
|
lf.lfOutPrecision = OUT_TT_PRECIS;
|
||||||
|
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||||
|
lf.lfQuality = DEFAULT_QUALITY;
|
||||||
|
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
|
||||||
|
strcpy_s(lf.lfFaceName, "Arial");
|
||||||
|
|
||||||
|
hFont = CreateFontIndirect(&lf);
|
||||||
|
SelectObject(hdcDIB, hFont);
|
||||||
|
|
||||||
|
std::string watermark = "vos.team";
|
||||||
|
|
||||||
|
SetTextColor(hdcDIB, RGB(255, 0, 255, 128));
|
||||||
|
SetBkMode(hdcDIB, TRANSPARENT);
|
||||||
|
TextOut(hdcDIB, 10, 10, watermark.c_str(), watermark.length());
|
||||||
|
DeleteObject(hFont);
|
||||||
|
}
|
43
Overlay/functions/captureScreen.h
Normal file
43
Overlay/functions/captureScreen.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "addWatermark.h"
|
||||||
|
|
||||||
|
void captureScreen(std::string file_Name)
|
||||||
|
{
|
||||||
|
HDC hdcScreen;
|
||||||
|
HDC hdcDIB;
|
||||||
|
HBITMAP hbmDIB;
|
||||||
|
BITMAPINFO bmi;
|
||||||
|
LPVOID lpvBits;
|
||||||
|
HANDLE hFile;
|
||||||
|
DWORD dwBytesWritten;
|
||||||
|
|
||||||
|
|
||||||
|
hdcScreen = GetDC(NULL);
|
||||||
|
hdcDIB = CreateCompatibleDC(hdcScreen);
|
||||||
|
ZeroMemory(&bmi, sizeof(BITMAPINFO));
|
||||||
|
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
bmi.bmiHeader.biWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
bmi.bmiHeader.biHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
bmi.bmiHeader.biPlanes = 1;
|
||||||
|
bmi.bmiHeader.biBitCount = 24;
|
||||||
|
bmi.bmiHeader.biCompression = BI_RGB;
|
||||||
|
hbmDIB = CreateDIBSection(hdcScreen, &bmi, DIB_RGB_COLORS, &lpvBits, NULL, 0);
|
||||||
|
SelectObject(hdcDIB, hbmDIB);
|
||||||
|
BitBlt(hdcDIB, 0, 0, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight, hdcScreen, 0, 0, SRCCOPY);
|
||||||
|
|
||||||
|
// Äîáàâëåíèå âàòåðìàðêè íà êîíòåêñò
|
||||||
|
addWatermark(hdcScreen, hdcDIB, bmi);
|
||||||
|
|
||||||
|
hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_Name).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
BITMAPFILEHEADER hdr = { };
|
||||||
|
hdr.bfType = 0x4d42; // Áóêâû 'B' è 'M'
|
||||||
|
hdr.bfOffBits = sizeof(hdr) + sizeof(BITMAPINFOHEADER);
|
||||||
|
hdr.bfSize = hdr.bfOffBits + bmi.bmiHeader.biWidth * bmi.bmiHeader.biHeight * 3;
|
||||||
|
WriteFile(hFile, &hdr, sizeof(hdr), &dwBytesWritten, NULL);
|
||||||
|
WriteFile(hFile, &bmi.bmiHeader, sizeof(BITMAPINFOHEADER), &dwBytesWritten, NULL);
|
||||||
|
WriteFile(hFile, lpvBits, bmi.bmiHeader.biWidth * bmi.bmiHeader.biHeight * 3, &dwBytesWritten, NULL);
|
||||||
|
CloseHandle(hFile);
|
||||||
|
DeleteObject(hbmDIB);
|
||||||
|
DeleteDC(hdcDIB);
|
||||||
|
ReleaseDC(NULL, hdcScreen);
|
||||||
|
}
|
@ -1,79 +1,4 @@
|
|||||||
#include <Windows.h>
|
#include "Include/Overlay.h"
|
||||||
#include <chrono>
|
|
||||||
#include <Dwmapi.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#pragma comment(lib, "dwmapi.lib")
|
|
||||||
#pragma warning(disable : 4996)
|
|
||||||
|
|
||||||
const MARGINS margins = { -1 ,-1, -1, -1 };
|
|
||||||
const char g_szClassName[] = "overlay";
|
|
||||||
bool isVisible = true;
|
|
||||||
|
|
||||||
void addWatermark(HDC hdc, HDC hdcDIB, BITMAPINFO bmi)
|
|
||||||
{
|
|
||||||
HFONT hFont;
|
|
||||||
LOGFONT lf = { 0 };
|
|
||||||
lf.lfHeight = -MulDiv(20, GetDeviceCaps(hdc, LOGPIXELSY), 72); // ðàçìåð øðèôòà
|
|
||||||
lf.lfWeight = FW_NORMAL; // æèðíîñòü øðèôòà
|
|
||||||
lf.lfCharSet = DEFAULT_CHARSET;
|
|
||||||
lf.lfOutPrecision = OUT_TT_PRECIS;
|
|
||||||
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
|
||||||
lf.lfQuality = DEFAULT_QUALITY;
|
|
||||||
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
|
|
||||||
strcpy_s(lf.lfFaceName, "Arial");
|
|
||||||
|
|
||||||
hFont = CreateFontIndirect(&lf);
|
|
||||||
SelectObject(hdcDIB, hFont);
|
|
||||||
|
|
||||||
std::string watermark = "vos.team";
|
|
||||||
|
|
||||||
SetTextColor(hdcDIB, RGB(255, 0, 255, 128));
|
|
||||||
SetBkMode(hdcDIB, TRANSPARENT);
|
|
||||||
TextOut(hdcDIB, 10, 10, watermark.c_str(), watermark.length());
|
|
||||||
DeleteObject(hFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
void captureScreen(std::string file_Name)
|
|
||||||
{
|
|
||||||
HDC hdcScreen;
|
|
||||||
HDC hdcDIB;
|
|
||||||
HBITMAP hbmDIB;
|
|
||||||
BITMAPINFO bmi;
|
|
||||||
LPVOID lpvBits;
|
|
||||||
HANDLE hFile;
|
|
||||||
DWORD dwBytesWritten;
|
|
||||||
|
|
||||||
|
|
||||||
hdcScreen = GetDC(NULL);
|
|
||||||
hdcDIB = CreateCompatibleDC(hdcScreen);
|
|
||||||
ZeroMemory(&bmi, sizeof(BITMAPINFO));
|
|
||||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
|
||||||
bmi.bmiHeader.biWidth = GetSystemMetrics(SM_CXSCREEN);
|
|
||||||
bmi.bmiHeader.biHeight = GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
bmi.bmiHeader.biPlanes = 1;
|
|
||||||
bmi.bmiHeader.biBitCount = 24;
|
|
||||||
bmi.bmiHeader.biCompression = BI_RGB;
|
|
||||||
hbmDIB = CreateDIBSection(hdcScreen, &bmi, DIB_RGB_COLORS, &lpvBits, NULL, 0);
|
|
||||||
SelectObject(hdcDIB, hbmDIB);
|
|
||||||
BitBlt(hdcDIB, 0, 0, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight, hdcScreen, 0, 0, SRCCOPY);
|
|
||||||
|
|
||||||
// Äîáàâëåíèå âàòåðìàðêè íà êîíòåêñò
|
|
||||||
addWatermark(hdcScreen, hdcDIB, bmi);
|
|
||||||
|
|
||||||
hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_Name).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
BITMAPFILEHEADER hdr = { };
|
|
||||||
hdr.bfType = 0x4d42; // Áóêâû 'B' è 'M'
|
|
||||||
hdr.bfOffBits = sizeof(hdr) + sizeof(BITMAPINFOHEADER);
|
|
||||||
hdr.bfSize = hdr.bfOffBits + bmi.bmiHeader.biWidth * bmi.bmiHeader.biHeight * 3;
|
|
||||||
WriteFile(hFile, &hdr, sizeof(hdr), &dwBytesWritten, NULL);
|
|
||||||
WriteFile(hFile, &bmi.bmiHeader, sizeof(BITMAPINFOHEADER), &dwBytesWritten, NULL);
|
|
||||||
WriteFile(hFile, lpvBits, bmi.bmiHeader.biWidth * bmi.bmiHeader.biHeight * 3, &dwBytesWritten, NULL);
|
|
||||||
CloseHandle(hFile);
|
|
||||||
DeleteObject(hbmDIB);
|
|
||||||
DeleteDC(hdcDIB);
|
|
||||||
ReleaseDC(NULL, hdcScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user