add create directories
add create directories
This commit is contained in:
parent
615e731a1d
commit
fcfc8c2080
@ -3,6 +3,7 @@
|
|||||||
#include <Dwmapi.h>
|
#include <Dwmapi.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
#pragma comment(lib, "dwmapi.lib")
|
#pragma comment(lib, "dwmapi.lib")
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#pragma once
|
#pragma once
|
@ -3,3 +3,6 @@
|
|||||||
const MARGINS margins = { -1 ,-1, -1, -1 };
|
const MARGINS margins = { -1 ,-1, -1, -1 };
|
||||||
const char g_szClassName[] = "overlay";
|
const char g_szClassName[] = "overlay";
|
||||||
bool isVisible = true;
|
bool isVisible = true;
|
||||||
|
|
||||||
|
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
@ -133,10 +133,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="functions\addWatermark.h" />
|
<ClInclude Include="functions\addWatermark.h" />
|
||||||
<ClInclude Include="functions\captureScreen.h" />
|
<ClInclude Include="functions\captureScreen.h" />
|
||||||
<ClInclude Include="functions\screenRecoder.h" />
|
<ClInclude Include="functions\screenRecorder.h" />
|
||||||
<ClInclude Include="Include\Include.h" />
|
<ClInclude Include="Include\Include.h" />
|
||||||
<ClInclude Include="Include\Options.h" />
|
<ClInclude Include="Include\Options.h" />
|
||||||
<ClInclude Include="Include\Overlay.h" />
|
<ClInclude Include="Include\stdafx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
@ -28,7 +28,7 @@ void captureScreen(std::string file_screenshot)
|
|||||||
// Äîáàâëåíèå âàòåðìàðêè íà êîíòåêñò
|
// Äîáàâëåíèå âàòåðìàðêè íà êîíòåêñò
|
||||||
addWatermark(hdcScreen, hdcDIB, bmi);
|
addWatermark(hdcScreen, hdcDIB, bmi);
|
||||||
|
|
||||||
hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_screenshot).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\screenshot\\" + file_screenshot).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
BITMAPFILEHEADER hdr = { };
|
BITMAPFILEHEADER hdr = { };
|
||||||
hdr.bfType = 0x4d42; // Áóêâû 'B' è 'M'
|
hdr.bfType = 0x4d42; // Áóêâû 'B' è 'M'
|
||||||
hdr.bfOffBits = sizeof(hdr) + sizeof(BITMAPINFOHEADER);
|
hdr.bfOffBits = sizeof(hdr) + sizeof(BITMAPINFOHEADER);
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
void screenRecorder(std::string file_video)
|
void screenRecorder(std::string file_video)
|
||||||
{
|
{
|
||||||
std::string command = "ffmpeg -f gdigrab -framerate 60 -i desktop -c:v libx264 -preset ultrafast -tune zerolatency -crf 25 -pix_fmt yuv420p " + ("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_video);
|
std::string command = "ffmpeg -f gdigrab -framerate 60 -i desktop -c:v libx264 -preset ultrafast -tune zerolatency -crf 25 -pix_fmt yuv420p " + ("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\video\\" + file_video);
|
||||||
system(command.c_str());
|
system(command.c_str());
|
||||||
}
|
}
|
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
std::string folder_path = "C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\";
|
||||||
|
if (!std::filesystem::exists(folder_path)) {
|
||||||
|
std::filesystem::create_directories(folder_path);
|
||||||
|
std::filesystem::create_directories(folder_path + "video");
|
||||||
|
std::filesystem::create_directories(folder_path + "screenshot");
|
||||||
|
}
|
||||||
|
|
||||||
std::string file_screenshot = "screenshot_" + std::to_string(time(NULL)) + ".bmp";
|
std::string file_screenshot = "screenshot_" + std::to_string(time(NULL)) + ".bmp";
|
||||||
std::string file_video = "video_" + std::to_string(time(NULL)) + ".mp4";
|
std::string file_video = "video_" + std::to_string(time(NULL)) + ".mp4";
|
||||||
|
|
||||||
@ -80,9 +87,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
g_szClassName,
|
g_szClassName,
|
||||||
g_szClassName,
|
g_szClassName,
|
||||||
WS_POPUP | WS_VISIBLE,
|
WS_POPUP | WS_VISIBLE,
|
||||||
0, 0, 1920, 1080,
|
0, 0, screenWidth, screenHeight,
|
||||||
NULL, NULL, hInstance, NULL);
|
NULL, NULL, hInstance, NULL);
|
||||||
|
|
||||||
|
|
||||||
SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 255, LWA_ALPHA);
|
SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 255, LWA_ALPHA);
|
||||||
DwmExtendFrameIntoClientArea(hwnd, &margins);
|
DwmExtendFrameIntoClientArea(hwnd, &margins);
|
||||||
|
|
||||||
@ -91,6 +99,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
RegisterHotKey(hwnd, 3, MOD_ALT, 0x50);
|
RegisterHotKey(hwnd, 3, MOD_ALT, 0x50);
|
||||||
RegisterHotKey(hwnd, 4, MOD_ALT, 0x56);
|
RegisterHotKey(hwnd, 4, MOD_ALT, 0x56);
|
||||||
|
|
||||||
|
|
||||||
while (GetMessage(&Msg, NULL, 0, 0) > 0)
|
while (GetMessage(&Msg, NULL, 0, 0) > 0)
|
||||||
{
|
{
|
||||||
TranslateMessage(&Msg);
|
TranslateMessage(&Msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user