when to initial a call of Gdip_Startup()

Get help with using AutoHotkey and its commands and hotkeys
takayo97
Posts: 62
Joined: 09 Jun 2018, 16:30

when to initial a call of Gdip_Startup()

21 Dec 2019, 17:22

when using gdip ahk lib, Gdip_Startup() must to initial first before access to all gdip's function

My script has different function to use gdip's function.
Should i call Gdip_Startup() when ahk script loaded, or
calling this function inside of each of custom fucntion where to use gdip's function ?
Some of custom function will be called by a timer as an interval.
For example, a timer of every one second to check bitmap changing on screen
For the preceding way, if there any overhead of calling and destroying the gdip token repeatedly

Code: Select all


gdipToken := Gdip_Startup()

SetTimer, functionC , 1000

OnExit, ExitSub  

functionA ()
{
  ; some gdip stuff 
}

functionB ()
{
  ; some gdip stuff 
}

functionC ()
{
  ; some gdip stuff 
}

ExitSub:
Gdip_Shutdown(gdipToken)
return

Code: Select all



SetTimer, functionC , 1000

functionA ()
{	gdipToken := Gdip_Startup()
  ; some gdip stuff 
  Gdip_Shutdown(gdipToken)
}

functionB ()
{
gdipToken := Gdip_Startup()
  ; some gdip stuff 
  Gdip_Shutdown(gdipToken)
}

functionC ()
{
gdipToken := Gdip_Startup()
  ; some gdip stuff 
  Gdip_Shutdown(gdipToken)
}


return
swagfag
Posts: 3976
Joined: 11 Jan 2017, 17:59

Re: when to initial a call of Gdip_Startup()

21 Dec 2019, 18:23

if u shutdown the token, u destroy the gdip context along with any gdip primitives it might contain. so if ur functions rely on bitmaps from other contexts for example, u will invalidate them

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], mikeyww and 46 guests