Click here to Skip to main content
15,922,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C-Style Exports Pin
Richard Andrew x6425-Nov-13 6:19
professionalRichard Andrew x6425-Nov-13 6:19 
GeneralRe: C-Style Exports Pin
«_Superman_»25-Nov-13 19:26
professional«_Superman_»25-Nov-13 19:26 
QuestionHow to draw lines in a translucent window Pin
chengmingma22-Nov-13 16:42
chengmingma22-Nov-13 16:42 
AnswerRe: How to draw lines in a translucent window Pin
enhzflep22-Nov-13 18:50
enhzflep22-Nov-13 18:50 
Question[SOLVED] What is the x64 #define? Pin
Richard Andrew x6422-Nov-13 11:34
professionalRichard Andrew x6422-Nov-13 11:34 
SuggestionRe: [SOLVED] What is the x64 #define? Pin
Randor 22-Nov-13 12:51
professional Randor 22-Nov-13 12:51 
GeneralRe: [SOLVED] What is the x64 #define? Pin
Richard Andrew x6422-Nov-13 12:54
professionalRichard Andrew x6422-Nov-13 12:54 
GeneralRe: [SOLVED] What is the x64 #define? Pin
Randor 22-Nov-13 13:13
professional Randor 22-Nov-13 13:13 
QuestionTransparent TreeView Control in MFC CPP Pin
kalyani.homkar20-Nov-13 23:59
kalyani.homkar20-Nov-13 23:59 
AnswerRe: Transparent TreeView Control in MFC CPP Pin
kalyani.homkar21-Nov-13 0:05
kalyani.homkar21-Nov-13 0:05 
QuestionSSL CONNECTION Pin
Member 1041375220-Nov-13 20:44
Member 1041375220-Nov-13 20:44 
QuestionRe: SSL CONNECTION Pin
David Crow22-Nov-13 5:58
David Crow22-Nov-13 5:58 
QuestionCDhtmlDialog : With JavaScript calling C++ Pin
Don Guy20-Nov-13 16:02
Don Guy20-Nov-13 16:02 
QuestionStatic Analysis code reqired for C++ Pin
GauranG Shah20-Nov-13 0:59
GauranG Shah20-Nov-13 0:59 
AnswerRe: Static Analysis code reqired for C++ Pin
Chris Losinger20-Nov-13 1:43
professionalChris Losinger20-Nov-13 1:43 
GeneralRe: Static Analysis code reqired for C++ Pin
GauranG Shah20-Nov-13 4:45
GauranG Shah20-Nov-13 4:45 
AnswerRe: Static Analysis code reqired for C++ Pin
Marco Bertschi20-Nov-13 10:13
protectorMarco Bertschi20-Nov-13 10:13 
AnswerRe: Static Analysis code reqired for C++ Pin
Joe Woodbury22-Nov-13 5:37
professionalJoe Woodbury22-Nov-13 5:37 
GeneralRe: Static Analysis code reqired for C++ Pin
Stefan_Lang26-Nov-13 22:51
Stefan_Lang26-Nov-13 22:51 
GeneralRe: Static Analysis code reqired for C++ Pin
Joe Woodbury27-Nov-13 4:19
professionalJoe Woodbury27-Nov-13 4:19 
QuestionCancelWaitableTimer bug when used with socket? Pin
ehaerim17-Nov-13 15:13
ehaerim17-Nov-13 15:13 
AnswerRe: CancelWaitableTimer bug when used with socket? Pin
Orjan Westin19-Nov-13 5:28
professionalOrjan Westin19-Nov-13 5:28 
GeneralRe: CancelWaitableTimer bug when used with socket? Pin
ehaerim19-Nov-13 18:19
ehaerim19-Nov-13 18:19 
> Orjan Westin wrote:
> First of all, what do you mean when you say "fails to stop the timer"?
> Does CancelWaitableTimer return an error, or does the execution stop at CSocket::Connect?
> Details, please.

CancelWaitableTimer(CWT) returns TRUE, but fails to stop the timer activated by SetWaitableTimer(SWT).

You can download the complete source code from ftp://ftp1.investware.net:1250/Temp/WT3.zip

Compiling and running the sample should NEVER raise an ASSERT if CWT works correctly, that is, CWT returning TRUE MUST stop the timer activated by the last SWT.

WTDlg.cpp lines 14-17 show some #define statements.

[1] First simple test case in which no socket is used and CWT returning TRUE works as expected and succeeds in stoping the timer
C#
#define WAITABLETIMER_PERIOD                                (USER_TIMER_MINIMUM * 1)
#define WAITABLETIMER_DUETIME_INITIALLY         (0)

//#define TEST_WITH_SOCKET


[2] Second abnormal test case in which socket is used and CWT returns TRUE, but fails to stop the timer, and therefore ASSERT is triggered.

C#
#define WAITABLETIMER_PERIOD                                (USER_TIMER_MINIMUM * 1)
#define WAITABLETIMER_DUETIME_INITIALLY         (0)

#define TEST_WITH_SOCKET


[3] You can test a variety of cases by modifying the first two #define statements. The most significant factor is the value of 'WAITABLETIMER_PERIDO'.
When it is
- USER_TIMER_MINIMUM * 1, ASSERT is triggered 100%.
- ~ USER_TIMER_MINIMUM * 50, ASSERT is triggered 100% as far as I tested.
- USER_TIMER_MINIMUM * 75, ASSERT is triggered 1~2 times out of 5 executions.
- USER_TIMER_MINIMUM * 100, ASSERT is triggered 1~2 times out of 10 executions.

The less significant but still affecting the result is the value of 'WAITABLETIMER_DUETIME_INITIALLY'.
When it is -1, much lower possibility of ASSERT.

Now, I believe you have all that you can play around.

In conclusion, all I can say is that CWT returning TRUE does not stop the timer immediately, but after the timer is signaled one more time for the following sequences:
- SetWaitableTimer is called with Duration 0 and period USER_TIMER_MINIMUM
- CSocket::Connect or CAsyncSocket::Connect is called
- CancelWaitableTimer is called

If you find out why CWT returning TRUE fails to stop the timer, please let me know.
thx

modified 20-Nov-13 5:43am.

AnswerRe: CancelWaitableTimer bug when used with socket? Pin
Randor 20-Nov-13 7:29
professional Randor 20-Nov-13 7:29 
GeneralRe: CancelWaitableTimer bug when used with socket? Pin
ehaerim20-Nov-13 9:46
ehaerim20-Nov-13 9:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.