Jump to content

Could I perhaps get a sample code of an image with link?


 Share

Recommended Posts

as in places an image, GuiCtrlCreatePic, but also apply a clickable link to that pic, er web link to open into a browser?

Thanks you. :whistle:

#include <guiconstants.au3>


$main = GUICreate("picture link")
$but = GUICtrlCreateButton("exit",20,20,120,20)
$pic = GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",40,90,0,0)

GUISetState()


While 1
    
    $msg =      GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE or $msg = $but Then ExitLoop
    
    If $msg = $GUI_EVENT_PRIMARYDOWN Then
     If HWNDUnderMouse() = GUICtrlGetHandle($pic) Then ShellExecute("http:\\www.autoitscript.com")
    EndIf
    

WEnd


Func HWNDUnderMouse()
    ;by Larry
    Local $point, $hwnd

    $point = MouseGetPos()
    If @error Then Return SetError(1,0,0)

    $hwnd = DLLCall("user32.dll", "hwnd", "WindowFromPoint", "int", $point[0], "int", $point[1])
    If Not @error Or $hwnd[0] <> 0 Then Return $hwnd[0]

    Return SetError(2,0,0)
EndFunc

EDIT: This is silly - see my later post with thanks to smashly for pointing it out.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thank you martin ,

:whistle: that's quite .. erm quite extravagant .. :lmao:

Is there something a bit simpler and shorter to get the same end result ?..

Cheers

;) Oh thanks smashly, I converted a previous post and forget to engage my brain :">

This is a bit more sensible

#include <guiconstants.au3>


$main = GUICreate("picture link")
$but = GUICtrlCreateButton("exit",20,20,120,20)
$pic = GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",40,90,0,0)

GUISetState()


While 1
    
    $msg = GUIGetMsg()
    If $msg = $but Or $msg = $GUI_EVENT_CLOSE Then ExitLoop

    If $msg= $pic Then ShellExecute("http:\\www.autoitscript.com")
    

WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I don't think the first example was silly at all, I thought it was quite clever actually (in a round about kind of way) :lmao:

Thank you for the shorter version as the first version actually made me think .. ouch for my brain :whistle:

Cheers

Edited by smashly
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...