|
-
Jan 27th, 2002, 11:32 AM
#1
For the user-defined message simply do
#define WM_MYMESSAGE WM_USER + [offset]
replace [offset] by any number > 0 you want.
For MFC:
Add the ON_MESSAGE macro to the message map like this:
Code:
// example for ON_MESSAGE
#define WM_MYMESSAGE (WM_USER + 1)
BEGIN_MESSAGE_MAP( CMyWnd, CMyParentWndClass )
//{{AFX_MSG_MAP( CMyWnd
ON_MESSAGE( WM_MYMESSAGE, OnMyMessage )
// ... Possibly more entries to handle additional messages
//}}AFX_MSG_MAP
END_MESSAGE_MAP( )
OnMyMessage is the message handler function. It must have this prototype:
afx_msg LRESULT OnMyMessage(WPARAM, LPARAM);
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 28th, 2002, 12:10 PM
#2
Lively Member
how can I put the value of WPARAM of LPARAM in a textbox?
VisualPenguin
-
Jan 28th, 2002, 01:08 PM
#3
What do those values represent?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 29th, 2002, 07:09 AM
#4
Lively Member
you said they had to be there, so I've put them there. There has to be a variable that contains the number so I know if someone clicked the icon. In VB these variables are long.
VisualPenguin
-
Jan 29th, 2002, 08:37 AM
#5
Yes, I know. The first one is a 32-bit unsigned integer and the second one a 32-bit signed integer. But I can't find what they represent. (One must be some flag what happened: mouse click, move, up, down etc)
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 29th, 2002, 11:06 AM
#6
Frenzied Member
I know what the lParam can represent. Here is some sample code from my Systray code. It is not MFC though.
PHP Code:
case WM_TRAYNOTIFY: //Used For The Systray Msgs
{
switch(LOWORD(lParam))
{
case WM_LBUTTONDBLCLK: //If Double Click On The Icon
{
BOOL ret;
ret = IsWindowVisible(m_hWnd); //Is Window Already Visable
if(ret)
{
if(m_hWnd_Options != 0x00000000) //If It Is Set Focus To It
SetFocus(m_hWnd);
}
else
{
ShowWindow(m_hWnd,SW_SHOW); //Else Show The Main Window
ShowWindow(m_hWnd_Msg,SW_SHOW); //So The Message List Window
}
break;
} //WM_LBUTTONDBLCLK
case WM_RBUTTONUP: //If A Right Click On The Systray Icon
{
m_SysTray.ShowMenu(); //Show The Systray Menu
break;
} //WM_RBUTTONUP
default:
break;
}
break;
} //WM_TRAYNOTIFY
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jan 29th, 2002, 04:29 PM
#7
That would work for MFC too, except for the action taken.
Code:
// in message map
ON_MESSAGE(WM_TRAYNOTIFY, OnTrayNotify)
// function
LRESULT CMyWnd::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
switch(LOWORD(lParam))
{
case WM_LBUTTONDBLCLK:
if(IsWindowVisible())
{
SetFocus();
}
else
{
ShowWindow(SW_SHOW);
m_wndMsg.ShowWindow(SW_SHOW);
}
// ...
}
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|