Jump to content
Sign in to follow this  
TheRauchster101

HTML Linked button addition

Recommended Posts

TheRauchster101

I've been using the Koda Form designer for a while now to create my own GUI, and it's working pretty good.

But something I can't seem to find is a HTML link functionality. What I'd like to do is include a PayPal donate button in the GUI, but I'm not sure how to go about doing this.

Anyone have a starting point?

Share this post


Link to post
Share on other sites
picea892

ShellExecute("www.google.com")

ShellExecute("C:\applications\opera10\opera.exe","www.google.com")
Edited by picea892

Share this post


Link to post
Share on other sites
TheRauchster101

Thanks for the attempted help, but I already have a "button" linked to the website.

Perhaps I should have explained more clearly.

I'd like to have this image Posted Image in the bottom of the GUI, AND have it linked to the donation page for my email address through Paypal.

I already know how to get the picture in there, and actually have it in position already. I just have no clue how to hyperlink it to a specific address, as I can't seem to make it clickable.

Share this post


Link to post
Share on other sites
shanet

Can you not set the image to a variable and handle it the same way as a button?


[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

Share this post


Link to post
Share on other sites
TheRauchster101

Can you not set the image to a variable and handle it the same way as a button?

Duh, I hadn't even thought of that. Let me give it a quick try.

Share this post


Link to post
Share on other sites
picea892

Better explanations will generate better help...Perhaps this is the code you need.

#include <GUIConstantsEx.au3>

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

 $hDownload1 = InetGet('https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',@ScriptDir&'/paypal.gif')
$Button = GUICtrlCreatePic(@ScriptDir&'/paypal.gif', 10, 35, 74,21)
GUISetState()
    Do
        $msg = GUIGetMsg()
        $hov=GUIGetCursorInfo()
        if $hov[2]=1 and $hov[4]=$Button then MsgBox(0, "","Button Pressed")
        sleep(50)
    Until $msg = $GUI_EVENT_CLOSE
Edited by picea892

Share this post


Link to post
Share on other sites
TheRauchster101

Better explanations will generate better help...Perhaps this is the code you need.

#include <GUIConstantsEx.au3>

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

 $hDownload1 = InetGet('https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',@ScriptDir&'/paypal.gif')
$Button = GUICtrlCreatePic(@ScriptDir&'/paypal.gif', 10, 35, 74,21)
GUISetState()
    Do
        $msg = GUIGetMsg()
        $hov=GUIGetCursorInfo()
        if $hov[2]=1 and $hov[4]=$Button then MsgBox(0, "","Button Pressed")
        sleep(50)
    Until $msg = $GUI_EVENT_CLOSE

Alright that might be what I'm looking for... What I currently have going is along the lines of:

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GuiComboBoxEx.au3>
#include <IE.au3>
FileInstall("donate.gif", "donate.gif")

$Form1 = GUICreate("Prog Name", 400, 470, 200, 125)
$Button3 = GUICtrlCreateButton("Donate", 170, 434, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Pic = GUICtrlCreatePic("donate.gif", 170, 434, 65, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button3
            _IECreate ("https://www.paypal.com", 1, 1, 0)
    EndSwitch
WEnd

I've obviously taken out large chunk of the code that weren't relevant (the entire GUI is 700 lines)

But this should be the most relevant parts.

What happens currently is "kinda" acceptable. The picture appears at first, and then when you hover over it, it turns into the button which then leads to Paypal when clicked.

-------EDIT-------

Got it working. Though now it has weird red edging around the picture. I can live with that though, unless you know of a way to fix it, of course.

Thank you very much picea892. Please let me know if there is any way to +1 Rep or officially thank you through these forums.

Edited by TheRauchster101

Share this post


Link to post
Share on other sites
picea892

More complicated but removes the red....alternatively you can use Yashied "icons" UDF

No way to +1 me etc....a thank you is all that's needed..Cheers.

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

 $hDownload1 = InetGet('https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',@ScriptDir&'/paypal.gif')
$Button = GUICtrlCreatePic('', 10, 35, 74,21)
GUICtrlSetCursor(-1,0)
iconbutton_1($Button)
GUISetState()
    Do
        $msg = GUIGetMsg()
        $hov=GUIGetCursorInfo()
        if $hov[2]=1 and $hov[4]=$Button then MsgBox(0, "","Button Pressed")
        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',74,21)
        $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
Edited by picea892

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×