Sign in to follow this  
Followers 0

Hard crash of Autoit - _ClipBoard_GetData

18 posts in this topic

Posted

Hi,

starting this example _ClipBoard_GetData and then pressing

1. Set ClipBoard Data

2. Get ClipBoard Data

leads to AutoIT3.exe ended.rc:-1073741819

(3.2.10.0, XP 2)

So long,

Mega

Share this post


Link to post
Share on other sites



Posted

Hi,

starting this example _ClipBoard_GetData and then pressing

1. Set ClipBoard Data

2. Get ClipBoard Data

leads to AutoIT3.exe ended.rc:-1073741819

(3.2.10.0, XP 2)

So long,

Mega

Doesn't crash on my system.

3.2.10.0 XP Pro SP2

Share this post


Link to post
Share on other sites

Posted

Hi,

wenn I do this:

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 600, 450)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
    GUISetState()
    ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_SetData
                ;_ClipBoard_SetData("ClipBoard Library")
                ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
            Case $btn_GetData
                MemoWrite(_ClipBoard_GetData())
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

and then press the GET Button or get,set,get,set,get,set then Autoit crashes for me.

So long,

Mega

Share this post


Link to post
Share on other sites

Posted

It works for me, maybe you have a memory leak (Or something like that). I had one with MicroOS, which still never was fixed. :)

Share this post


Link to post
Share on other sites

Posted

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
	Local $hGUI, $btn_SetData, $btn_GetData

	; Create GUI
	$hGUI = GUICreate("Clipboard", 600, 450)
	$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
	GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
	$btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
	$btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
	GUISetState()
	ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
	; Loop until user exits
	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				ExitLoop
			Case $btn_SetData
				;_ClipBoard_SetData("ClipBoard Library")
				ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
			Case $btn_GetData
				If _ClipBoard_Open($hGUI) Then
					If _ClipBoard_CountFormats() Then
						MemoWrite("Formats: " & _ClipBoard_CountFormats())
						MemoWrite(_ClipBoard_GetData())
					EndIf
					_ClipBoard_Close()
				EndIf
		EndSwitch
	WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
	GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Share this post


Link to post
Share on other sites

Posted

Hi,

I don't think so. I crahses for somebody else too. I doesn't always crash the first time. But after playing around a bit with copy & paste and empty CB it crashes.

So long,

Mega

Share this post


Link to post
Share on other sites

Posted (edited)

Hi,

this one should make it reproducable for you:

#include <GuiConstantsEx.au3>
 #include <ClipBoard.au3>
 
 Opt('MustDeclareVars', 1)
 
 Global $iMemo
 
 _Main()
 
 Func _Main()
     Local $hGUI, $btn_SetData, $btn_GetData
 
    ; Create GUI
     $hGUI = GUICreate("Clipboard", 600, 450)
     $iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
     GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
     $btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
     $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
     GUISetState()
     If Not _ClipBoard_Open($hGUI) Then _WinAPI_ShowError("_ClipBoard_Open failed")
     ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
     _ClipBoard_Close()
    ; Loop until user exits
     While 1
         Switch GUIGetMsg()
             Case $GUI_EVENT_CLOSE
                 ExitLoop
             Case $btn_SetData
                ;_ClipBoard_SetData("ClipBoard Library")
                 ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
             Case $btn_GetData
                 MemoWrite(_ClipBoard_GetData())
         EndSwitch
     WEnd
 EndFunc  ;==>_Main
 
 ; Write message to memo
 Func MemoWrite($sMessage = "")
     GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
 EndFunc  ;==>MemoWrite

Run the script press getButton an 0 appears copy it with CTRL+C and then press the getButton a few times.

EDIT: I give up! I cannot get to be reproduceable. :) Sorry!

So long,

Mega

Edited by Xenobiologist

Share this post


Link to post
Share on other sites

Posted (edited)

Hi,

wenn I do this:

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $btn_SetData, $btn_GetData

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 600, 450)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
    $btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
    GUISetState()
    ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
    ; Loop until user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_SetData
                ;_ClipBoard_SetData("ClipBoard Library")
                ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
            Case $btn_GetData
                MemoWrite(_ClipBoard_GetData())
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

and then press the GET Button or get,set,get,set,get,set then Autoit crashes for me.

So long,

Mega

Hi,

I have tested it too and windows crashes too.

I think this is a bug.

Please help us

Thanks

Edited by Tweaky

Share this post


Link to post
Share on other sites

Posted

Hi,

I have tested it too and windows crashes too.

I think this is a bug.

Please help us

Thanks

If windows crashes you have bigger problem then the script might have.

Share this post


Link to post
Share on other sites

Posted

Hi,

I guess he meant that Autoit crashes. It crashes with the typical memory error message. Autoit tries to read a memory address and this fails.

So long,

Mega

Share this post


Link to post
Share on other sites

Posted

Hi,

this one should make it reproducable for you:

Run the script press getButton an 0 appears copy it with CTRL+C and then press the getButton a few times.

EDIT: I give up! I cannot get to be reproduceable. :) Sorry!

So long,

Mega

Not a Bug, incorrect use of the _ClipBoardEmpty

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
	Local $hGUI, $btn_SetData, $btn_GetData

	; Create GUI
	$hGUI = GUICreate("Clipboard", 600, 450)
	$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
	GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
	$btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
	$btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
	GUISetState()
	ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
	; Loop until user exits
	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				ExitLoop
			Case $btn_SetData
				;_ClipBoard_SetData("ClipBoard Library")
				If _ClipBoard_Open($hGUI) Then
					ConsoleWrite("CB_EMPTY: " & _ClipBoard_Empty() & @CRLF)
					_ClipBoard_Close()
				EndIf
			Case $btn_GetData
				MemoWrite(_ClipBoard_GetData())
		EndSwitch
	WEnd

EndFunc   ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
	GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

From the remarks of _ClipBoard_Empty

Before calling this function, you must open the clipboard by using the _ClipBoard_Open function.

Share this post


Link to post
Share on other sites

Posted

Hi,

yes okay.

But should Autoit crash?

I don't think so.

But maybe it is very difficult to avoid crashing because there was added so much WINAPI stuff .

So long,

Mega

Share this post


Link to post
Share on other sites

Posted

Hi,

yes okay.

But should Autoit crash?

I don't think so.

But maybe it is very difficult to avoid crashing because there was added so much WINAPI stuff .

So long,

Mega

We can't prevent crashes when DllCall() is used incorrectly. That's the price you pay for using a "lower-level" function.

Share this post


Link to post
Share on other sites

Posted

We can't prevent crashes when DllCall() is used incorrectly. That's the price you pay for using a "lower-level" function.

Hi,

okay, I already thought that. But I also thought that using the Autoit funcs which handle the DLLCalls (WinApi) is a layer between me and the DLLCall. So, it can be protected.

But I guess it would be very hard to think about all the possibilities. ^_^

So, thanks for clarification. :)

So long,

Mega

Share this post


Link to post
Share on other sites

Posted

I have tested this script on Vista and XP SP2, and got crashes. So currently it is not safe to read from clipboard for the script.

I guess this should be handled by AutoIt3' in source core.

Share this post


Link to post
Share on other sites

Posted

I have tested this script on Vista and XP SP2, and got crashes. So currently it is not safe to read from clipboard for the script.

I guess this should be handled by AutoIt3' in source core.

Hi,

the answer was. Only using the API stuff wrong leads to errors.

So long,

Mega

Share this post


Link to post
Share on other sites

Posted

Simple

_ClipBoard_GetData($CF_TEXT)

crashed for me also. And on two different computer also.

Not always on first occasion, but it does crash.

XP2 and 3210.

Silent error code is "AutoIT3.exe ended.rc:-1073741819"

Share this post


Link to post
Share on other sites

Posted

Simple

_ClipBoard_GetData($CF_TEXT)

crashed for me also. And on two different computer also.

Not always on first occasion, but it does crash.

XP2 and 3210.

Silent error code is "AutoIT3.exe ended.rc:-1073741819"

The crystal ball tells me you are using it incorrectly also. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0