|
My guess is that the compiler does not yet know what struct st is.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Move the declaration of st from goo.c to goo.h (before the typedef)
|
|
|
|
|
Nemanja Trifunovic wrote: Move the declaration of st from goo.c to goo.h (before the typedef)
I think if I define a struct in .c file, I can only use the struct in the same .c file, and have no walk-around to utilize the struct in other .c file.
If I want to use the struct in multiple .c files, I have to define it in .h file?
regards,
George
|
|
|
|
|
Why not just follow standard way to declare structures ?
In goo.h declare it like,
typedef struct st {
int member;
}t_st;
|
|
|
|
|
What makes "typedef struct {} name" better than just "struct name"?
Last I heard (a long time ago), using typedef for a struct like this is redundant.
I can see that it's cool to use one line to define the type and a variable, but using struct
like
struct name
{
};
defines a type so typedef is redundant (unless you want to define an alias).
I would say that this is the popular way, not the standard way.
Thanks,
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Mark Salsbery wrote: What makes "typedef struct {} name" better than just "struct name"?
I believe typedef is required in C, and is optional in C++.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ahh cool. Thanks!
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
DavidCrow wrote: I believe typedef is required in C, and is optional in C++
actually no. typedef is not required in C, but struct is.
that is, when you declare a structure and you want to declare a variable of that type, you must use the struct keyword :
<font color=blue>struct</font> TMyStruct {
<font color=green>
};
<font color=blue>struct</font> TMyStruct s1; <font color=green>
TMyStruct s2; <font color=green>
so, to get rid of that heavy notation, programmers used to typedef the structs/unions declarations :
<font color=blue>typedef struct</font> TMyStruct {
<font color=green>
} TMyStruct;
<font color=blue>struct</font> TMyStruct s1; <font color=green>
TMyStruct s2; <font color=green>
[Edit (for Mark)]
Note that such an expression :
typedef struct Name {} name; doesn't declare a variable of type name, but defines the synonym name for the type struct Name
to understand it, we can split it :
type definition
|
/------------\
<code>typedef struct Name {} name;</code>
\ /
\------------------/
|
typedef declaration
it's exactly like doing :
struct Name {};
typedef struct Name name;
Notice that a variable cannot be declared in a typedef instruction
[/edit]
|
|
|
|
|
toxcct wrote: actually no. typedef is not required in C, but struct is.
I knew it was something like that. Thanks for the clarification.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
5 for your effort & clarity!
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Hi,
Do you mean the compiling issue I met with dealing with typedef? I do not think so.
BTW: your clarification is cool!
regards,
George
|
|
|
|
|
|
Thanks man!
Mark
now I worry about how much else I've forgotten over the years...
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
I prefer the definition without the typedef .
Steve
|
|
|
|
|
Why moving to .h will work? Could you explain from compiler/linker point of view?
What makes me confused is, why struct name/type is recognized, but its member is not recignized?
regards,
George
|
|
|
|
|
I am wondering from compiler point of view, why if I define struct in .c file, and accessing it from another .c file, there will not be compile error, but if I access the member of the struct from another .c file, there will be compile error?
regards,
George
|
|
|
|
|
hi,
i want to send a mouseclick to a window(hwnd), i tried this with the sendmessage funktion, but not every control work with it, eg. buttons, the quit icon on the right, top side...
know someone what i had to do in this case?
thanks
|
|
|
|
|
Goggelmoggel wrote: but not every control work with it...the quit icon on the right, top side...
Post that window a WM_CLOSE message instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i doesn't want only to close the window. i want to send mouse messages to click some buttons and other controlls.
|
|
|
|
|
Goggelmoggel wrote: i doesn't want only to close the window.
Then why would you want to click "the quit icon on the right, top side?"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Goggelmoggel wrote: i tried this with the sendmessage funktion,
Can you show, what you have tried ?
For buttons you can try sending BM_CLICK message.
|
|
|
|
|
i tried this:
SendMessage (theHwnd, WM_LBUTTONDOWN, /*the constant for lmousekey, i can#t remember*/, MAKELPARAM(y,x));
the "selected" button or controll gets the tab-focus but isn't pressed
|
|
|
|
|
Because you are not remembering that normal buttons activate on the release of a mouse button, not the press. You also need to send it a WM_LBUTTONUP message as well, or directly send a "click" message to the buttn control itself.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
i also tried with WM_LBUTTONDONW, and then a second line with WM_LBUTTONUP but it doesn't works, i don't know why???
|
|
|
|
|
Without seeing any code, I cannot tell you what is going wrong. However, prasad_som responded to your message showing how to trick the button into thinking it has been pressed.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|