Hey, this is my script.
Code:
#SingleInstance,Force
Gui, Add, Edit, w400 h400 vEditWp, This is a test.
Gui, Add, Button,y+5 gCopyText, Copy Text
Gui, +LastFound ; (For the line below)
If A_OsVersion = Win_XP
{
CallWndProcHook := DllCall("SetWindowsHookEx"
,"int",0x4 ; WH_CALLWNDPROC
,"uint",RegisterCallback("CallWndProc")
,"uint",0
,"uint",DllCall("GetCurrentThreadId"))
}
Gui,Show
return
CopyText:
Gui,Submit,Nohide
Clipboard := EditWp
return
CallWndProc(nCode, wParam, lParam)
{
global CallWndProcHook
global AntiCrash
static Duration:=200
static Animating:=false
Critical
msg := NumGet(lParam+8)
if !Animating && (msg = 0x46) ; WM_WINDOWPOSCHANGING
{
hwnd := NumGet(lParam+12)
DetectHiddenWindows, On
WinGet, Style, Style, ahk_id %hwnd%
if (Style & 0x80000000) ; WS_POPUP
{
flags := NumGet(NumGet(lParam+0)+24)
if (flags & 0xC0) ; SWP_SHOWWINDOW | SWP_HIDEWINDOW
{
Animating := true ; Prevent recursion.
DllCall("AnimateWindow", "uint", hwnd, "uint", Duration
, "uint", (flags&0x40) ? 0x80000 : 0x90000)
Animating := false
}
}
}
return DllCall("CallNextHookEx","uint",CallWndProcHook,"int",nCode,"uint",wParam,"uint",lParam)
}
As you can see, all dialogs GUI created are animated to fade in/out.
The problem is, whenever the script uses "Clipboard = x", the script errors.
This is the error I get when I use the "Copy Text" button. The error occurs about 50% of the time.
Code:
---------------------------
ErroredScript.ahk
---------------------------
Error: SetClipboardData
Line#
050: }
---> 051: Return,DllCall("CallNextHookEx","uint",CallWndProcHook,"int",nCode,"uint",wParam,"uint",lParam)
052: }
052: Exit
---------------------------
OK
---------------------------
Anyone have any idea how to fix this?
Ideas/Code/Suggestions/Random Comments/Spam welcome.
Thanks in advance.
ALSO: fading windows part of the script was provided by Lexikos http://www.autohotkey.com/forum/viewtopic.php?t=29900