[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using GetSystemInfo() function from Win32API

Posted on 1998-06-17
3
Medium Priority
?
425 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 400 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 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.

656 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