|
-
Dec 4th, 2005, 06:21 PM
#1
Thread Starter
Lively Member
out of memory
hello, I am having problems with the releaseDC function in my application.
According to microsoft:
Remarks
The application must call the ReleaseDC function for each call to the GetWindowDC function and for each call to the GetDC function that retrieves a common DC.
and in each sub I use it as follows:
VB Code:
public sub whatever()
Dim hWndDesk As Long
Dim hDCDesk As Long
hWndDesk = GetDesktopWindow()
hDCDesk = GetWindowDC(hWndDesk)
' do whatever in the sub
'right before the sub ends i release the DC that i got at the beginning of it
Call ReleaseDC(hWndDesk, hDCDesk)
end sub
But that doesnt seem to work, i still get a memory leak. In the sub of the app. that im having my issue in, the only thing i do using the DC is use the getpixel function. So, does that mean everytime i use the getpixel function i should use the releasedc function after it? Thanks
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
-
Dec 4th, 2005, 07:46 PM
#2
Thread Starter
Lively Member
Re: out of memory
anyone here familiar with releaseDC?
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
-
Dec 5th, 2005, 05:07 PM
#3
Thread Starter
Lively Member
Re: out of memory
any ideas what i could be doing wrong here?
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
-
Dec 5th, 2005, 05:23 PM
#4
Lively Member
Re: out of memory
are u test that the leak is in this part ao the code only ?
Did u tray DeleteDC ?
-
Dec 6th, 2005, 12:24 AM
#5
Lively Member
Re: out of memory
Hi,
Try using GetDc instead of GetwindowDc.
VB Code:
Dim hWndDesk As Long, hDCDesk As Long
Dim r As Long
'Get the handle of the desktop window
hWndDesk = GetDesktopWindow()
'Get the desktop window's device context
hDCDesk = GetDC(hWndDesk)
'Release the device context
r = ReleaseDC(hWndDesk, hDCDesk)
Thanks
Sanjivani
-
Dec 8th, 2005, 05:31 PM
#6
Thread Starter
Lively Member
Re: out of memory
Imosha, its not in any other part, because im not using a device context in any other procedure. Is there any way i could trap a memory leak error?
Sanjivani, The getpixel function returns a negitive value using GetDC and not GetWindowDC... I have no idea why.
Thanks guys,
--- Science does not explain why things are what they are. What we get from Science is our interpretation of how things do what they do.
--- No Scientific law of the universe is stable, we did not create it, and we will never understand all of its abilities.
--- What we determine as reality is a mere assumption of what tomorrow will be based on what yesterday was.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|