i want to make a program which calculates the time for which a computer is logged on...........can anyone tell me how to make a program which can actually run in invisible mode
i want to make a program which calculates the time for which a computer is logged on...........can anyone tell me how to make a program which can actually run in invisible mode
Platform specific. What OS are you using?i want to make a program which calculates the time for which a computer is logged on
What do you mean by invisible mode? Not having a user interface?can anyone tell me how to make a program which can actually run in invisible mode
Learn C++ (C++ Books, C Books, FAQ, Forum Search)
Code painter latest version on sourceforge DOWNLOAD NOW!
Download FSB Data Integrity Tester.
Siavosh K C
i am using windows xp
yes i mean that the user wouldnt be able to see the file running
Well you can simply have a counter run on start up and log the time to a file on shut down... Check MSDN for some Windows code, otherwise, try the Windows forum here.
As for invisible mode... even if I knew I probably wouldn't post it as it's potentially malicious.
Sent from my iPadŽ
For log on time, you should use an API function which I don't remember but others will help you.
For being invisible, simple, if you don't make a window for your application, it will be invisible. But for some kind of applications it is better to make a service.
[EDIT]
For being invisible even in processes list, it is a hacking and is forbidden, sorry.
Last edited by siavoshkc; 09-15-2006 at 04:05 AM.
Learn C++ (C++ Books, C Books, FAQ, Forum Search)
Code painter latest version on sourceforge DOWNLOAD NOW!
Download FSB Data Integrity Tester.
Siavosh K C
No need to make any invisible windows. Just ask the OS how long it's been up:
http://msdn.microsoft.com/library/de...ttickcount.asp
One caveat, after about 49 days it rolls over to zero.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.
Here's something that I've used in past projects. You can remotely query the total uptime of a computer.
Code:#pragma comment( lib, "pdh.lib" ) // Search For pdh.lib while linking #pragma comment( lib, "user32.lib" ) // Search For user32.lib while linking #include <windows.h> #include <pdh.h> #include <pdhmsg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> char *GetWSUptime(char *szComputerName ) { PDH_STATUS status; HQUERY perfQuery; HCOUNTER uptimeCounter; char static szReturnBuffer[128]; char uptimeCounterPath[1024] = {0}; PDH_FMT_COUNTERVALUE uptimeValue; DWORD days, hours, minutes, seconds; // // Create a PDH query // if( PdhOpenQuery( NULL, 0, &perfQuery ) != ERROR_SUCCESS ) { return NULL; } // // Associate the uptime counter with the query // wsprintf( uptimeCounterPath, "\\\\%s\\System\\System Up Time", szComputerName ); status = PdhAddCounter( perfQuery, uptimeCounterPath, 0, &uptimeCounter ); if( status != ERROR_SUCCESS ) { return NULL; } // // Snapshot the counter value // status = PdhCollectQueryData( perfQuery ); if( status != ERROR_SUCCESS ) { return NULL; } // // Get the formatted counter value // status = PdhGetFormattedCounterValue( uptimeCounter, PDH_FMT_LARGE , NULL, &uptimeValue ); if( status != ERROR_SUCCESS ) { return NULL; } // // Close the query // PdhCloseQuery( &perfQuery ); days = (DWORD) (uptimeValue.largeValue / (3600*24)); hours = (DWORD) (uptimeValue.largeValue % (3600*24) / 3600); minutes = (DWORD) (uptimeValue.largeValue % 3600) / 60; seconds = (DWORD) (uptimeValue.largeValue % 60); memset(szReturnBuffer, 0, sizeof szReturnBuffer); sprintf(szReturnBuffer, " %d Days, %d Hours, %d Minutes", days, hours,minutes); return (char *)szReturnBuffer; } int main(void) { printf("system up time %s\n",GetWSUptime("MyComp")); return 0; }
i have seen people using a header file named "windows.h"
well........my c++ doesnt seem to be able to include it.....why??
You should include windows.h byto be able to write a Windows application. Search your hard disk to find that file.Code:#include<windows.h>
Learn C++ (C++ Books, C Books, FAQ, Forum Search)
Code painter latest version on sourceforge DOWNLOAD NOW!
Download FSB Data Integrity Tester.
Siavosh K C