|
To get any kind of help, please post what are all things you've tried or where you stuck with code/logic.
|
|
|
|
|
A Dialog based MFC program, I want to display data on the dialog control.
Situation like:
a general C++ class D,
a dialog class ADlg :CDialog
{
D dObj;
showSth() { drawText(); }
}
now dObj.showResult() {
UINT32 result = XXXYYY;
if ( result == XXXYYYY )
showResultInDialog(result);
}
How can I transfer data to dialog object to display it?
|
|
|
|
|
|
|
It depends on what your control actually is (the one that you want to display some data on)... a dialog isn't a control, it's a window. A control would be, for example, an edit box.
|
|
|
|
|
I am writing code on an ARM920 platform, the demo program supplied by vendor is a dialog-based MFC program, running on Windows CE.
Now I need to add more functions to the program,but some functions are not related to the dialog, for example, serial communication module.
I think I can create a new class, like class SerialCom{ } ;
and instantiated it in Dlg class.
I also can just write some C style functions as global functions, and called them in Dlg.function.
I wonder which way has a better efficiency, in space and time.
|
|
|
|
|
Don't worry about performance: since you are using the serial port for communicating with the microcontroller then your application execution time is, in any case, dominated by the I/O operations.
In any case MFC , at this level (that is simple GUI stuff), is about as efficient as the raw C WINAPI code.
Veni, vidi, vici.
|
|
|
|
|
Hi,
v is an array;
in v[f(x)]+=j; will f(x) be evaluated once or twice (one for reading and one for writing)?
I guess once (at least due to optimization) but I'd like to know if C language ensures that it will be once and not twice.
Thanks
Tom
|
|
|
|
|
A good question, and one that yould be tricky to answer under different circumstances*. But for your purposes it's safe to answer that any of the compound assignment statements evaluate the adress of the modified value just once!
*: it would be tricky indeed if f() could modify v !
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I'm inclined to think that it took you longer to type your question than it would have to just compile that piece of code and find out.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I must write portable code (x86, ARM etc.....) and I was interested in understanding what C rules exactly say.
|
|
|
|
|
It's going to depend on the particular compiler's implementation (of sequence points).
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 21-Feb-14 9:19am.
|
|
|
|
|
|
Perhaps, I found out the right answer, form the C99 standard, about compound ass.:
Semantics
3 A compound assignment of the form E1 op= E2 differs from the simple assignment expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once.
So E1 is evaluated ONCE
|
|
|
|
|
No that isn't what that means.
E1 appears on both side of the equals. It is referring to whether E1 is evaluated once for the lvalue side and once for the rvalue side. And it says no.
|
|
|
|
|
Dear all:
I want to implement a application, when I touch the pannel, the application will play sound globally.
I use hook(WH_MOUSE_LL) and WM_LBUTTONDOWN to process the touch and PlaySound to play wav.
The Question is :
when I touch the pannel, it does not play. if I touch and leave fast, it will play.
How do I solve this problem?
Thank for your help .Victor
|
|
|
|
|
|
Dear Randor:
My application function must be have:
1.When I touch anywhere, even not on my app(ex:desktop, other application, extc...), it will play sound.
so I must be use hook, I did not find anything about hook with touch.
Does anything else to implement this application
Thank for your help, Victor
|
|
|
|
|
Hi,
cedricvictor wrote: Does anything else to implement this applicati
Microsoft recommends that you use a HID filter driver for something like this. You might be able to hack something together with a WH_GETMESSAGE hook.
I will now go and answer your original question.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
cedricvictor wrote: when I touch the pannel, it does not play. if I touch and leave fast, it will play.
When you use the touch screen and 'HOLD down' the touch driver may interpret this as a right click. If the application did not register itself as being 'compatible with touch' a WM_RBUTTONDOWN followed by a WM_RBUTTONUP would be injected into the input stream.
Best Wishes,
-David Delaune
|
|
|
|
|
Dear Randor:
I think you are right. It is different between touch and mouse.
when left mouse button down, it will play sound.
when I touch the panel, and leave fast, it will play or touch the panel, and then move my finger on panel, it will play sound, too.
Thank for your help, Victor.
|
|
|
|
|
This is puzzling me.
I can add menu item with system generated and #define(d) ID and the menu text will be grayed out until I add a function to process the ON_COMMAND macro.
However, I have a static DLL which has just the #define(s) IDs and if I use the ID in MFC
OnCommand function ( WPARAM) – in case switch – the menu will be active.
The way it looks – if the ID is defined in DLL the menu is OK, but if “locally” it needs the function in ON_COMMAND macro and than the OnCommand function is not used.
If this is normal , OK
Thanks for your time.
Cheers
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: I have a static DLL That's a static dynamic link library.
|
|
|
|
|
Ok, nice catch and just for you - "Win32 Static Libray".
Now back to OP.
|
|
|
|
|
Vaclav_Sal wrote: and just for you No, it's for everyone, because there are important and fundamental differences in how a static library and a DLL are connected to the executable. And that affects how your problem occurs and how it may be resolved.
|
|
|
|