|
Vaclav_Sal wrote: Could someone kindly explain this MS language to me in plain English?
“Return Value
The result of the message processing; its value depends on the message sent.”
Hi Vaclav,
The SendMessage Function[^] can be used for inter-process/thread communication. What the MSDN article is saying is that the LRESULT value returned from each window message is interpreted differently. For example:
WM_SETCURSOR Message[^] will return TRUE or FALSE.
WM_GETFONT Message[^] will return HANDLE or NULL.
And it is the same for all other messages... You cannot understand what the the LRESULT value means unless you also know what message was sent. (This is essentially what the sentence means)
Best Wishes,
-David Delaune
|
|
|
|
|
That is plain English.
You should realize messages are used for everything in Windows . It is reasonable that return values depend on the sent messages.
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 think perhaps you misunderstand the architecture of Windows. The Windows system is largely based on messages being passed from one process to another. Whether the result comes from a function or not is largely irrelevant, it still depends on the value of the message. The fact that you think this is stupid is neither here nor there; that is the way the system has been defined by Microsoft, and that is how it works.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Richard MacCutchan wrote: The fact that you think this is stupid is neither here nor there; that is the way the system has been defined by Microsoft, and that is how it works.
And it works, indeed.
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]
|
|
|
|
|
Now why were you downvoted for that, I wonder - have a compensatory 5.
[edit]Ah, I see the OP has removed his posts; I guess that was his way of hitting back.[/edit]
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Oh, thank you.
My post was actually quite useless (I just wanted to remark the message mechanism is IMHO simple, powerful, efficient).
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]
|
|
|
|
|
CPallini wrote: My post was actually quite useless
I always find your posts useful; even if they just make me .
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Thank you, Sir.
The Clown of the forum
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]
|
|
|
|
|
Oh, and I thought you were being sarcastic.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
No, I really like such mechanism (on the other hand, there are certain framworks built on the top of it...).
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 guess with the Window's version, I always disliked the lack of type safety and the way it was laid out. I will concede that it is quite a legacy interface in this day and age. Not that anything Microsoft has come up with since then is a lot better.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
It's C . The point is efficiency, 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]
|
|
|
|
|
Yes, but even in C, I like my code pretty. I'd have declared a structure for each message type and just passed a pointer as part of the message. Or even the first field of the structure could have been the message type. Still not C++ type safe but I think more elegant. It would have made interpreting the message a bit easier than remembering which bit went it which parameter and still have pointers to structures occasionally flying by. But then I'm not a computer scientist.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Tim Craig wrote: I'd have declared a structure for each message type
Wow, tons of structs.
Tim Craig wrote: just passed a pointer as part of the message.
Pointers don't always make sense in Windows messages (pointers are process-scope valid).
Moreover, I think it is dangerous to use pointers in every Windows message, if you don't need a pointer, don't use it (don't get me wrong, pointers are useful, but, each time I see a pointer I ask to myself: is it valid? Should I free the memory?).
Tim Craig wrote: But then I'm not a computer scientist.
So I am: I'm just the forum clown...
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]
|
|
|
|
|
CPallini wrote: is it valid?
Bill sent it to you.
CPallini wrote: Should I free the memory?
Pick one and stick to it! But since when has Microsoft been able to stick to anything?
CPallini wrote: I'm just the forum clown
And doing a damn fine job....
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
I don't worry about messages sent by Windows : any application may post and send messages like the operating system does.
Tim Craig wrote:
And doing a damn fine [clown's] job....
I know mate, I know it well.
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 realize that this may not be the ideal message board for this question, but it seemed like the best place, so here it is.
What would be the best way to monitor/log memory & cpu usage for a specific process in the general windows environment? -Thanks
|
|
|
|
|
using WMI classes are good for this purpose eg:- http://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx
But if you like to use API then you have a lot of options:--
One such is PSAPI
Just refer :- http://msdn.microsoft.com/en-us/library/ms681920(VS.85).aspx.
WMI is having high performance, and it has a good extensible event mechanism.
But PSAPI is not a bad option , but it wont support Windows 9X
Величие не Бога может быть недооценена.
|
|
|
|
|
Alan Kurlansky wrote: What would be the best way to monitor/log memory & cpu usage for a specific process in the general windows environment?
Is this a coding question, or just a general Windows question? If the latter, use the Performance Monitor (perfmon.msc).
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hello,
I need to get stack frame of function from any pdb. I got function name and address of certain function, now I need to know all parameters(in/out) of that function from pdb file. Is there any way..??
Regards
Usman
|
|
|
|
|
|
I have hooked taskbar. Below code is the new window procedure for task bar.
But when I tried to send message with valid m_hDlgWnd of my application window. But it is not working.
Is it not possible to send message from this task bar window procedure?
LRESULT CALLBACK NewProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case WM_PAINT:
::SendMessage( m_hDlgWnd, WM_TASKBAR_UPDATED_EVENT,0,0 );
::SetEvent( m_hTaskBarUpdatedEvent );
::MessageBeep( MB_OK );
break;
}
return CallWindowProc( OldProc,hwnd,uMsg,wParam,lParam );
}
-Cvaji
|
|
|
|
|
After finding the window again, it is worked.
case WM_PAINT:
{
m_hDlgWnd = ::FindWindow( NULL, "HackTaskBar" );
::SendMessage( m_hDlgWnd, WM_TASKBAR_UPDATED_EVENT,0,0 );
::MessageBeep( MB_OK );
break;
}
|
|
|
|
|
Just be carefull with SendMessage, you can run into deadlocks (i'm not saying you will), if the timing isn't that important for what you need, i recommend using PostMessage instead...
[edit] I mean if you use SendMessage between different threads/processes...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
modified on Tuesday, March 30, 2010 12:05 PM
|
|
|
|