Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,576 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,879 people online right now. Registration is fast and FREE... Join Now!




I am searching for a large database on windows.h

 
Reply to this topicStart new topic

I am searching for a large database on windows.h

PassionFRUI7E
5 Oct, 2008 - 03:43 PM
Post #1

New D.I.C Head
*

Joined: 5 Oct, 2008
Posts: 2

I am currently working on an app to automatically turn off my computer when battery reaches 8%. I just started a couple minutes ago, and came across some working code to retrieve the percent of battery life. Note I have more experience in C# and just starting C++, so calling unmanaged code from unmanaged code is new to me. Does anyone know where a good reference is? And specifically does MSN have a worthwhile one? Basically like the C++ equivalent to the lists of functions you can import from user32.dll in C#.

CODE

#include <windows.h>
#include <iostream>

#define UNKNOWN         0xFFFFFFFF

using namespace std;

int main(void)
{
    SYSTEM_POWER_STATUS status;

    GetSystemPowerStatus( &status );
    int life = status.BatteryLifePercent;
    int secs = status.BatteryLifeTime;

    cout << "Life is " << life << "%" << endl;

    cin.ignore(cin.rdbuf()->in_avail() + 1);

    return 0;
}


I know I shouldn't use the entire namespace at once, I'll work on speed once I actually get it working =P Note I'm quite sure I can finish my app, I'm just curious for a reference. Sorry for any confusion.

This post has been edited by PassionFRUI7E: 5 Oct, 2008 - 03:44 PM
User is offlineProfile CardPM
+Quote Post

JackOfAllTrades
RE: I Am Searching For A Large Database On Windows.h
5 Oct, 2008 - 03:56 PM
Post #2

Cantankerous Old Fart
Group Icon

Joined: 23 Aug, 2008
Posts: 580



Thanked: 59 times
Dream Kudos: 50
My Contributions
Interop Wiki
User is offlineProfile CardPM
+Quote Post

PassionFRUI7E
RE: I Am Searching For A Large Database On Windows.h
5 Oct, 2008 - 04:10 PM
Post #3

New D.I.C Head
*

Joined: 5 Oct, 2008
Posts: 2

Since when did I hint at needing .net code? I just want a database on the contents of windows.h so I can work with my system.
User is offlineProfile CardPM
+Quote Post

JackOfAllTrades
RE: I Am Searching For A Large Database On Windows.h
5 Oct, 2008 - 06:08 PM
Post #4

Cantankerous Old Fart
Group Icon

Joined: 23 Aug, 2008
Posts: 580



Thanked: 59 times
Dream Kudos: 50
My Contributions
Geez, sorry...I misread your post as needing to know how to call unmanaged code from managed code.

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 12:13AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month