|
As the subject says,
I'm building a virtual keyboard on a WINCE 5.0 device.
I'm stuck with the function keys (CTRL,SHIFT,CAPS,ALT).
I know that I gotta change some flags, but how?
I have tried SendVirtualKey(VK_CAPITAL,KeyShiftCapitalFlag); // doesn't work
and also SendVirtualKey (VK_CAPITAL,KEYEVENTF_KEYUP) // doesn't work
and also SendVirtualKey (KeyShiftCapitalFlag,KEYEVENTF_KEYUP) doesn't work
Any suggestions?
Thank you!
|
|
|
|
|
hi,
how to use multi column combo box in a dialog? how can add strings into the multi column combo box. actually i was used this code
m_ComboBoxControl1.AddRow(ColumnString0, ColumnString1);
but it was not functioning.
can you please help me
Thanks,
Panthal
|
|
|
|
|
Forgive my ignorance....what multi-column combobox?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: what multi-column combobox?
...looks around cautiously...
Psst, Mark. It's the one over there.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hmm...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone,
I can not understand how the following code works and assign 100 to counter variable?
void Foo (int* input)
{
*input = 100;
return;
}
#define GETFOO (Foo( &counter ), counter)
int counter;
int main()
{
GETFOO;
return 0;
}
thanks in advance,
George
|
|
|
|
|
the macro expands to
(Foo( &counter ), counter);
on running:
Foo(&counter) is first evaluated and it sets counter=100 , then counter is evaluated giving the result 100 to the expression inside the outer braces, finally the result itself it is discarded.
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.
|
|
|
|
|
Thanks CPallini,
I do not understand how this statement works,
(Foo( &counter ), counter);
I have tested that the simple statement (without comment) also works. What is the benefit and function to add , and counter in macro definition?
// #define GETFOO Foo((&counter), counter)
#define GETFOO Foo(&counter)
regards,
George
|
|
|
|
|
George_George wrote: I do not understand how this statement works,
(Foo( &counter ), counter);
Both I and toxcct gave an answer to the above.
George_George wrote: I have tested that the simple statement (without comment) also works.
Of course.
George_George wrote: What is the benefit and function to add , and counter in macro definition?
The difference stands in the returned value of the expression, for instance
void Foo (int* input)
{
*input = 100;
return;
}
#define GETFOO (Foo( &counter ), counter)
void main()
{
int i = GETFOO;
}
will assign 100 to i .
Anyway that way of coding is simply junk.
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.
|
|
|
|
|
Cool CPallini,
Thanks!
regards,
George
|
|
|
|
|
I gave you 5 everywhere in this thread, so did I to Iian.
answering George_george deserve courage and patience !!!
|
|
|
|
|
|
CPallini wrote: OMG, definitely you aren't my friend!
please tell me this is a joke hey !
CPallini wrote: Only 5?
i am negociating with the site administrators to leverage the votes on G_G thread up to at least 10 ! lol
BTW, please do the same to me
let's get stronger again that kid.
|
|
|
|
|
toxcct wrote: BTW, please do the same to me
Done buddy!
But you understand that it cannot be our voting guideline unless we want to be hounded out CP for violating the Competition Law.
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.
|
|
|
|
|
hey, we're not enforcing anything. we're just reacting to G_G voting bad habit.
we're all good guyz here, so what's bad in this ?! lol.
|
|
|
|
|
the , operator returns the last of its statements.
here, the macro calls the Foo function, to which the counter variable is passes by pointer (so, the counter variable is modified from within the Foo() function, but its modifications are still visible from the caller).
then, the counter variable is return (and as there is no = operator in the instruction GETFOO; , the returned value is not used, but still the counter variable is assigned with 100.
writing GETFOO; here is as if you were doing Foo(&counter);
BTW, this is very awful coding, and you should never use such macros !
and to finish, a question: how old are you ?
modified on Wednesday, December 12, 2007 8:01:42 AM
|
|
|
|
|
Thanks toxcct,
I do not agree with your answer. What do you mean class Foo? I am not using any object related concepts and techniques. It is pure C code.
regards,
George
|
|
|
|
|
George_George wrote: I do not agree with your answer
don't say you don't agree, just say you don't understand.
now,
1) my answer was plainly explaining what the macro was doing, i just confused class with function, but the bahavior is the same,
3) my post deserves more than what you gave it,
4) you didn't answer my F*CKING QUESTION,
5) ...
|
|
|
|
|
He didn't answer your question so you should vote him a 2 or 1
|
|
|
|
|
totally right. all fixed Sir.
|
|
|
|
|
Thanks toxcct,
Cool!
regards,
George
|
|
|
|
|
George_George wrote: Thanks toxcct,
about what ?
|
|
|
|
|
This is an odd macro, but I presume it makes more sense in the context you're copying it from. (after all, if you wrote it yourself, you'd know what it does.
It may make more sense if main was like this
main ()
{
int q = GETFOO;
return 0;
}
instead.
That is expanded to...
int q = Foo(&counter), counter;
So, the function Foo is called, does it's magic, and places a result into counter.
Then the second half of the right hand expression is called, which is simply counter, so counter is then placed into q .
It's equivalent to:
int q;
Foo (&counter);
q = counter;
The comma operator is a bit odd and will take some reading.
The main place I see it is in for loops:
for (a = 0, b = 7; a < 9; a++, b++)
{
...
}
while allows you to combine a bunch of expressions between the ;'s.
I hope that makes some sense.
While you're asking us all the horrible questions in C, I can't recommend strongly enough The C Programming Language[^] by Kernighan & Ritchie.
Iain.
|
|
|
|
|
Iain Clarke wrote: The main place I see it is in for loops:
for (a = 0, b = 7; a < 9; a++, b++)
{
...
}
I saw it also in the following kind of stuff
int i,j,k;
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.
|
|
|
|
|
Thanks CPallini,
My question is,
I think using in my sample,
#define GETFOO (Foo( &counter ), counter)
is the same as
#define GETFOO Foo( &counter )
So, no benefits of using , operator, right?
regards,
George
|
|
|
|
|