Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ MFC
Hi all ,
I have some code which does some conversion on an image , for it it uses LockBits and does some processing and then calls unlockbits , the problem while the code does perform good on Win Xp but sometimes on Windows 7 the code throws memory access violation occurs exception...
Can you ppl come up with some sort of suggestion what could possibly be wrong on win 7 .
Posted 2-Oct-12 18:21pm
Mohibur Rashid at 3-Oct-12 0:55am
Perhaps debugging on Windows 7 environment. It is possible that some function is not working as it was suppose to work.
iampradeepsharma at 3-Oct-12 1:00am
Marius Bancila at 3-Oct-12 2:47am
First, you should figure which function throws that exception.
iampradeepsharma at 3-Oct-12 2:56am
LockBits() , this function throws the exception .
Marius Bancila at 3-Oct-12 3:05am
There can be different causes for this. Impossible to say anything without seen your code. Take a look at a search results for "LockBits memory access violation", you'll see others had problems. Take a look at the suggestions and double check your code.
iampradeepsharma at 3-Oct-12 4:53am
sure Marius

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The problem can be completely at a different (and sometimes unrelated) chunk of code in your program. E.g. you have a buffer overrun somewhere in the program that sometimes corrupts the memory reserved for unlockbits

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 225
1 Manfred R. Bihy 190
2 CHill60 180
3 _Amy 155
4 OriginalGriff 150
0 OriginalGriff 7,320
1 Sergey Alexandrovich Kryukov 6,043
2 Maciej Los 3,754
3 Peter Leow 3,448
4 CHill60 2,572

Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 8 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100