🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1991

Re: Multi-Thread HDC and Video Display

#1991
From: Jonathan Benedicto
Date: Fri, 25 May 2007 16:00
41 lines
2787 bytes
Robert G. Hoover wrote:
> So in general, 1 thread (my main app) processes event messages and 1 
> thread (my
> own creation) grabs a video frame from the camera into a BITMAP buffer and
> paints it on the screen using SetDIBits or StretchDIBits.

You can't do this though, because those functions aren't thread safe :-) You 
have to use either DirectShow, Direct3D or DrawDib. Or if you wish to have 
the work done for you, you can look at VideoLab by Mitov Software, in 
particular the TVLImageDisplay or TVLDSImageDisplay. http://www.mitov.com


> My problem is hard to diagnose. My symptoms are general slowness of video
> refresh/update, reduced frame rate, OS crashes (blue DOS screen as "auto
> restart" is disabled) with messages like IRQL_LESS_OR_EQUAL or 
> BAD_POOL_HEADER.
>
> A complicating factor to this is that the GUI updates in response to user
> interaction. This is for a robotics app. So, when motors move, their 
> absolute
> positions are displayed immediately thru TLabel::Repaint().

Are you updating the labels from another thread?

> I've surrounded calls to the GUI with try/catch blocks. Is it possible 
> this is related to my
> problem?

Possibly - but I need more info regarding how you update the GUI.


> Perhaps if I configure my entire program to use a single side of the
> processor then it will behave like it does on single-core machines? Can I 
> do that?

Possibly, but if you fix this problem, your app will be much better, plus 
probably faster :-)

HTH

Jon 
Technical Details
Message-ID: <4657083e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.251.MISMATCH!news-out.readnews.com!transit4.readnews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45f57403@newsgroups.borland.com> <4655cb92@newsgroups.borland.com> <4656d0f8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,411b13b57e2ea81a
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Jonathan Benedicto" <invalid@nobody.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <45f57403@newsgroups.borland.com> <4655cb92@newsgroups.borland.com> <4656d0f8@newsgroups.borland.com>
In-Reply-To: <4656d0f8@newsgroups.borland.com>
Subject: Re: Multi-Thread HDC and Video Display
Date: Fri, 25 May 2007 12:00:56 -0400
Lines: 42
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6000.16386
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16386
NNTP-Posting-Host: 74.115.18.89
Message-ID: <4657083e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1180108862 74.115.18.89 (25 May 2007 09:01:02 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.251.MISMATCH!news-out.readnews.com!transit4.readnews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail