i want to make a program which calculates the time for which a computer is logged on
Platform specific. What OS are you using?

can anyone tell me how to make a program which can actually run in invisible mode
What do you mean by invisible mode? Not having a user interface?