Click here to Skip to main content
15,911,891 members
Home / Discussions / C#
   

C#

 
GeneralCustom Tree View Painting Pin
vektuz8-Dec-03 14:14
vektuz8-Dec-03 14:14 
GeneralRe: Custom Tree View Painting Pin
Heath Stewart8-Dec-03 18:19
protectorHeath Stewart8-Dec-03 18:19 
GeneralRe: Custom Tree View Painting Pin
vektuz8-Dec-03 20:25
vektuz8-Dec-03 20:25 
GeneralRe: Custom Tree View Painting Pin
J. Dunlap8-Dec-03 20:42
J. Dunlap8-Dec-03 20:42 
GeneralRe: Custom Tree View Painting Pin
Heath Stewart9-Dec-03 2:41
protectorHeath Stewart9-Dec-03 2:41 
GeneralProblem with MSDN Pin
Redbehelit8-Dec-03 14:00
Redbehelit8-Dec-03 14:00 
GeneralRe: Problem with MSDN Pin
Heath Stewart8-Dec-03 18:12
protectorHeath Stewart8-Dec-03 18:12 
Generalconvert to c# Pin
Rob Tomson8-Dec-03 13:16
Rob Tomson8-Dec-03 13:16 
i downloaded this code and it's in c++. it's suppose to read the cpu temperature and display the result but i can't get it to run. can someone please massage it and make it run in c# becuase i don't know c++ that well.

thanks,
Rob Tomson

<br />
//<br />
// Simple Winbond W83697HF/F chip motherboard and cpu temp reader<br />
// Require giveio.sys driver under winXP/2000/NT<br />
// Used compiler: visual C++ 6<br />
// Autor: Sander Aiaots<br />
// E-Mail: san@ejaam.com<br />
// I also do not take any responsibility if this program should harm your computer<br />
//<br />
#include <iostream.h><br />
#include <windows.h><br />
#include <conio.h><br />
// By the manual we have two ports to use <br />
// 0x295 - the INDEX port and<br />
// 0x296 - the DATA port<br />
#define INDEX 0x295<br />
#define DATA 0x296<br />
<br />
#define BANK_SET 0x4e // lowest three bitti set a bank, in manual lk97 and lk109<br />
#define CPU_TEMP 0x50 // BANK 0 0x4e = xxxxx001<br />
#define	MBM_TEMP 0x67 // 0x4e = xxxxx000<br />
 <br />
// lets give us a direct I/O access under winXP/2000/NT<br />
// this part is not needed under win9x<br />
int inline openIO(){<br />
	HANDLE h;<br />
	h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL,<br />
					OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);<br />
    if(h == INVALID_HANDLE_VALUE) {<br />
        cout << "Couldn't access giveio device\n";<br />
        return 1;<br />
    }<br />
	CloseHandle(h);<br />
	return 0;<br />
}<br />
<br />
int main(){<br />
	<br />
	// lets give us a direct I/O access under winXP/2000/NT<br />
	// this part is not needed under win9x<br />
	if(openIO()) return -1;<br />
	<br />
	// Set Bank register to BANK0<br />
	_outp(INDEX, BANK_SET);<br />
	_outp(DATA, _inp(DATA)|0x01);<br />
	<br />
	//<br />
	_outp(INDEX, CPU_TEMP);<br />
	cout << "CPU temp: " << _inp(DATA) << "C\n";<br />
	// lets unset BANK register, to get Motherboard temperature<br />
	_outp(INDEX, BANK_SET);<br />
	_outp(DATA, _inp(DATA)&0xf8);<br />
	_outp(INDEX, MBM_TEMP);<br />
	cout << "MBM temp: " << _inp(DATA) << "C\n";<br />
	<br />
	return 0;<br />
}


--
There are 10 kinds of people. Those who understand binary and those who don't.

GeneralRe: convert to c# Pin
Christian Graus8-Dec-03 16:07
protectorChristian Graus8-Dec-03 16:07 
GeneralRe: convert to c# Pin
Christian Graus8-Dec-03 16:40
protectorChristian Graus8-Dec-03 16:40 
GeneralRe: convert to c# Pin
Rob Tomson8-Dec-03 17:58
Rob Tomson8-Dec-03 17:58 
GeneralRe: convert to c# Pin
Heath Stewart8-Dec-03 18:10
protectorHeath Stewart8-Dec-03 18:10 
GeneralList View Scroll Pin
compubaby8-Dec-03 12:25
compubaby8-Dec-03 12:25 
GeneralRe: List View Scroll Pin
Heath Stewart8-Dec-03 18:05
protectorHeath Stewart8-Dec-03 18:05 
Generalsome general questions about sounds Pin
blakeb_18-Dec-03 8:52
blakeb_18-Dec-03 8:52 
GeneralRe: some general questions about sounds Pin
Heath Stewart8-Dec-03 9:54
protectorHeath Stewart8-Dec-03 9:54 
GeneralRe: some general questions about sounds Pin
blakeb_18-Dec-03 9:57
blakeb_18-Dec-03 9:57 
GeneralRe: some general questions about sounds Pin
Heath Stewart8-Dec-03 10:02
protectorHeath Stewart8-Dec-03 10:02 
GeneralRe: some general questions about sounds Pin
leppie8-Dec-03 10:33
leppie8-Dec-03 10:33 
GeneralRe: some general questions about sounds Pin
leppie8-Dec-03 10:38
leppie8-Dec-03 10:38 
GeneralRe: some general questions about sounds Pin
blakeb_18-Dec-03 10:55
blakeb_18-Dec-03 10:55 
GeneralRe: some general questions about sounds Pin
Heath Stewart8-Dec-03 11:43
protectorHeath Stewart8-Dec-03 11:43 
GeneralRe: some general questions about sounds Pin
blakeb_18-Dec-03 11:49
blakeb_18-Dec-03 11:49 
GeneralRe: some general questions about sounds Pin
Heath Stewart8-Dec-03 11:56
protectorHeath Stewart8-Dec-03 11:56 
Generaldetecting internet connection Pin
godzooky8-Dec-03 8:45
godzooky8-Dec-03 8:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.