|
Hi,
TranslateAccelerator returns only after successful processing of accelerator key commands if the message is window message like WM_PAINT it will not be processed by it,
it has to be further processed by TranslateMessage().
when you read the document you have to complete it atleast understanding the major facts.
please see the quotes from msdn for TranslateAccelerator()
"When TranslateAccelerator returns a nonzero value and the message is translated, the application should not use the TranslateMessage function to process the message again"
|
|
|
|
|
brahmma wrote: How can I do that?
this time, that link[^] is for ya
|
|
|
|
|
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote: How can I do that?
by reading the documentation documentation!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I noted this syntax somewhere. Is it correct ne comments
static UINT UWM_TRAY_CALLBACK =
::RegisterWindowMessage(_T("UWM_TRAY_CALLBACK-")
_T("{6b8c4821-e6a4-11D1-8370-00aa005c0507}"));
Is the below syntax also correct?
static UINT UWM_TRAY_CALLBACK =
::RegisterWindowMessage(_T("UWM_TRAY_CALLBACK-{6b8c4821-e6a4-11D1-8370-00aa005c0507}"))
|
|
|
|
|
tom groezer wrote: static UINT UWM_TRAY_CALLBACK =
::RegisterWindowMessage(_T("UWM_TRAY_CALLBACK-")
_T("{6b8c4821-e6a4-11D1-8370-00aa005c0507}"));
Correct.
tom groezer wrote: static UINT UWM_TRAY_CALLBACK =
::RegisterWindowMessage(_T("UWM_TRAY_CALLBACK-{6b8c4821-e6a4-11D1-8370-00aa005c0507}"))
Wrong, this one is missing a semicolon at the end.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
it reminds once when i was wondering if the following were the same :
CString str =
_T("Hello ")
_T("World!");
CString str =
_T("Hello "
"World!");
|
|
|
|
|
tom groezer wrote: Is the below syntax also correct?
Yes, your declarations are equivalent and produces the same operation.
Select one of them for readability reasons, some people go nuts when a line of code exceeds 80 characters. E.g. I really dislike when people are writing function calls like
nResult = GetResult
(
Param1,
Param2
); Coding horror?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: Coding horror?
Truly! Only rogues write code in that style.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote: Truly! Only rogues write code in that style
Oh, you have no idea. Some people thinks this is part of the coding guidelines... which of course it's not.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: Some people thinks this is part of the coding guidelines... which of course it's not.
How could you ever know?
You certainly don't have time to read those fascist pamphlets, do you?
Failure is not an option - it's built right in.
|
|
|
|
|
jhwurmbach wrote: You certainly don't have time to read those fascist pamphlets, do you?
Oh, but I have to, even though I don't have the time.
It's considered a prerequiste for the assignment and quite seriously this is how it should be.
My problem is fellow programmers that create or believe in myths about coding guidelines that aren't true and refuse to re-read the guidelines.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: Oh, but I have to, even though I don't have the time.
It's considered a prerequiste for the assignment and quite seriously this is how it should be.
In my eyes, all those typing-regulations are constantly getting in your way of doing your job.
Any reasonably experienced programmer has a coding convention which is at least readable by other programmers.
There is no need to have the business-guys define processes for indenting or
writing a for-loop.
Failure is not an option - it's built right in.
|
|
|
|
|
In the end, as long as the compiler is happy, that's all that matters. Each person will say that their style is easiest for them to read and understand. Who are we to argue that? How could you argue with a guy that swears up and down that this makes total sense to him:
int main(int,char*){int x;for(x=0;x<10;x++){printf("%d\n",x);int y=x+1;}return 0;}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: In the end, as long as the compiler is happy, that's all that matters.
If that were all, there would be no need for any coding style.
But there is.
Im am not arguing for no style. I am arguing for a reasonable style-guide. 10 Rules would be enough.
But all coding style documents I know have more than 10 pages!
To me, this looks like idle-looping of management-turned programmers.
Failure is not an option - it's built right in.
|
|
|
|
|
I agree with both you and David.
Yes, there is a need for a coding guideline.
Yes, of course everyone understands code formatted as if they wrote it themselves better.
In my opinion the guideline should help the developer to write more efficient code and less error prone without making it hard for him/her to read his/her own code.
I consider writing good, working, readable and understandable code an art.
A rigorous coding guideline that prohibits me from writing such code becomes an obstacle to me and affects me negatively. E.g the guidelines I must adhere to for the time being is about 210 pages!
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: E.g the guidelines I must adhere to for the time being is about 210 pages!
By chance is your company/department looking to achieve some ISO or SEI compliance?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: By chance is your company/department looking to achieve some ISO or SEI compliance?
I think "they" already got that. Don't know really since I'm here at consultancy basis.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: I consider writing good, working, readable and understandable code an art.
I, and most others here will, agree wholeheartedly.
But todays managers try to form programming into an industry of putting together standarized pieces.
Roger Stoltz wrote: E.g the guidelines I must adhere to for the time being is about 210 pages!
Wow! I would need weeksto read me through that much of paper!
Our guidelines here are 43 pages, and most are only suggestions (with the state "PREFFERED"), and mostly repeating basic "good practice" stuff. (Like "Number 41: Catch more derived exeptions first").
Failure is not an option - it's built right in.
|
|
|
|
|
jhwurmbach wrote: But todays managers try to form programming into an industry of putting together standarized pieces.
Very true.
However, the thought is good from the beginning. But when those pieces don't really fit together or are badly implemented and actually would require a rewrite, nobody wants to hear about it of course.
At that point there's no pride in the work any longer and one has become a code monkey.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
That's because they are paid to the number of lines of code
|
|
|
|
|
Cedric Moonen wrote: That's because they are paid to the number of lines of code
I heard about how authors get paid by the word in US.
But this requires the code to be submitted using GPL (GNU Publish License).
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
hey, sometimes, it's more readable to write so if the function get tons of parameter.
I prefer seeing my parameters on a single screen rather than having to scroll far right...
|
|
|
|
|
toxcct wrote: sometimes, it's more readable to write so if the function get tons of parameter.
True, but at least do something a little more readable:
nResult = GetResult(Param1,
Param2,
Param3,
...);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes, that's exactly how i used to code
|
|
|
|