|
Asking a question that includes the code that fails.
Either that, or the time-honoured tradition of debugging.
|
|
|
|
|
MSDN:
------
If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the return value is nonzero, regardless of the translation.
But I'd like to know if there's any way to determine if TranslateMessage() has produced a WM_CHAR, while recieving a WM_KEYDOWN or not. E.g. pressing <home> key produces no WM_CHAR normally; however TranslateMessage() returns nonzero when recieving it! because it's a WM_KEYDOWN any way ...
Thank you masters!
|
|
|
|
|
You could try simply checking if there is a WM_CHAR message in the message queue or not, since afaik that's what TransateMessage does, it places a WM_CHAR into the message queue. So you could try using PeekMessage to check on the queue. Of course this is not a fail-safe method because the queue might have had a WM_CHAR in it already. Maybe you could use the "timestamp" of the message to see if it has been placed into the queue by TranslateMessage or not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thank you for reply. I'm gonna take your words.
|
|
|
|
|
i want to know about comport and how it is related with delegates..
can any body help me here..
vikas da
|
|
|
|
|
if you need to access the serial port using C++ then see, for instance, [^]. You may also exploit the Code Project 's article search engine [^].
On the other hand, if you need help on delegates, maybe the C# forum [^] is more appropriate.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
They are completely different things.
It's like asking how a fish is related to space travel. Technically, you could put a tuna on the shuttle, but the two are not related...
What makes you think there may be some relationship? Maybe there is another question hiding under your current one.
Iain.
|
|
|
|
|
Iain Clarke wrote: It's like asking how a fish is related to space travel
Space ships, I suppose.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I shoulda known you'd find the tenuous link!
Fish'n'Chips...
Fission Ships...
OK, now I'm hungry!
Iain.
|
|
|
|
|
Iain Clarke wrote: It's like asking how a fish is related to space travel. Technically, you could put a tuna on the shuttle, but the two are not related...
That's a good one...
|
|
|
|
|
Well, I only have two quotes in Carlo's quote list. I want to dominate, dammit!
Iain.
|
|
|
|
|
Your quote (the one in my sign) already (and still) dominates the list.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi.
In my app I have an button which is owner draw. The strange thing is happening I can't set it's font?
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
MaliFont.CreateFontIndirect(&ncm.lfMessageFont);
m_Graph.SetFont(&MaliFont);
MaliFont is an CFont member variable.
m_Graph is my button.
To be honest Button ctrl is only a base for my graph ctrl I'm displaying. There is no way I can set font using that graph ctrl, I thought I can set it using base class (CButton).
???
|
|
|
|
|
If your button is owner draw then you have to draw it yourself: I suppose it doesn't make sense changing its font via CButton::SetFont .
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi and thanks for yours replay!
My CButton ctrl is owner drown! How do You think I should set/create/draw font?
Thanks again.
|
|
|
|
|
Well, are you getting any errors along the way?
does the ncm block get filled with sensible values?
Is MaliFont getting a good m_hFont?
And (my suspicion) is MaliFont created only on the stack in the member function you are cutting and pasting code from? If so, its destructor will be called, destroying the font before the button control even tries to use it...
Maybe make it a member object of some dialog class that contains the m_Graph object?
Iain.
Edit:
Or C Pallini is correct and you're not using GetFont in your owner draw routines to actually USE the font you set...
|
|
|
|
|
Iain Clarke wrote: Or C Pallini is correct
Do you really doubt about?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, my guess was a possibility too!
I'd have bowed down before your magnificence [*] if I'd seen your post before making mine.
Iain.
[*] Not meant to sound rude.
|
|
|
|
|
Rude? Why rude? It's my title, after all.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks to all for posting.
The answers:
1. I'm not getting any errors, code execute correctly only the font doesn't change!
2. nmc is filled with sensible values.
3. MaliFont is an member variable of my dialog class('OnInitDialog()'), not created in the member function.
Thanks again guys
|
|
|
|
|
In your first post you say this button is owner draw. If so, and you are drawing it yourself, then it is up to *you* to draw with a changed font.
Try turning off the owner draw stuff, and using setfont as previously described. If that works, then the problem is in your owner draw code.
Or maybe you're forgetting to do:
pOldFont = pDC->SelectObject (&MaliFont);
pDC->DrawText (...);
pDC->SelectObject (pOldFont);
(or similar) in your drawing code.
Iain.
|
|
|
|
|
I have complied an application with Visual Studio 2003. It works well with 32 bit os on a 32 bit machine.
But it crashes when run on Vista 32 bit os on a 64 bit machine.
Any clues on how we can debug our application on Vista 32 bit. (As we cannot install Visual Studio 2003 on Vista).
Any help on this is highly appreciated
|
|
|
|
|
Member 3988038 wrote: Any clues on how we can debug our application on Vista 32 bit. (As we cannot install Visual Studio 2003 on Vista).
The problem might be due to UAC. Turn off UAC[^] and try to debug.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Debugging Tools for Windows[^].
This includes WinDbg (which in many ways has a better debugger than VS). Build your app with debug information (either in Release or Debug mode - you can have debug info in either - Release/Debug really implies 'Optimised' or 'Not optimised'!) then run using WinDbg.
The UI is pretty good, having most of the debug & source windows that VS has.
HTH!!
|
|
|
|
|
I am writting idl file for my project. It is not allowing me to use FILETIME. if I include the windows.h , then it gives me the compiling error like:
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(280) : error MIDL2003 : redefinition : INT
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(684) : error MIDL2003 : redefinition : Int64ShllMod32
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(684) : error MIDL2025 : syntax error : expecting ; near "{"
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(686) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
If i am not including windows.h , compiler giving me the error:
1>.\TestRPC.idl(178) : error MIDL2025 : syntax error : expecting a type specification near "FILETIME"
1>.\TestRPC.idl(178) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
can anyone tell me how can i resolve this error ?
Thanks
Vijay_k
|
|
|
|