Solved

Using GetSystemInfo() function from Win32API

Posted on 1998-06-17
3
415 Views
Last Modified: 2012-05-04
When I call the function GetSystemInfo()from an OnButtonClick() function, I get "Unhandled Exception - Access Violation" Error when exiting the OnButtonClick()function. If I "comment out" the GetSystemInfo() function, the error goes away.
0
Comment
Question by:electrick
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1166126
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1166127
I'm just going to take a guess here, but I suspect that you are not passing a pointer to an existing SYSTEM_INFO structure.  See you need to allocate a SYSTEM_INFO structore (globally, lovcally, or dynamically, but local is the ussual way) and pass a pointer to that structure.  Then windows will fill in the structure.  You should do something like

SYSTEM_INFO SysInf;
GetSystemInfo(&SysInf);

you should not do

SYSTEM_INFO *SysInfPtr;
GetSystemInfo(SysInfPtr);

that will cause an exception because the pointer passed doesn't actually point to a SYSTEM_INFO structure.  It is just a random pointer.

0
 

Author Comment

by:electrick
ID: 1166128
You are correct Sir. It worked !
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

808 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