 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Conquer
Joined: 27 Jun 2006 Posts: 385 Location: Canada
|
Posted: Sun Apr 06, 2008 2:49 pm Post subject: [Solved] Animated GUI Windows Causing Clipboard Set Error |
|
|
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 _________________

Last edited by Conquer on Tue Apr 08, 2008 8:23 pm; edited 1 time in total |
|
| Back to top |
|
 |
NLI-Conquer Guest
|
Posted: Mon Apr 07, 2008 12:47 am Post subject: |
|
|
bump.  |
|
| Back to top |
|
 |
NLI-Conquer Guest
|
Posted: Tue Apr 08, 2008 12:55 am Post subject: |
|
|
| Bump x2. :/ |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Apr 08, 2008 6:17 am Post subject: |
|
|
Add
| Code: | DllCall("OpenClipboard", uint, 0)
DllCall("EmptyClipboard")
DllCall("CloseClipboard") | before | Code: | | Clipboard := EditWp |
|
|
| Back to top |
|
 |
Guest
|
Posted: Tue Apr 08, 2008 8:19 pm Post subject: |
|
|
Thx, mister mysterious guest!  |
|
| Back to top |
|
 |
NLI-Conquer Guest
|
Posted: Tue Apr 08, 2008 8:19 pm Post subject: |
|
|
Solved, btw.  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|