|
-
Aug 27th, 2000, 08:11 AM
#1
Hi,
I have two components which share a common class, and I want to use SendMessage to allow this class the communicate with the components.
How would I go about creating a message which I know is not being used by the system. For example, is there a limit on the default messages (a bit like the vbObjectError constant). Or can Windows itself assign me a free message id?
Thanks;
-
Aug 27th, 2000, 09:48 AM
#2
Extracted from MSDN Library:
Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.
Message numbers in the third range (WM_APP through 0xBFFF) are available for application to use as private messages. Message in this range do not conflict with system messages.
I would go with WM_APP + n instead of WM_USER + n.
The WM_APP constant has the value &H8000.
You can also use the RegisterWindowMessage API function to get a message that is guaranteed to be unique throughout the system.
-
Aug 27th, 2000, 12:33 PM
#3
Another solution to a not-so-easy question! I'm impressed!
I have just tested using the RegisterWindowMessage function, and this works fine.
Thanks!
-
Aug 30th, 2000, 12:23 PM
#4
WM_APP?
Joacim,
Here's an interesting problem under Windows 2000:
If I send a message to my window using a message defined via WM_APP + xxx, the message does not arrive.
However, if I send a message created using the RegisterWindowMessage API, everything works fine.
The WM_APP messages work fine on Windows 98.
Does NT not like negative messages or something?
Strange!
-
Aug 31st, 2000, 02:39 AM
#5
You should store the message in a Long and not an Integer.
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
|