|
-
Apr 30th, 2001, 04:17 PM
#1
Thread Starter
PowerPoster
I don't know what is happening here
I want to get the time since my computer was started. I use this function in vb
GetTickCount()
Now, in C++, I used this code to get the time since I started my computer.
long int ticktime;
ticktime = GetTickCount();
Until now, it works fine but now I want to show a messageBox like this:
MessageBox(NULL, ticktime, "The title", MB_OK);
It gives me an error on the variable "ticktime". What is the problem??
Last edited by abdul; Apr 30th, 2001 at 04:30 PM.
Baaaaaaaaah
-
Apr 30th, 2001, 04:22 PM
#2
try this...
Code:
char buffer[200];
wsprintf(buffer, "%i", ticktime);
MessageBox(NULL, buffer, "The title", MB_OK);
-
Apr 30th, 2001, 04:45 PM
#3
Frenzied Member
Or the itoa function;
Code:
char buffer[8];
MessageBox(hWnd, itoa(GetTickCount(), buffer, 8) , "Your Number", MB_OK);
-
Apr 30th, 2001, 04:50 PM
#4
Monday Morning Lunatic
Or even my all-singing, all-dancing printf-stylie MsgBox function:
Code:
#include <windows.h>
#include <stdlib.h>
#include <stdarg.h>
int MsgBox(HWND hParent, int iFlags, TCHAR *pcCaption, TCHAR *pcText, ...) {
va_list args;
TCHAR pcBuf[1024];
va_start(args, pcText);
_vsntprintf(pcBuf, 1024, pcText, args);
va_end(args);
return MessageBox(hParent, pcBuf, pcCaption, iFlags);
}
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|