This article shares the specific implementation code of C language window jitter for your reference. The specific content is as follows
#include "" #include <> #include<> int main() { int shake_time = 50; //The sleep time is 5 milliseconds int shake_distance = 10; //Move 10 pixels RECT rect; //RECT is a rectangular structure, which is equivalent to saving the coordinates of four sides of a rectangle HWND window = NULL, oldwindow = NULL; //Two window handles int x, y, width, height; //Variables used to save window horizontal and vertical coordinates, width and height int i; //Thumb 50 times for (i = 0; i < 10; i++) { window = GetForegroundWindow(); //Get the activity window if (window != oldwindow) { //Get the location of the specified window GetWindowRect(window, &rect); x = ; y = ; width = - x; height = - y; oldwindow = window; } MoveWindow(window, x - shake_distance, y, width, height, TRUE); //Move the window, move 10 pixels to the left, the same below Sleep(shake_time); //Sleep time milliseconds, thread sleeps MoveWindow(window, x - shake_distance, y - shake_distance, width, height, TRUE); Sleep(shake_time); MoveWindow(window, x, y - shake_distance, width, height, TRUE); Sleep(shake_time); MoveWindow(window, x, y, width, height, TRUE); Sleep(shake_time); } return 0; }
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.