1. The Red Line section should be noted.
#include <stdio.h>#include<stdlib.h>#include<Windows.h>#include<math.h>#definePI 3.1415926#defineR 200voidMain () {intPX1 = -; intPX2 = -; intPY = -;//set to center Point//HWND win = Findwindowa ("Qwidget", "Google Earth");HWND win = Findwindowa ("Notepad","Untitled-Notepad"); Title and class name made out of spy softwareif(Win = =NULL) {printf ("can not find"); } Else { intAngle =0;//Angle intStatus =1; while(1) { if(angle==0) { if (status==1)//1.0 marks a different circle on motion {status = 0; } else {status = 1; } } intx; inty; if(status==0)//Move Clockwise{x= px2 +cos (angle *pi/ the)*s; Y= py +sin (angle *pi/ the)*s; } Else //counter-clockwise movement{x= px1 + cos (angle*pi/ the)*R; Y= Py-sin (angle*pi/ the)*R; } //SetWindowPos (Win, NULL, X, Y, $, 1);//1 does not change sizeMoveWindow (Win, X, Y, -, -,1);//1 RedrawAngle++; if(Angle = = the) {Angle=0; } Sleep (Ten); }} system ("Pause");}
2. SetWindowPos (win, NULL, X, Y,$, 1) and MoveWindow (win, X, Y,+, 1) achieve the same effect.
3.SetWindowPos (win, NULL, X, Y,$, 1), X, y represents coordinates, and 500,500 represents width and height, respectively. The last 1 is not very clear, say is not change the size.
4. MoveWindow (win, X, Y, +, NULL) The last item indicates whether your window is redrawn, in the video card's memory, if set to 1 is a redraw, usually choose 1.
Control a program Go 8 words