|
Since services run before the user logs in, you will have to be carefull with what you do. The desktop may not be present when you expect it to be.
It is better to write an application that interfaces with the service and have a GUI less service IMO.
Ant.
|
|
|
|
|
Hi,
Just a quick question.
When writing an application. How do you handle error conditions?
In GDI+ e.g you are performing a series of operations each API call could go wrong.
Do you have a TRACE statement for *every* call you make?
What about Release mode?
Also you might make calls to many nested functions. Do you have an error for each nested call
or do you somehow pass the error up the chain?
How do nicely exit the program if you encounter a fatal error ? And No I dont think PostQuitMessage(0) is a good option.
Regards,
|
|
|
|
|
I have a project and if I rename a file I want to remove it from MRU if it is there,but I don't know how because there is only ID_FILE_MRU_FILE1 to 4.
Thanks.
|
|
|
|
|
Hi t o everyone reading this...
I have noticed that when an EditBox has the option singleline then if u add a notification handling function to it (lets say for the event EN_UPDATE ) and u call SetWindowText inside the function u instantly u receive a second notificatio and again and again.....
If though the EditBox has the option multiline the above behavior does not take place. Insted the notification arrives only once, SetWindowText sets the new text to the EditBox and the notification handling function exits.
Does anybody know why this deference exists? Does it serve a purpose?
In a single line EditBox how can i alter the text typed before it is displayed?
Thanks in advance for helping....
|
|
|
|
|
the winsock function recv and send seem can only send messages,can I use them to transferr a file? (I want to program a trojan backdoor)or I should use other method such as CSocket or ftp?Is there someone so kind to help me and give a detaied explaination?I can't find it in MSDN.
|
|
|
|
|
first of all, a file is just a stream of bytes. so to transfer the file, you need to read all the bytes of the file, and send them down your socket. Most likely, you'd read it in blocks and send the blocks down. eg 2048 bytes. On the other end, you need to be able to put that file back together. so you need to also send down the name of the file.
ftp is much easier. call the ftp process.
ftp -s:filename takes a file with ftp commands
|
|
|
|
|
The answer to your question is to use the CSocket class.
However, know that we do not support virus or trojan programming here. Such actions are considered immoral among legimate programmers. It also might have a negative economical effect on the industry, and as such, it represents everything quite the opposite that this forum and the community behind it are meant for.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Well I'm trying to get the system time and make it a number. I want to do this so I can later compare the number with another instance of basically the same thing. For those you are wondering I'm trying to write a simple parking garage program. I'm having a hard time making the time a number. Thank you for your help and time.
|
|
|
|
|
Would this function help?
#include <ctime>
time_t time(time_t*);
Maxwell Chen
|
|
|
|
|
I don't think it helped. I will be painfully honest here. I don't exactly understand how to use this function.
|
|
|
|
|
I think what Maxwell Chen means, is that time_t is defined as a number.
You said you wanted the time as a number. It is defined as :
typedef long time_t;
so it is a long and therefore you can treat it as you want to.
|
|
|
|
|
So I would just call time_t? I have an array that I'm trying to store the number in so I can later go back and compare it. In order to accomplish this must I do something like
i is the part of the array I'm using.
array[i] = time_t;
|
|
|
|
|
here is a better example :
#include <ctime>
time_t clock;
time(&clock);
----------------------------------------------------------------
"clock" is a variable of type time_t
time is a function you call to populate the variable "clock"
once you do that, you can do this :
array[i] = clock;
|
|
|
|
|
Both time_t clock and time(&clock) are both included? I'm under the assumption they are part of the header file.
|
|
|
|
|
#include <time.h>
void MyClass::SomeFunction()
{
time_t clock; // this is creating a variable called clock
time(&clock); // calling a function called time
array[i] = clock; // sets the position i of array to the clock value
}
i hope that clears it up a bit for you
|
|
|
|
|
Yes it does. Thank you very much
|
|
|
|
|
wohoo no problem.
Mr Chen was the one that really helped.
|
|
|
|
|
Never Mind. I figured out what I did wrong. Thanx again.
|
|
|
|
|
in CVeh.h at the top of the file,
you should put :
#include <time.h>
does that help at all ? because it looks like it doesn't know where the time function as been defined, and is assuming it is a member function of your CVeh class.
sorry the html here stripped the <time.h> before. give that a go, and see if it helps
|
|
|
|
|
What I did was had a function in there that shouldn't have been there. I forgot to delete it. Here's another question if you don't mind. I set my counter i to 0 in OnInitDialog.
void CVeh::OnButton1()
{
time_t clock;
time(&clock);
cars[i] = clock;
ShowWindow(SW_HIDE);
CAdd dlgCAdd;
dlgCAdd.DoModal();
ShowWindow(SW_SHOW);
i++;
}
void CVeh::OnButton2()
{
m_ed3.Set_Number(cars[i]);
}
The number I'm getting is 1083652994.00. I know for fact that isn't the right number(is it)?
|
|
|
|
|
According to the documentation on MSDN :
The time function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC), according to the system clock. The return value is stored in the location given by timer.
therefore, that number is correct. I ran a test and I got 1083653393. So we are around the same ballpark.
|
|
|
|
|
If I want to get the actual time(as in what is is now) then I should divide by what number???
|
|
|
|
|
here is a link to msdn that has same source
MSDN[^]
they use _time64 instead of time, but it pretty much the same thing. I'm not sure what format you want your time in, so i don't know what mean by divide by what number.
eg : ctime( &clock)
will return a string of the the date/time in the variable clock
struct tm *today;
localtime( &clock );
today is a structure that will hold the date/time as numbers.
eg today->tm_hour
today->tm_min
today->tm_sec
|
|
|
|
|
I have a weak understand of this. I don't quite grasp where I use today. Or how I actually get the local time and turn it into numbers. The way we just did it(before this part) gave me just like you said the number of seconds passed since Jan 1 1970.
With this particular way the time is made into a char. I tried just making it an int. The complier gave me an error and wouldn't let me do it.
|
|
|
|
|
Be aware that time() and time_t will fail in 2038. To avoid getting accustomed to these functions, either use _time64() and __time64_t or GetSystemTime() and then convert it to a 64 bit value using SystemTimeToFileTime() .
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|