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
823 Views

Similar Articles

[PageSpeed] 48

"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 minimizing Outlook 2003 on Windows 7
I have a problem when I minimize Outlook 2003 on Windows 7. When I do this, the Outlook 2003 application "disappears". It does not show up in the SysTray like other apps. It appears to be closeed (terminated) when I minimize it. I'm only using the Calendar portion of Outlook 2003. I haven't set up the email server connections in it when this happens. I only want to use the Calendar/ToDo portions of Outlook 2003, not the email client application. Any suggestions? thanks, Gavin Bowlby Gavin When Outlook is open you will need to resize the window for it...

Access 2003 and SQL2000 Table Problems
I'm using Access 2003 as my client for updating tables in a database install on a SQL 2000 Server. All of the tables have the same user permissions and were created by the same user. Here is the rub. The SQL 2000 server/Access 2003 combination allows editing and insertion of records in some of the tables but not in others. Where do I start? I'm just trying to use ACCESS 2003 to open the table and edit, delete and insert new records for all tables in the database. Thanks I'd first contact the administrator and check to see if there are permissions granted on all tables....

Excel 2003
Thanks Gord for the reply. I understand your suggestions as to what to do when the file has bee finally extracted, however, I want to avoid this issue prior to th import. Something must have changed in Excel's 2003 Import Wizard make up fo this to start happening. Thanks again. Paul -- LEXCER ----------------------------------------------------------------------- LEXCERM's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1521 View this thread: http://www.excelforum.com/showthread.php?threadid=26851 ...

XmlSerializer, problem mixing attributes and element values
Hi, I have a desired xml output that looks like this <?xml version="1.0" encoding="UTF-8"?><onhand_request><item organization_id="414">1</item><item organization_id="414">7321</item></onhand_request I can get to this point with attributes <?xml version="1.0" encoding="utf-8"?><onhand_request><item organization_id="414" on_hand="0"><item>1</item></item><item organization_id="414" on_hand="0"><item>7321</i...

Problem when saving...
When I hit the save button I get a message that says "The file may hav been changed by another user since you last saved it. In that case what do you want to do?" Then it gives me the option of saving a cop or overwritting changes. Why does it do this? It never used to bu started it the other day? Is there a setting somewhere? Thank you -- Jambruin ----------------------------------------------------------------------- Jambruins's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=571 View this thread: http://www.excelforum.com/showthread.php?threadid=...

Problem with attachments
Hi, I have a user who attaches multiple attachments e.g. .ppt, .doc, xls and .pdf in an e-mail. But Outlook 2000 randomly changes the order of the attachments and also sometimes deletes one of the attachments. So if the user takes a print on the mail before sending it and then after it has been sent takes a new print from the folder Sent Items the e-mail are changed. The attachments are in unordered and sometimes one is missing. We are using Outlook 2000 on the client and Exchange 5.5 as mail server, every update and sp are installed on the client and server. Thank you in advance Ilm...

Exchange server/OL problem after creating site/subnet
One domain. Total of 5 win 2k DC's in the organization, 2 in the main office, 1 each in the other branch offices. The main office is 10.91.x.x while the branch office is 10.31.x.x, 10.51.x.x, and 10.85.x.x. So far we can't seem to figure out this problem which has happened twice already when we try to do this: In AD sites and services, create a site for one of the branch office, create a subnet associated with that branch office, associate the subnet with the site, move the DC of that branch office to the created site. A few minutes after the above is done, either: 1. People who...

Does delgatation cause any Archive Problems?
Outlook 2002 sp2 Exchange 2000 Question: If a user is accessing another users Inbox and Calendar using delegation and auto archive kicks off. Do the mails and calendar items from both users get mixed together in the same .pst file? If yes, can this be fixed without turning off auto archive? ...

MFC/MMC? Problem
Hi all, here is the issue i have. We are implementing Active Directory and some of the fields are not visible using the MMC ( exemple the Employee ID..) So using MSDN, i managed to create a new user property page. So now, when you open "Active Directory Users and Computers" on the DC itself, select a user and right-click on properties a new tab is present called "Human Ressources" where you can see the EmpID and change it. The problem comes when you are on workstation and want to remotely connect to the DC using the MMC (Choose "Connect to Domain Con...

problem with display of categories in Calendar
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel When I assign a category to a new event with a specific time (as opposed to an &quot;all day&quot; event), the only thing that changes is the color of the font. There is no &quot;box&quot; of color such as that shown in the video on &quot;how to add events to categories.&quot; I am viewing the calendar in the monthly mode. The &quot;all day&quot; events appear in a brightly colored box depending on the category. But the &quot;timed&quot; events (which are clearly the m...

Exch2K3 versus Win2K3 problem
Hello, One server: subj. and DC giving me problems: very high increased load and lock down. This is a problem mentiones by MS. I dont have the server here at home and I dont have my notes too. Can You help me with a solution ? Exchange is installed at C:/...... and MS mentioned, that the exch. inst. shoul be at another partition. But is that the solution which soleves my problems ? And MS metioned that SBS2003 has the problem too........I cannot understand that "this" is going on :-( Please help with a long term solution - Thx. Regards Torben Br�ndum Hey Torben, The recommend...

MSN Bill Pay Problems
I'm new to MS Money (2004), MSN BillPay and this group, so please bear with me as I try to explain my issue. My first comment is that linking MSN billpay and MS Money is quite cumbersome and complex. Anyway, my issue is as follows. I had an older money file that I finally trashed because I could not repair it. While it was working, MSN bill pay items would be flagged on my checking account registry (some kind of mail icon with a blue line). Anyway, after my transactions were no longer viewable, I decided to delete my ms money (2004) account and start all over (I kept the same bill pay...

Problem sending e-mails with Outlook & SBC Yahoo DSL
I have been unable to fix a problem and am looking for help. I have Outlook 2000. I also have SBC Yahoo DSL. I have spent hours on the phone trying to fix this problem, reloaded my software, etc. I can recieve e-mail from the SBC Yahoo DSL server with my Outlook, but cannot send e- mails. The error message I get is 0x800ccc0f. I know this means the outgoing mail server does not recognize and log me in, but does anyone know a way to change this? SBC made sure my settings were correct, but the problem persists. They claim it is an Outlook problem, but it never happened with other ISP...

list control problem
hello I am trying to make a list control , so that it will display both name and number when i enter them. 1) how do i delete an item from the list control ie void CSpeedDial::OnSpeedDel() { // } 2)how do i move an item up or down in the list contol using "up buttom" and "down buttom" i have created ie void CSpeedDial::OnSpeedUp() { } and void CSpeedDial::OnSpeedDown() { } 3)how do i make the "add buttom" disable when i have 8 items in the list control. this is what I have done so far: BOOL CSpeedDial::OnInitDialog() { CDialog::OnInitDialog(); ...

Pub 2000 Problem
I have been using MSPub 2000 for years and have never had any problem until now. When I click on the icon, or the mspub.exe file in Explorer, I get a message "MSPub 2000 vers. 6 has encountered a problem and needs to close". Then program closes. I have uninstalled and re-installed Office 2000, Small Business Edition. But this still happens. Curiously, if I go to a .pub file in Explorer and click on it, the program opens fine and I can edit the old document. I can also then open other pub files. I can create a new publication if I use the Wizard or choose a template, BUT I cannot cre...

Problem with OST file
Hi all, I have a big problem migrating the Offline store in Outlook. The Situation: ~3.000 Offline User in one Exchange organizations, Exchange 5.5 and Outlook 97. The Offline store Volume is ~30 GB. Now I must move the Server from this organization into another organization (because I have to consolidate this two orgs, later migrate all to Exchange 2003). Whole number of users in both orgs: ~40.000. When I move the server to the new org, then the Offline store is wrong and the user must replicate the whole content again (after deleting the store on the client e.g.). The problem is: I have ...

Problems linking the fields in two forms
I created a command button on my form so that I can open up another form to save space and make it look neater on my main form. The common field between these two forms is the PO (Purchase Order) number but the subform that opens up does not autopopulate that same number from the primary form - how can I fix this? -- Kenji Could you explain how you open the secondary form (not subform)? Macro? What action(s)? Code? What lines? -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at m...

Strange CListCtrl problem
Hello, I am using a list control (CListCtrl) in "report view" format within a class derived from CFormView. I am creating the columns in the overridden OnIntialUpdate( ) method using InsertColumn( ). I then attempt to populate the control using InsertItem( ) and SetItemText( ) methods in the overridden OnUpdate method. In this case, the InsertItem( ) calls seem to work with data being displayed as intended, however the SetItemText( ) calls do not cause any data to be displayed. Now, if I cut and paste the code from the OnUpdate( ) method to the OnIntialUpdate( ) method, eve...

Sleep problem
My current problem: I am trying to simply toggle between some bitmaps, using Sleep() to make the bitmaps "toggle" But, when I run the program, you never seen the bitmaps change. Here is my code, any ideas are hightly welcomed SendDlgItemMessage(hwndDlg,IDC_BUS_A,BM_SETIMAGE,IMAGE_BITMAP,(long)BMP_bus_a_on); Sleep ( 200 ); SendDlgItemMessage(hwndDlg,IDC_BUS_A,BM_SETIMAGE,IMAGE_BITMAP,(long)BMP_bus_a_off); SendDlgItemMessage(hwndDlg,IDC_BUS_B,BM_SETIMAGE,IMAGE_BITMAP,(long)BMP_bus_b_on); Sleep ( 200 ); SendDlgItemMessage(hwndDlg,IDC_BUS_B,BM_SETIMAGE,IMAGE_BITMAP,(long)BMP_bus_b...

Pivot Series problem
I have a problem, I have a spreadsheet set up that lists my tip income, broken down in several ways (I am a poker dealer, a down is 1/2 hour on a table) Date Day Tourney Tourney Live Take Home Tax Payout ...etc... Downs Tips Downs Live Tips 3-20-06 Mon. 3 $21 5 $67 $28 3-21-06 Tues. 1 $9 4 $72 $19 I want to create a stacked bar chart, using the money values as the series making up the stacked bars. While this is not difficult in a regular cha...

macro problem #12
Finally with your last suggestion I�ve got it; Thanks indeed for your care on my problem!!! Cheers ;) ;) :) -- Gerbatin ------------------------------------------------------------------------ Gerbatin's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15238 View this thread: http://www.excelforum.com/showthread.php?threadid=273207 ...

Windows XP Pro startup problem
Hi, I have a customer that is running Windows XP Pro. Their PC was working fine and they claim that they did not change any hardware or software. All of a sudden, however, Windows XP will not start. After being powered on, the PC gets stuck either at the "Microsoft Windows XP" screen with the progress meter or at "Loading Personal Settings". This happens every time they try to start the PC and they eventually have to force it off with the power button. They have tried booting to "Normal Mode", "Safe Mode", and "Last Known Good ...

Problem with Streets and Trips 2010 sending to GPS
I have a Garmin Nuvi 750. I connect it to the PC with a USB cable, and the icon on the Garmin that shows it is connected to the PC comes up. But when I go to S&T and try to click on the Send to GPS link, it is grayed out. What am I doing wrong? "Jonw" <Jonw@discussions.microsoft.com> wrote in message news:DBD949E5-BDD9-49B8-8DD1-BC16359C4683@microsoft.com... > I have a Garmin Nuvi 750. I connect it to the PC with a USB cable, and the > icon on the Garmin that shows it is connected to the PC comes up. But when > I > go to S&T and try to click...

Problems printing a word document with linked excel tables.
I am having trouble printing a word document that has linked excel tables in it. When I print the document, some of the linked excel tables get skewed and distorted. However, they look normal on screen. What causes this? How can I fix it? -- jc ...

XPTheme in PropertySheet problem
Hello! In my app I use XPTheme. The two first pages in the PropertySheet did show the right background. The third don't show the right background. Any suggestion what to do? ...