Solved

Using GetSystemInfo() function from Win32API

Posted on 1998-06-17
3
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 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…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

691 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