|
|
What do you mean by "callback works better"?
You need to find out the exact reason why that statement was made and if it applies to you.
Anyway, I think the error is because the callback signature is not what is expected.
Here is an excerpt from MSDN -
The lpfnTimer callback function need not be named TimerProc, but it must be defined as follows:
void CALLBACK EXPORT TimerProc(
HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent // timer identification
DWORD dwTime // system time
);
|
|
|
|
|
This is the term that im quoting from a text book. The auther used exactly this term for the procedure.
|
|
|
|
|
That is not good enough.
If the author has not explained why it is so, you could probably send him/her an email asking for clarification.
|
|
|
|
|
overloaded Name wrote: I read somewhere that callback function works better than the WM_TIMER in vc6
That's vague and without foundations, I think can't be the rationale for your choice. Probably the WM_TIMER message would fit your needs as well.
overloaded Name wrote: void CALLBACK CTimers_CallbackFuncDlg::Timer1()
As David already suggested that cannot be a standard (a instance) method of the class, it must be either a static method or, simply, a function.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Since I already told here..I read it somewhere. According to the author;
Timers are placed into the application queue (only if application is idle). If the application is not idle and has been busy (due to which several timer event messages can be missed by the app), windows places only one timer event in the application queue. Hence Windows does not sends all the timer events to the application when it was busy (and no matter how many timer messages have been missed, it still places only one timer event in the queue).
This was the reason (which from the feedback so far, I think is wrong) I was trying to write a function.
|
|
|
|
|
As far as I know, the callback isn't called in the context of another thread, hence, if your main thread is busy, then it wouldn't be called either.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The callback is called on the thread that set the timer. It's called from it's message pump (if it hasn't got one the mechanism doesn't work).
Steve
|
|
|
|
|
WM_TIMER messages are not accumulated.
If you think about it you really don't need this.
If you miss a time interval, you just wait for the next.
|
|
|
|
|
overloaded Name wrote: SetTimer(ID_CLOCK_TIMER,1000,(CALLBACK)&Timer1);
Firstly, drop the (CALLBACK) cast, it won't help. In fact such "optimistic casting" (ignoring what something is and just pretending it's what it should be) often just makes things worse by turning compile-time errors into runtime errors. Only use casts when you know exactly what you're doing.
In your case the problem is that the callback can't be a non-static member function.
overloaded Name wrote: I read somewhere that callback function works better than the WM_TIMER in vc6
I can't see why. In your case the exact opposite is true as not using a callback means MFC does all the non-member-function to member-function thunking for you.
Steve
|
|
|
|
|
Hi there,
I've an application which uses MAPI for sending mails.
It was all working well with Outlook 2007 on Win XP.
But when I work on Outlook 2003, with the same application, it is throwing an error - 2 (MAPI_E_FAILURE)when making a call to MAPISendMail() API.
I used the sample application to test whether there is any issue with Outlook 2003, from the following link: Programmatically adding attachments to emails[^]
but it seems to be working well. Only when I try to send mail from my old app, it always returns with the error 2.
I've googled and tried almost all possible steps, but the issue still exist.
ULONG nError = m_lpfnMAPISendMail(0, 0, &mapiMessage, MAPI_LOGON_UI|MAPI_DIALOG , 0);
please advise on the resolution.
Thanks in advance.
regards,
Rajesh
|
|
|
|
|
Rajesh_Parameswaran wrote: please advise on the resolution.
Have you tried this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hey,
I need to earn some points in my IT class and thought about writing a tool that would tell you what runs on a specific port, in this case port 80.
Now it would most likely be a webserver, finding that out is no problem by checking for specific strings such as "" etc..
My problem is though, I would like to know what kinda Webserver runs on that port.
How would I do that?
Unfortunately the replies are not really formated, so its really hard to filter it out.
Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Bad request!</title>
<link rev="made" href="mailto:admin@eightzerodigital.com" />
<style type="text/css"><!--
body { color: #000000; background-color: #FFFFFF; }
a:link { color: #0000CC; }
p, address {margin-left: 3em;}
span {font-size: smaller;}
--></style>
</head>
<body>
<h1>Bad request!</h1>
<p>
Your browser (or proxy) sent a request that
this server could not understand.
</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:admin@eightzerodigital.com">webmaster</a>.
</p>
<h2>Error 400</h2>
<address>
<a href="/">cre8.eightzerodigital.com</a><br />
<span>18/11/2010 14:04:15<br />
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color
PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1</span>
</address>
</body>
</html>
is what I recv() when i send() to 109.70.146.167 on port 80.
That does not actually help me though, as the banner is not always the last message..
Sometimes the banner is not even in it at all..
65.39.148.34 on port 80
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/str
ict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid URL</h2>
<hr><p>HTTP Error 400. The request URL is invalid.</p>
</BODY></HTML>
I did some google digging and found out about certain tools that would grab the banner such as Acunetix Vulnerability Scanner, atleast for http server it grabs EVERY banner.
Any suggestions?
|
|
|
|
|
I don't think you can do this as the response that you get from any web server depends entirely on that server. There is no standard format that will give you a consistent piece of information; just surf a few different sites to see.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Yea, I just found that out too, so I digged some more and found out about some webscanner or whatever they are called.
How do those tools get literally every(for webservers atleast) banner though?
|
|
|
|
|
No idea, I'm a simple C++ programmer.
What exactly do you mean by 'banner', is it some special piece of HTML?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Banner is like a name that identifies the service that runs on the port.
Iam just look for a way to identify what service/program runs on a port.
Example:
For an ftp it's the first reply:
220-FileZilla Server version 0.9.34 beta
Iam looking for something similiar that works for webservers.
|
|
|
|
|
Well known port numbers are as defined here[^]. Also if you look here[^] you will see that there is no HTML tag that describes the information you are looking for.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
ALLERSLIT wrote: Banner is like a name that identifies the service that runs on the port.
Iam just look for a way to identify what service/program runs on a port.
Check the HTTP response headers. Some web servers include a Server header in every response, e.g. Server: Apache/1.2.3 . Practically, you take a HTTP client class, make a dummy request and evaluate the response headers. It's a simple way to identify the web server software running on that port, it is not reliable as you can often configure or omit this information on the server side.
Happy coding!
|
|
|
|
|
I want to bring the window that has been activated before my application's window in the z-order and set keyboard focus to it. there are 3 API related to this job in Windows APIs:
BringWindowToTop (...)
SetActivatedWindow (...)
SetForegroundWindow (...)
I've been trying all possible combination of these functions since yesterday, but I failed. The problem is I can bring the windows I like to the front, but those never get keyboard-focused. I've also tried ShowWindow (...), but It failed to set the focus to the windows too.
what to do?
|
|
|
|
|
According to the MSDN documentation for SetFocus()[^] you can only set the focus to a window that is attached to your own message queue.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hello out there.
I use Visual Studio and when setting the project to use Unicode under project settings I get a nice rounded look on the buttons etc. But if I set it to Multi Byte Character Set everything is sharp and have corners. Why is this so?
I have an old program that I would like to convert into the nicer look. But as it has several thousand lines of code and changing all text into _T("") and use Unicode-functions will take forever and is not an option.
Is there a way to use Multi Byte Char set and still have the rounded buttons and boxes?
Is there a simple way to go around this? Or is it so that I have to leave it to as it is?
|
|
|
|
|
Are they owner-drawn buttons? Usually the charset has nothing to do with how the buttons are drawn. Check the drawing code in detail.
|
|
|
|
|
It's because of the Common Controls V6 being used in Unicode builds.
Open your stdafx.h and at the bottom remove the line that checks for Unicode - it's a wrapper around the common controls v6.
It should look something like
#ifdef UNICODE
...
...
#endif
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thank you. This really helps me. 
|
|
|
|