 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ifckladyluck
Joined: 20 Jan 2009 Posts: 16
|
Posted: Wed Jan 21, 2009 8:24 am Post subject: getDC |
|
|
| when using a dllcall to getDC, do you have to release/kill the DC after you are done with it ? |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1045
|
Posted: Wed Jan 21, 2009 9:22 am Post subject: |
|
|
Depends.
| GetDC docs wrote: | | After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do not have to be released. ReleaseDC must be called from the same thread that called GetDC. The number of DCs is limited only by available memory. |
_________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
ifckladyluck
Joined: 20 Jan 2009 Posts: 16
|
Posted: Wed Jan 21, 2009 9:37 am Post subject: |
|
|
im not sure what that means
this is the code I am using, my concern is that since its an infinite loop it will eventually start hogging up too much memory if I dont release it and have to.
loop
{
winget, tableid, id, blah
hDC := dllcall("GetDC", "Uint", id)
pixel := dllcall("GetPixel", "Uint", 30, "Uint", 30)
tooltip pixel
} |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1045
|
Posted: Wed Jan 21, 2009 9:55 am Post subject: |
|
|
1) That loop NEVER exits.... how come...
2) The handle for the DC shouldn't change. I'm not knowlegable about DC, but I know other handle values don't, so I presume this is the case here. So, you should only have to call getDC once, before the loop.
3) You will need to call ReleaseDC before the code exits. You can do this by using OnExit and putting the function call in the subroutine.
4) All getDC does is return a handle, it doesn't create anything - there is no memory allocated, thus it can't become a memory hog.
Also, why don't you use PixelGetColor instead?? _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|