 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vesty Guest
|
Posted: Tue Jan 03, 2006 8:15 pm Post subject: Detecing origin of messages |
|
|
Howdy folks,
Is it possible in an application to detect the origin of window messages?
For example, if someone sends a message to my application using SendMessage
is there any way I can tell the difference between that and a message that
was generated internally in my program?
Any tips appreciated,
--
Vesty.
|
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Tue Jan 03, 2006 9:44 pm Post subject: Re: Detecing origin of messages |
|
|
"Vesty" <no (AT) email (DOT) com> wrote:
| Quote: | Is it possible in an application to detect the origin of window messages?
For example, if someone sends a message to my application using SendMessage
is there any way I can tell the difference between that and a message that
was generated internally in my program?
Any tips appreciated,
|
Well, you can try checking the bits in the message - all bits come with
a signature denoting the address whereat they were generated *grin*
More seriously, the answer is no. In principle it should not matter
where the message comes from. In practice - what do you need to know? If
you're trying to make an application secure under Windows, then you must
assume that all messages are malicious.
Alan Bellingham
--
Team Thai Kingdom
<url:http://www.borland.com/newsgroups/> Borland newsgroup descriptions
<url:http://www.borland.com/newsgroups/netiquette.html> netiquette
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Jan 03, 2006 10:28 pm Post subject: Re: Detecing origin of messages |
|
|
"Vesty" <no (AT) email (DOT) com> wrote
| Quote: | Is it possible in an application to detect the origin of window messages?
For example, if someone sends a message to my application using
SendMessage is there any way I can tell the difference between that
and a message that was generated internally in my program?
|
Sorry, but the API does not provide anything for that.
Gambit
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Wed Jan 04, 2006 2:33 pm Post subject: Re: Detecing origin of messages |
|
|
I'm not sure if this will help you, but you can associate an id with a
thread using SetMessageExtraInfo() that you can retrieve with
GetMessageExtraInfo().
--
Bruce
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Wed Jan 04, 2006 3:30 pm Post subject: Re: Detecing origin of messages |
|
|
"Boba" <Boba (AT) somewhere (DOT) world> wrote
| Quote: | Bruce, I didn't see your reply tstamped as 6:33 am on my pc:
I wouldn't have posted mine at 8:44 am. This makes me ask a
question: what is the message 'time sent' for news servers?
is it local tstamp? Boba
|
I think they are stored in UT on the server and translated locally by
our newsreaders. Looking at the time stamps
mine was sent at (4 Jan 2006 06:31:08 -0700)
and yours at (4 Jan 2006 06:38:16 -0700)
About 7 min. apart--maybe just missing the refresh in your newsreader.
Cheers,
Bruce
|
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Wed Jan 04, 2006 3:42 pm Post subject: Re: Detecing origin of messages |
|
|
"Boba" <Boba (AT) somewhere (DOT) world> wrote:
| Quote: | I wouldn't have posted mine at 8:44 am. This makes me ask a
question: what is the message 'time sent' for news servers?
is it local tstamp? Boba
|
If the sender doesn't set a timestamp, then the first server that deals
with it should. And the timestamp should, of course, indicate the time
zone.
For instance, your message was marked as:
Date: Wed, 4 Jan 2006 08:58:55 -0800
which I see as 04/01/2006 16:58:55. Bruce's message, interestingly, had
a different timezone. Since both your messages arrived via the same
single news server, one knows that at least one of your clients is
correctly adding the timestamp itself - and probably both.
The time associated with a message is usually that of the client PCs,
rather than that of the server. This does mean that any PC with an
incorrectly set clock (e.g. anyone with a Windows PC who accepts the
default time zone without actually being in that timezone, for example)
will have misdated messages.
(There are also propagation issues - anyone who assumes that they will
see a newsgroup message instantly is naive or deluded.)
Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK
|
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Wed Jan 04, 2006 4:27 pm Post subject: Re: Detecing origin of messages |
|
|
"Boba" <Boba (AT) somewhere (DOT) world> wrote:
| Quote: | does make sence to me. But what I can't figure out is according to Bruce
our messages on his system are shown as 7 min apart. My pc says:
Bruce's post - 6:33 am
Boba's - 8:58 am
If all (or at least most of) time zones boundaries are based on int hour
values, how could the gap on my system become 15 min? Could it be what
you call a propagation issue?
|
Oh, sorry, your _second_ message was the 8:58 one.
But your client isn't continually asking the server "Got any more
messages?". It's quite likely set to a 10 minute or longer refresh
period, to avoid overloading servers.
In general - just don't worry about it. If your reply was within a short
period (an hour or two, say) of the first one, then the assumption
should be that the other hadn't got to you yet. If it's several hours,
or even days, weeks, months, then it does look silly.
If you're still worried after that, then you could always do a manual
refresh just before posting.
Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK
|
|
| Back to top |
|
 |
Boba Guest
|
Posted: Wed Jan 04, 2006 4:44 pm Post subject: Re: Detecing origin of messages |
|
|
"Vesty" <no (AT) email (DOT) com> wrote
| Quote: | ...
is there any way I can tell the difference between that and a message
that
was generated internally in my program?
...
I would SetMessageExtraInfo in every threads' message queue for that. |
Boba
|
|
| Back to top |
|
 |
Boba Guest
|
Posted: Wed Jan 04, 2006 4:58 pm Post subject: Re: Detecing origin of messages |
|
|
Bruce, I didn't see your reply tstamped as 6:33 am on my pc:
I wouldn't have posted mine at 8:44 am. This makes me ask a
question: what is the message 'time sent' for news servers?
is it local tstamp? Boba
|
|
| Back to top |
|
 |
Boba Guest
|
Posted: Wed Jan 04, 2006 5:45 pm Post subject: Re: Detecing origin of messages |
|
|
" Bruce Salzman" <bruce (AT) nospam (DOT) org> wrote
| Quote: |
I think they are stored in UT on the server and translated locally by
our newsreaders. Looking at the time stamps
mine was sent at (4 Jan 2006 06:31:08 -0700)
and yours at (4 Jan 2006 06:38:16 -0700)
About 7 min. apart--maybe just missing the refresh in your newsreader.
Cheers,
Bruce
|
thanks!
|
|
| Back to top |
|
 |
Boba Guest
|
Posted: Wed Jan 04, 2006 6:17 pm Post subject: Re: Detecing origin of messages |
|
|
"Alan Bellingham" <alanb (AT) episys (DOT) com> wrote
| Quote: |
If the sender doesn't set a timestamp, then the first server that
deals
with it should. And the timestamp should, of course, indicate the time
zone.
For instance, your message was marked as:
Date: Wed, 4 Jan 2006 08:58:55 -0800
which I see as 04/01/2006 16:58:55. Bruce's message, interestingly,
had
a different timezone. Since both your messages arrived via the same
single news server, one knows that at least one of your clients is
correctly adding the timestamp itself - and probably both.
The time associated with a message is usually that of the client PCs,
rather than that of the server. This does mean that any PC with an
incorrectly set clock (e.g. anyone with a Windows PC who accepts the
default time zone without actually being in that timezone, for
example)
will have misdated messages.
(There are also propagation issues - anyone who assumes that they will
see a newsgroup message instantly is naive or deluded.)
Alan Bellingham
|
does make sence to me. But what I can't figure out is according to Bruce
our messages on his system are shown as 7 min apart. My pc says:
Bruce's post - 6:33 am
Boba's - 8:58 am
If all (or at least most of) time zones boundaries are based on int hour
values, how could the gap on my system become 15 min? Could it be what
you call a propagation issue?
|
|
| Back to top |
|
 |
Boba Guest
|
Posted: Wed Jan 04, 2006 6:52 pm Post subject: Re: Detecing origin of messages |
|
|
it's not about the way the posts show on a screen,
i'm trying to figure out how the system marks'em.
Thanks.
|
|
| Back to top |
|
 |
Vesty Guest
|
Posted: Wed Jan 04, 2006 8:11 pm Post subject: Re: Detecing origin of messages |
|
|
Vesty wrote:
| Quote: | Howdy folks,
Is it possible in an application to detect the origin of window messages?
For example, if someone sends a message to my application using
SendMessage is there any way I can tell the difference between that and a
message that was generated internally in my program?
Any tips appreciated,
|
Thanks for the responses. Was more out of curiosity than anything, but
thanks all the same.
--
Vesty.
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Thu Jan 05, 2006 12:37 am Post subject: Re: Detecing origin of messages |
|
|
Alan Bellingham <alanb (AT) episys (DOT) com> wrote:
| Quote: |
[...] The time associated with a message is usually that of
the client PCs, rather than that of the server.
|
I always use the web interface (readers are just too busy for
my taste) and my messages are stamped by my ISP's server.
~ JD
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|