StretchDIBits problem

Hello.
I use the StretchDIBits function 5 time by second to display a 8 bits
frame (800*640) in graylevel. The function return the right value 640.

My problem appear after around 98000 call of this function

the function called by a thread with ON_MESSAGE & PostMessage

LRESULT CDisplayFrame::RefreshFrame(WPARAM wParam, LPARAM lParam){
m_stretchStatus=StretchDIBits(m_dispArea.GetDC()->m_hDC,\
		0,0,Coord.right - Coord.left,
                 Coord.bottom - Coord.top,\
	       0,0,WIDTH,HEIGHT,currentDisplayFrame,
                MyIH,DIB_RGB_COLORS,SRCCOPY);
return (true);
}

If I put in comment the StretchDIBits call it works as long I need.

Do you any ideas about this problem.

Thanks for your help.
Best regards
JM
0
4/25/2007 8:23:52 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
625 Views

Similar Articles

[PageSpeed] 28

"jean-michel clausse" <jean-michel.clausse@obs-azur.fr> wrote in message
news:f0n36r$8b4$1@news.cma.fr...
> Hello.
> I use the StretchDIBits function 5 time by second to display a 8 bits
> frame (800*640) in graylevel. The function return the right value 640.
>
> My problem appear after around 98000 call of this function
>
> the function called by a thread with ON_MESSAGE & PostMessage
>
> LRESULT CDisplayFrame::RefreshFrame(WPARAM wParam, LPARAM lParam){
> m_stretchStatus=StretchDIBits(m_dispArea.GetDC()->m_hDC,\
> 0,0,Coord.right - Coord.left,
>                  Coord.bottom - Coord.top,\
>        0,0,WIDTH,HEIGHT,currentDisplayFrame,
>                 MyIH,DIB_RGB_COLORS,SRCCOPY);
> return (true);
> }
>
> If I put in comment the StretchDIBits call it works as long I need.
>
> Do you any ideas about this problem.
>
> Thanks for your help.
> Best regards
> JM

What is m_dispArea?  You might need to release the dc obtained after each
call to GetDC()


0
4/25/2007 4:52:43 PM
On Apr 25, 10:23 am, jean-michel clausse <jean-michel.clau...@obs-
azur.fr> wrote:
> Hello.
> I use the StretchDIBits function 5 time by second to display a 8 bits
> frame (800*640) in graylevel. The function return the right value 640.
>
> My problem appear after around 98000 call of this function
>
> the function called by a thread with ON_MESSAGE & PostMessage
>
> LRESULT CDisplayFrame::RefreshFrame(WPARAM wParam, LPARAM lParam){
> m_stretchStatus=StretchDIBits(m_dispArea.GetDC()->m_hDC,\
>                 0,0,Coord.right - Coord.left,
>                  Coord.bottom - Coord.top,\
>                0,0,WIDTH,HEIGHT,currentDisplayFrame,
>                 MyIH,DIB_RGB_COLORS,SRCCOPY);
> return (true);
>
> }
>
> If I put in comment the StretchDIBits call it works as long I need.
>
> Do you any ideas about this problem.
>
> Thanks for your help.
> Best regards
> JM

Maybe because you didn't call ReleaseDC() ???


0
4/26/2007 5:34:06 AM
I have temporarely solve the problem by GetDC only one time at the
initialization. It's probably more clean to RealizeDC, I am going to try 
this way.
Thanks.
JM

xrxst32 wrote:
> On Apr 25, 10:23 am, jean-michel clausse <jean-michel.clau...@obs-
> azur.fr> wrote:
> 
>>Hello.
>>I use the StretchDIBits function 5 time by second to display a 8 bits
>>frame (800*640) in graylevel. The function return the right value 640.
>>
>>My problem appear after around 98000 call of this function
>>
>>the function called by a thread with ON_MESSAGE & PostMessage
>>
>>LRESULT CDisplayFrame::RefreshFrame(WPARAM wParam, LPARAM lParam){
>>m_stretchStatus=StretchDIBits(m_dispArea.GetDC()->m_hDC,\
>>                0,0,Coord.right - Coord.left,
>>                 Coord.bottom - Coord.top,\
>>               0,0,WIDTH,HEIGHT,currentDisplayFrame,
>>                MyIH,DIB_RGB_COLORS,SRCCOPY);
>>return (true);
>>
>>}
>>
>>If I put in comment the StretchDIBits call it works as long I need.
>>
>>Do you any ideas about this problem.
>>
>>Thanks for your help.
>>Best regards
>>JM
> 
> 
> Maybe because you didn't call ReleaseDC() ???
> 
> 
0
4/26/2007 6:49:09 AM
Reply:

Similar Artilces:

Problems with address book
I'm new to using MS outlook. I usually work on *nix servers but this time I am working with Active Directory and facing some problems. I want to see only the people whose account are active in my address book. Currently I see all the people's e-mail addresses when I click on 'To' button. Many of those accounts are disabled, but sitll I see there addresses. Also if I want to send e-mail to everyone, it also sends mails to those people whose accounts are disabled and ultimately creates a lot of confusion. Is there a way that I can see people whose accounts are currently active,...

UNSUBSCRIBE Problems
Dear Group, Hope someone can help, having real problems with the CRM un- subscription functions for marketing list. The email router is set up and running correctly and the following are set in : Organisation Settings \ System Settings \ Marketing Create campaign responses for incoming e-mail: Yes Set "Do Not Send Marketing Material" option when unsubscribe e-mail is received: Yes Send acknowledgement to customers when they unsubscribe: Yes Template for Acknowledgment Email: Set to an appropriate email Have test and when sending the unsubscribe email the "Send Marketing Mat...

Safe Pay Check Amount Problem
I am trying to setup Safe Pay. Everything seems to be working fine except for one annoying quirk. Our bank's Positive Pay data format gives us 12 characters for check amounts ($$$$$$$$$$¢¢). The file that Safe Pay generates is working perfectly except for those checks that are greater than $9,999,999.99 (9 characters). If the check amount is greater than that (say $10,000,000.00), the value that the Safe Pay file shows for that check is 002147483647. And, even if none of the individual checks exceed $9,999,999.99, if the total of the checks in the batch exceeds that a...

Access 2007 - Three Strange Problems
I'm having three very unusual problems with Access 2007: 1. When I exit Access after making changes (forms or VB code) to any database, I get a message that Aceess has encountered a problem and it restarts. When I close it without making any changes, it works correctly. 2. When I enter the VB Code Editor and scroll the active window, the code editor "locks up." I must make some other window or program active and then return to the code editor to get it working again. This will repeat itself often during a coding session. 3. I have the Access options set to "alway...

XSLT problem #2
Hi! I'm new around xml and xslt... I'm trying to write a dataset to a CSV file. I'm doing like this: I'm creating a Stylesheet: writer is a XmlTextWriter. (...) // xsl-template writer.WriteStartElement("xsl:template"); writer.WriteAttributeString("match","/"); // xsl:value-of for headers for(int i=0; i< sHeaders.Length; i++) { writer.WriteStartElement("xsl:value-of"); writer.WriteAttributeString("select", "'" + sHeaders[i] + "'"); writer.WriteEndElement( ); // xsl:value-of if (i != sFileds....

OutLook 2003, Exchange VPN Problem
i'm using outlook 2003 as my client. Our exchange server is 5.5. I can't seem to connect to the server over my VPN connection. I can see the entire network fine, so I know the VPN is working, authenticated and connected Can anyone offer some guidance Thanks. There is a patch that must be applied to Exchange 5.5 in order for it to work with Outlook 2003. Check with your Exchange admin to see if it has been installed. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to m...

Problem with .addnew
I have a form which allows a user to add a new category to table [CPlan Type]. After update I then want to be able to add an additional record of that category to a table called [CPlan Outcome] for each staff member. I'm using the following code (Item holds the # of Staff members with their ID#s in StaffIDArray() Set RS = db.OpenRecordset("Cplan Outcome", dbOpenDynaset) For Numb = 0 To Item With RS .AddNew !StaffID = StaffIDArray(Numb) !Category = NewCategory !Outcome = "" !U...

Problem accessing varaiable declared in App Class
Hi, My app is an MFC Dialog app. I have a variable declared in my app class so that it is available to all classes in program using ((CMyApp*)AfxGetApp())->MyVar; The reason i do that is because i use this variable to give me access to my database and there are a number of places in my program that need to access my database. I am using an OLE DB command accessor to access the database and the variable i declace, gcmdAccessor, is used to open the database and query it. I open my databse in the initdialog method of my main dialog using HRESULT hResult = ((CMyApp*)AfxGetApp())->...

Excel 2003 Autocorrect Options problem
Hi-- I just got a new computer at work with Excel 2003 on it. Whenever I try to choose "Tools/AutoCorrect Options" the Basic File Seach Task Pane opens up instead of the AutoCorrect Options Box. I was curious if anyone else was seeing this behavior. I can get into the AutoCorrect Options Dialog box through Word, but not through Excel. I'm willing to try re-installing XL2003, but don't want to hassle with it, if others are having the same problem. Thanks! Laura :-) No problems here, try to repair it under help>detect and repair (keep the cd handy if asked for) --...

OWA Problem #9
Hello everyone I installed Exchange 2003 and it's working OK, my problem is that the OWA doesn't work and even tought I'm able to log in the interface look like the OMA. I'm connecting to http://server/Exchange Does anybody have an idea why is this happening? Thanks in advance for any help. David With Exchange 2003 when you log in you must supply the login as; Username: domainname\username Password: domainpassword >-----Original Message----- >Hello everyone >I installed Exchange 2003 and it's working OK, my problem is that the OWA >doesn't work and e...

CAnimateCtrl problem
Hello, I'm using CAnimateCtrl and have problem with AVI transparency. I create control like this: m_pPlayer->Create(WS_CHILD | WS_VISIBLE | ACS_TRANSPARENT | ACS_AUTOPLAY | SS_NOTIFY, rcClientParent, this, ID_ANIMATOR); Everything is fine when using system colors (default) in the dialog, but when I change the color with ON_WM_ERASEBKGND AVI background stays as system color. anybody knows why? "Azja" <azja@yahoo.com> wrote in message news:OsIy2VuRGHA.4456@TK2MSFTNGP14.phx.gbl... > Hello, > > I'm using CAnimateCtrl and have problem with AVI tr...

Return Address, Delivery Problems
We have various versions of Outlook that utilize an Exchange 5.5 server as the central data store, as well as the conduit for internal emails. External emails all go in and out directly between Outlook and the Internet through a central gateway. The problem is that on some of the computers, when Email is sent externally (i.e., directly to our ISP, rather than to the Exchange Server), the return address on the email uses the format of the internal Email. This means that if someone "replies" to the Email, it will not get back to us because it uses the wrong email address. As ...

selection problem
Hi, I have an app that contains a ctreectrl on the left side and cformview on the right. I have a "Delete" button on the toolbar. When a user presses the delete button, I want to delete the item, the problem is that I dont know how to figure out which item is the selcted one: is it a ctreeCtrl item or a CFormView item. ... Big problem. Please help, Regards, Janiv Ratson. Hi Janiv: Just have to use CTreeCtrl::GetNextItem() function with TVGN_CARET flag. Have a look to the example of this page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_ctreectr...

Linker Problem
VC++ 2003/XP I've got a solution that contains a .dll project and an application project. The app is dependent upon the .dll, and I have that set in the solution settings. Problem: In Debug version, if I edit the code in the .dll and rebuild, the .exe project does not re-link with the newly built dll .lib file. (It says the project is up to date) The Release version doesn't experience this problem. I'm using the project settings option page to link to the .lib in the app project, as opposed to using a #pragma statement somewhere in the code. Any ideas why a project wouldn&#...

Data validation problem #3
I want to set a length constraint for a text cell between 1-30 characters, the cell cannot be empty. Giving 1 for lower limit in Data validation doesn't prevent the cell to be empty (that is zero length). Giving 2 for lower limit does prevent the cell to be 1 char long. Any idea how can I set a constraint: not empty, min 1 char, max 30 char? Hi not possible with data validation alone. If you really needs to make sure that a cell is not left empty before closing the file you'll need vBA code in the beforesave or beforeclose event "Stefi" wrote: > I want to set a l...

I have the same problem
I have the same problem. Money 2005 is always asking to open file XYZ.surfplace I tried everything I could think of. Set IE to default levels. Uninstall and install again Money 2005. Remove all antivirus software and spyware removal software. I have Win XP SP2 and I used to have Money 2004. I unistall MOney 2004 before installed Money 2005. Could you please post solution, if you find one. Thanks Let Money do it. This is part of Money's navigation. Reference http://money.mvps.org/faq/article/78.aspx -Mark "Matt" <martingula@gmail.com> wrote in message news:970...

Pasting problem
Have a problem in composing Outlook 2002 email messages where the text is appearing on my screen and the recipients with double line spacing. This happens with: (a) cutting and pasting text from some received emails (b) adding some of my own signatures In both cases if I use the delete key at the end of a line of text the extra line eventually disappears when the next line of text joining on. Now if I then hit enter I am back to double spacing. I have to use shift enter on each joined line in turn which is a pain. How can I fix this? Beemer ...

time & SetWindowText() problem
Here is what I am trying to do. I am trying to grab the local system time from the computer (so far I have tried SYSTEMTIME and __TIME__) and display the time in a text box. I know I need to use SetWindowText(), but not sure how to display the time w/o causing the program to crash. Also, the time needs to remain accurate during the program runtime. Any ideas would be greatly appreciated Your problem is not very descriptive. How are you crashing the program! CTime Time = CTime::GetCurrentTime(); CString TimeStr = Time.Format("%......"); m_TimeStatic.SetWindowText(TimeStr); /...

Problem with Dynamics Security Syncronization Utility
I am trying to use the Dynamics Security Syncornization Utility. The specific roles I am trying to syncronize are the GPMBF and the Sharepoint. I have opened the GPMBF2SP predefined ruleset and removed the rules that didn't apply. It seems like all the rules are syncing to the right places but the changes aren't being reflected in the Sharepoint user management. I have configured the utility and it looks like everything is working fine. There are no error messages and all the status columns say "ok" The problem is after I run the utility it says that all the roles...

log on to and owa problem
hi, if I go to user properties of a user in active directory and to account -> log on to I have to specify the server where owa is running on too as a computer where user is allowed to log on. otherwise users cannot access owa. is this by design or am I missing a setting? Not a default setting. Sounds like a Group Policy, you might want to review the current policies applied. Without defining the logon to computer, have a user access OWA by the IP address of the Exchange server (http://192.168.1.1/exchange). "USER 1" wrote: > hi, > > if I go to user properties...

Problems
How do I disable the Money 2002 function that tells me that I have a duplicate entry when I download my transactions from my banking website? It's always wrong and is really irritating. ...

Problem with GetProfileString
I was initially using GetPrivateProfileString. But when i compiled the same application using embedded visual c++. It is giving errors. Now when i went through the documentation it said i can use GetProfileString instead. Now i m not very clear about the parameters it is taking. i.e this function brings value from which ini file. The syntax is as follows. String GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault = NULL ); Parameters lpszSection Profile section name. lpszEntry Profile entry name. lpszDefault Default return value if specified section/entry ...

search problem
Hi, I just entered a new Contact in Outlook 2007 and gave it a 'tag' word in its own Notes field. If I Search using that tag, I get nothing _except_ coincidentally for another Contact that happens to have that word embedded in its last name. I thought Search (from within Contacts) would also look through the infomation in Contact - Notes. Am I mistaken? Thanks, DH State which search method you are using. State why you believe this new Contact would have been indexed by the time you were searching for it. -- Russ Valentine [MVP-Outlook] "Dave Horne" <davehorne@h...

Off-line problem
POS RMS 1.3.0203 setting up an additional lane with off-line database.. Everything works as it should synch when off-line , etc .. however on this lane the tender type of the change returned to a customer is gift certificate and not cash? No matter if I'm online of offline mode? What did I do wrong? Dan This is a multi-part message in MIME format. ------=_NextPart_000_0344_01C6F83E.1DAE2290 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Dan, Manager | File | Configuration | Tender tab | change Default Change = Tender to ...

Challanging Problem
Hello everyone, I have a client who is encountering the following behaviour in their old (Exchange 2000) and upgraded (Exchange 2003 SP2, new server approach and mailboxes moved from old server): Every time exchange is rebooted or the service restarted, users receive emails or email receipts going back to 2-3 months. Note that these emails have already been received before and already show up in the DB as has been read by user at a specific time stamp. Background: - A case was open with PSS with Exchange 2000 with no resolution then put on hold hoping upgrade to 2003 would fix it. ...