AutoHotkey Community

It is currently May 26th, 2012, 5:28 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: April 6th, 2008, 3:49 pm 
Offline

Joined: June 27th, 2006, 2:38 pm
Posts: 385
Location: Canada
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.

:wink:
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 April 8th, 2008, 9:23 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2008, 1:47 am 
bump. :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2008, 1:55 am 
Bump x2. :/


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2008, 7:17 am 
Add
Code:
DllCall("OpenClipboard", uint, 0)
DllCall("EmptyClipboard")
DllCall("CloseClipboard")
before
Code:
Clipboard := EditWp


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2008, 9:19 pm 
Thx, mister mysterious guest! :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2008, 9:19 pm 
Solved, btw. :D


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, Google [Bot], mrhobbeys, poserpro, rbrtryn and 63 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group