Using C language to realize window jitter

Source: Internet
Author: User

#include"stdafx.h"#include<stdio.h>#include<Windows.h>intMain () {intShake_time = -;//sleep time, 5 milliseconds    intShake_distance =Ten;//10 pixels moved.Rect rect;//A rect is a rectangular structure, equivalent to a four-edge coordinate that holds a rectangle .HWND window = null, Oldwindow = NULL;//Two window handles    intx, y, width, height;//variable to hold the window's horizontal and width and height    inti; //Shake It 50 times.     for(i =0; I <Ten; i++) {window= GetForegroundWindow ();//get the active window        if(Window! =Oldwindow) {            //gets the location of the specified windowGetWindowRect (window, &rect); X=Rect.left; Y=Rect.top; Width= Rect.right-x; Height= Rect.bottom-y; Oldwindow=window; } movewindow (window, x-Shake_distance, y, width, height, TRUE);//move the window, move the 10 pixels to the left,Sleep (Shake_time);//sleep time milliseconds, thread hibernationMoveWindow (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;}

Using C language to realize window jitter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.