Error creating window device context |
|
I decided to test my application on Windows 9x after developing on Win2000. I am now always recieving the error EOutOfResources. However, it only occurs when changing the TCoolbar from vertical to horizontal position. Plus, there is no way that all the handles could be used up (that I know of). I traced the error to this function:
function TCoolBar.GetCaptionFontHeight: Integer;
var
TxtMetric: TTextMetric;
begin
Result := 0;
if HandleAllocated then
with TControlCanvas.Create do
try
Control := Self;
Font := FCaptionFont;
if (GetTextMetrics(Handle, TxtMetric)) then
Result := TxtMetric.tmHeight;
finally
Free;
end;
end;
and the error occurs on the creation of the TCanvas. Does anyone have any idea why I would be getting this error when going from horizontal to vertical? It doesn't seem like anyone else has had this problem...so just wondering...
Matt
|
Re: Error creating window device context |
|
In article <3efa77c7$1@newsgroups.borland.com>, Matt wrote:
> I decided to test my application on Windows 9x after developing on Win2000.
> I am now always recieving the error EOutOfResources. However, it only
> occurs when changing the TCoolbar from vertical to horizontal position.
> Plus, there is no way that all the handles could be used up (that I know of).
The error message is likely not quite correct. You will get that in some cases
if an API call failed unexpectedly, even if it has nothing to do with resources.
> I traced the error to this function:
>
> function TCoolBar.GetCaptionFontHeight: Integer;
> var
> TxtMetric: TTextMetric;
> begin
> Result := 0;
> if HandleAllocated then
> with TControlCanvas.Create do
> try
> Control := Self;
> Font := FCaptionFont;
> if (GetTextMetrics(Handle, TxtMetric)) then
Is Handle <> 0 at this point? I suspect the error is raised in the getter for
the TControlCanvas Handle property, since it fails to get a device context handle
for the coolbar for some reason. What that reason may be is anybodies guess...
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
|
Re: Error creating window device context |
|