Solved

Access violation

Posted on 2003-11-02
3
1,806 Views
Last Modified: 2012-05-04
I have a global CRITICAL_SECTION object, but when I try to use EnterCriticalSection() with it, I get an access violation.

CRITICAL_SECTION g_criticalSection;
...

//Then later on in a global function I have
EnterCriticalSection(&g_criticalSection);  // Access violation here
memset(g_szClipboard,0,sizeof(g_szClipboard));
LeaveCriticalSection(&g_criticalSection);

What could be the problem?
0
Comment
Question by:lwinkenb
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 9666663
Have you used

InitializeCriticalSection (  g_criticalSection);

before using it? If not, this would explain the problem...
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 9666683
argh, I knew it was something simple.
Thanks jkr.
0
 
LVL 86

Expert Comment

by:jkr
ID: 9666693
You're most welcome :o)
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question