Jump to content

Paypal Bağış Butonu


legolaas
 Share

Recommended Posts

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
$Main = GUICreate('GUI', 200, 100)

 $hDownload1 = InetGet('https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',@ScriptDir&'/paypal.gif')
$Button = GUICtrlCreatePic('', 10, 35, 100,51)
GUICtrlSetCursor(-1,0)
iconbutton_1($Button)
GUISetState()

    Do
        $msg = GUIGetMsg()
        $hov=GUIGetCursorInfo()
        if $hov[2]=1 and $hov[4]=$Button Then ShellExecute("http://google.com",1)
        sleep(50)
    Until $msg = $GUI_EVENT_CLOSE

    Func iconbutton_1($control)

        _GDIPlus_Startup()
        $hwd = GUICtrlGetHandle($control)
        $width = _WinAPI_GetClientWidth($hwd)
        $height = _WinAPI_GetClientHeight($hwd)
        $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwd)
        $hBitmap1 = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
        $hBitmap1 = _ImageDrawicon($hBitmap1,@ScriptDir&'/paypal.gif',100,51)
        $hBMP1 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1)
        _WinAPI_DeleteObject(GUICtrlSendMsg($control, 0x0172, 0, $hBMP1))

        _WinAPI_DeleteObject($hBMP1)
        _GDIPlus_BitmapDispose($hBitmap1)
        _GDIPlus_GraphicsDispose($hGraphic)
        _GDIPlus_Shutdown()

    EndFunc

    Func _ImageDrawicon($hImage, $picture, $iW, $iH, $iX = 0, $iY = 0)
    $hGraphic1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic1)
    $hGraphic2 = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsDrawImageRect($hGraphic2, $hImage, 0, 0, $iW, $iH)
    Global $icon = _GDIPlus_ImageLoadFromFile($picture)
    _GDIPlus_GraphicsDrawImageRect($hGraphic2, $icon, $iX, $iY, $iW, $iH)
    _GDIPlus_GraphicsDispose ($hGraphic2)
    _GDIPlus_GraphicsDispose ($hGraphic1)
    Return $hBitmap
EndFunc

Shellexecute kısmında sıkıntı var hata veriyor. Yardımınızı bekliyorum.

Link to comment
Share on other sites

Kod bende sorunsuz çalışıyor. Sizin verdiğiniz hata ekranında ise hatanın ShelExecute kısmında değil de $hov kısmında yani GUIGetCursorInfo fonksiyonunda hata olduğuna işaret ediyor. Bir sebepten ötürü konum bilgisini veya tıklama bilgisini alamıyor olabilir. Bunun yerine başka bir yöntemle kodu aşağıdaki gibi düzelttim. GUI düzenlemelerinizi aşağıdaki yöntemle de yapabilirsiniz. Yapmaya çalıştığınız şeyin tam olarak aynısını yapmakta. Sorun olursa tekrar bildirin, ilgilenelim.

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

$Main = GUICreate('GUI', 200, 100)

$hDownload1 = InetGet('https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',@ScriptDir&'/paypal.gif')
$Button = GUICtrlCreatePic('', 10, 35, 100,51)
GUICtrlSetCursor(-1,0)
iconbutton_1($Button)
GUISetState()

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			exit
		case $Button
			ShellExecute("www.google.com")
	EndSwitch
WEnd


Func iconbutton_1($control)
	_GDIPlus_Startup()
	$hwd = GUICtrlGetHandle($control)
	$width = _WinAPI_GetClientWidth($hwd)
	$height = _WinAPI_GetClientHeight($hwd)
	$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwd)
	$hBitmap1 = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
	$hBitmap1 = _ImageDrawicon($hBitmap1,@ScriptDir&'/paypal.gif',100,51)
	$hBMP1 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1)
	_WinAPI_DeleteObject(GUICtrlSendMsg($control, 0x0172, 0, $hBMP1))

	_WinAPI_DeleteObject($hBMP1)
	_GDIPlus_BitmapDispose($hBitmap1)
	_GDIPlus_GraphicsDispose($hGraphic)
	_GDIPlus_Shutdown()
EndFunc

Func _ImageDrawicon($hImage, $picture, $iW, $iH, $iX = 0, $iY = 0)
	$hGraphic1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
	$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic1)
	$hGraphic2 = _GDIPlus_ImageGetGraphicsContext($hBitmap)
	_GDIPlus_GraphicsDrawImageRect($hGraphic2, $hImage, 0, 0, $iW, $iH)
	Global $icon = _GDIPlus_ImageLoadFromFile($picture)
	_GDIPlus_GraphicsDrawImageRect($hGraphic2, $icon, $iX, $iY, $iW, $iH)
	_GDIPlus_GraphicsDispose ($hGraphic2)
	_GDIPlus_GraphicsDispose ($hGraphic1)
	Return $hBitmap
EndFunc
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...