ok100fen 发表于 2009-4-3 00:37:55

【求助】老马,你遇到过这样的问题吗?

<p>我用vb写了个小软件,开始能正常运行,但运行30分钟左右,就出现了</p>
<p><strong><span id="topicsubject" chaojimenid="topic_subject">vb 运行时错误 '-2147024882 (8007000e)'</span></strong></p>
<p>这样的错误,说是内存溢出,不知道怎么解决?</p>
<p>我用到的api有:</p>
<p>&nbsp;</p>
<p><font face="Verdana">Private Declare Function GetCursorPos Lib "User32" (lpPoint As POINTAPI) As Long<br/>Private Declare Function GetDC Lib "User32" (ByVal hwnd As Long) As Long<br/>Private Declare Function ReleaseDC Lib "User32" (ByVal hwnd As Long, ByVal hdc As Long) As Long<br/>Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long<br/>Private Declare Function SetCursorPos Lib "User32" (ByVal x As Long, ByVal y As Long) As Long<br/>Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)<br/>Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long<br/>Private Declare Function SetCapture Lib "User32" (ByVal hwnd As Long) As Long<br/>Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long<br/>Private Declare Sub mouse_event Lib "User32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)<br/>Private Const MOUSEEVENTF_LEFTDOWN = &amp;H2 '&nbsp; left button down<br/>Private Const MOUSEEVENTF_LEFTUP = &amp;H4 '&nbsp; left button up<br/>Private Declare Function GetWindowDC Lib "User32" (ByVal hwnd As Long) As Long<br/>Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long<br/>Private Declare Function SetWindowPos Lib "User32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long<br/>Private Declare Function GetLastInputInfo Lib "User32" (plii As LASTINPUTINFO) As Boolean<br/>Private Declare Function GetTickCount Lib "kernel32" () As Long</font></p>

ok100fen 发表于 2009-4-3 00:38:24

不知道哪个需要释放?

马大哈 发表于 2009-3-4 15:28:28

GetDC后用完了你ReleaseDC没?

ok100fen 发表于 2009-4-5 01:06:58

<p>ReleaseDC 0 hdc了</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

马大哈 发表于 2009-4-6 11:03:01

<p>除了DC,还有没有其它资源用过了没注意释放的?</p>
<p>&nbsp;</p>
<p>比如对象,内存等</p>
页: [1]
查看完整版本: 【求助】老马,你遇到过这样的问题吗?