Jump to content

_CirculateWindow() UDF


LiquidNitrogen
 Share

Recommended Posts

I Was kind of Stumped on What to Call this. I Actually Converted this from Javascript to AU3. I Used the code that is used to Make images on web pages to move in a circle. Like the So called "Hacks".

; #FUNCTION# ===============================================================
; Function: _WinAPI_CirculateWindow($hWnd)
; Author: ReaperX
; Description: Animates the Current GUI Window Into a Circlular Pattern.
; $hWnd -> Handle to the Current GUI Window
; ==========================================================================
Func _WinAPI_CirculateWindow($hWnd)
GUISetState()
Local $R = 300
Local $x1 = .1
Local $y1 = .05
Local $x2 = 100
Local $y2 = 100
Local $x3 = 10
Local $y3 = 50
Local $x4 = 180
Local $y4 = 200
Local $x5 = 300
Local $y5 = 100
For $i = 0 To 14
  Local $XPos = Sin($R * $x1 + $i * $x2 + $x3) * $x4 + $x5
  Local $YPos = Cos($R * $y1 + $i * $y2 + $y3) * $y4 + $y5
  WinMove(WinGetTitle($hWnd), "", $XPos, $YPos)
  sleep(20)
Next
Return
EndFunc   ;==>_WinAPI_CirculateWindow

Javascript Code:

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200;
DI=document.images; DIL=DI.length;
function A()
{for(i=0; i-DIL; i++)
{DIS=DI[ i ].style;
DIS.position='absolute';
DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;
DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++ }setInterval('A()',5);
void(0);
Edited by ReaperX

Formerly ReaperX

Link to comment
Share on other sites

I Was kind of Stumped on What to Call this.

I personally wouldn't call it _WinAPI_CirculateWindow because the _WinAPI suffix is used for when the function calls the Windows API (via a dll call,) in this case it's implying you're using the API function CirculateWindow, which of course you're not as you're using native functions to do so. I would personally just drop the _WinAPI_ part and leave it at that. Thanks for sharing by the way. Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

But doesn't winmove() use the movewindow api?

Anyway, now he can call it _WinAPI_CirculateWindow().

_WinAPI_CirculateWindow("Resource Hacker", 50)

Func _WinAPI_CirculateWindow($hWnd, $Sleep)
If Not IsHWnd($hWnd) Then
$hWnd = WinGetHandle($hWnd)
If @error Then Return SetError(1, 0, 0)
EndIf
$Pos = WinGetPos($hWnd)
If @error Then Return SetError(2, 0, 0)
For $i = 0 To 25 Step 1 / 4
Local $XPos = Sin(350 * .1 + $i * 100 + 10) * 100 + $Pos[0]
Local $YPos = Cos(350 * .05 + $i * 100 + 50) * 100 + $Pos[1]
$Ret = DllCall("user32.dll", "int", "MoveWindow", _
"hwnd", $hWnd, _
"int", $XPos, _
"int", $YPos, _
"int", $Pos[2], _
"int", $Pos[3], _
"int", 1)
If Not $Ret[0] Then Return SetError(3,0,0)
Sleep($Sleep)
Next
Return SetError(0, 0, 1)
EndFunc   ;==>_WinAPI_CirculateWindow
Edited by THAT1ANONYMOUSEDUDE
Link to comment
Share on other sites

@THAT1ANONYMOUSEDUDE, I re-worded my post as I don't think you understood my point.

Now back on topic.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hello ReaperX,

Thank you for sharing your UDF.

Could you supply a working example? The code above doesn't do anything that I can see.

I think most people would like to see what a UDF does before spending the time to play with the code.

Thanks again,

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

Here is an easy examle:

; #FUNCTION# ===============================================================
; Function: _WinAPI_CirculateWindow($hWnd)
; Author: ReaperX
; Description: Animates the Current GUI Window Into a Circlular Pattern.
; $hWnd -> Handle to the Current GUI Window
; ==========================================================================
Func _WinAPI_CirculateWindow($hWnd)
    GUISetState()
    Local $R = 300
    Local $x1 = .1
    Local $y1 = .05
    Local $x2 = 100
    Local $y2 = 100
    Local $x3 = 10
    Local $y3 = 50
    Local $x4 = 180
    Local $y4 = 200
    Local $x5 = 300
    Local $y5 = 100
    For $i = 0 To 14
        Local $XPos = Sin($R * $x1 + $i * $x2 + $x3) * $x4 + $x5
        Local $YPos = Cos($R * $y1 + $i * $y2 + $y3) * $y4 + $y5
        WinMove(WinGetTitle($hWnd), "", $XPos, $YPos)
        Sleep(20)
    Next
    Return
EndFunc   ;==>_WinAPI_CirculateWindow



_WinAPI_CirculateWindow(GUICreate("Test", 500, 500))

Do
Until GUIGetMsg() = -3

@taurus905: I'm sure most people could do this by their own.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Hello funkey,

Thank you for that quick and easy example.

I agree. Most people could read the UDF and create their own example. But since this is the "Example" forum, I think it makes good sense to provide a working example, especially for new users. I encourages people to investigate the code when they see it do something cool.

Thanks again,

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...