-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
30 lines (26 loc) · 710 Bytes
/
main.cpp
File metadata and controls
30 lines (26 loc) · 710 Bytes
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
#include <Windows.h>
#include <thread>
#include <chrono>
// Function to simulate pressing Ctrl + S
void pressCtrlS() {
// Press Ctrl
keybd_event(VK_CONTROL, 0, 0, 0);
// Press S
keybd_event('S', 0, 0, 0);
// Release S
keybd_event('S', 0, KEYEVENTF_KEYUP, 0);
// Release Ctrl
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
}
int main() {
// Set the interval for saving (in milliseconds)
int interval = 10000; // 10 seconds
// Loop indefinitely
while (true) {
// Simulate Ctrl + S keypress
pressCtrlS();
// Wait for the specified interval
std::this_thread::sleep_for(std::chrono::milliseconds(interval));
}
return 0;
}