|
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
|
|
|
|
|
Goggelmoggel wrote: i tried this:
SendMessage (theHwnd, WM_LBUTTONDOWN, /*the constant for lmousekey, i can#t remember*/, MAKELPARAM(y,x));
Either of this will work in case of button,
::SendMessage(hOwnerWnd,WM_COMMAND,MAKELONG(IDOK,BN_CLICKED),0);
::SendMessage(hButton,BM_CLICK,0,0);
Watch handles need to pass for SendMessage .
|
|
|
|
|
but i want to referece the button or anything else, on any possition x,y in window?!
only this, an nothing more
|
|
|
|
|
Sending WM_LBUTTONDOWN to parent window will not work here, as parent window will receive this message, which does not effect in clicking the control.
You need to identify window from a particular point, then send WM_LBUTTONDOWN and WM_LBUTTONUP messages in sequnce to simulate click. Using X,Y values you have mentioned get window at that point using WindowFromPoint send messages mentioned above.
Use code smething like this,
const long nClickingPoint= 5;
POINT pt;
pt.x = x + nClickingPoint;
pt.y = y + nClickingPoint;
CWnd * pCtrl = WindowFromPoint(pt);
pCtrl->SendMessage(WM_LBUTTONDOWN,0,MAKELPARAM((nClickingPoint),(nClickingPoint)));
pCtrl->SendMessage(WM_LBUTTONUP,0,MAKELPARAM((nClickingPoint),(nClickingPoint)));
Remember, WindowFromPoint requires screen co-ordinates to identify window. Use ClientToScreen appropriately for that.
|
|
|
|
|
I've nearly got everything working in my bit of code but I want control over what Request headers I send. I can add Request headers via WinHttpAddRequestHeaders() but for whatever reason I cannot get rid of one Request header. I would like the "Connection: Close" header to just never exist (ie remove it completely) in the HTTP stream that I send. To this effect I thought the following bit of code would work
WinHttpAddRequestHeaders(hRequest, L"Connection: Close", -1L, WINHTTP_ADDREQ_FLAG_REPLACE);
I tried many variations of just "Connection" or "Connection: " etc and none of them seem to get rid of the "Connection" Request header. I think I did a decode of the error and it says the header does not exist. However when I fire up my packet capture program sure enough it's there.
Any help or pointer to what I'm misunderstanding would be greatley appreciated. I trawled this site and the net and couldn't find anything.
PS: I had no such problem with this using CInternetSession etc in my old version of the code but unfortunately I need control over timeouts and retries etc and these functions have had it broken so I resorted to winhttp hoping for something better.
Cheers
Jbem
|
|
|
|
|
Meh, for the record I've convince myself that there is no way to remove the "Connection" request header in winhttp since I can remove any other header so it seems the winhttp forces this header to exist whether you like it or not. Damn stupid but what can you do. Going to port over to winiinet (3rd times a charm) which I think doesn't have this braindamaged idea that it knows better than I what I want.
|
|
|
|
|
how to create tab control with one dialog for all tabs.
|
|
|
|
|
The same way you would if you used a different dialog for each tab/page. Why would you want to this, though? Having a multi-page property sheet where all of the pages are the same seems odd.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|