Solved

Using GetSystemInfo() function from Win32API

Posted on 1998-06-17
3
417 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

730 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