when to initial a call of Gdip_Startup()

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
takayo97
Posts: 63
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: 6222
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
Albireo
Posts: 1774
Joined: 16 Oct 2013, 13:53

Re: when to initial a call of Gdip_Startup()

29 Oct 2020, 04:57

Thank you!
I found my problem. (it was not with gdip_all.ahk and Gdip_Startup())
It was that objects are not local in a function() -- Add one array to another array
I lost my initial values ​​when these were changed in the function().

Therefore, the function() worked the first time (page 1), but not the next (page 2)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arrondark, Bing [Bot], CoffeeChaton and 150 guests