Solved

Using GetSystemInfo() function from Win32API

Posted on 1998-06-17
3
409 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
Comment Utility
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
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
Comment Utility
You are correct Sir. It worked !
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now