Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to Case a UINT

Posted on 1998-12-07
2
Medium Priority
?
342 Views
Last Modified: 2010-04-15
A windoze "C" question

If two different applications register the same message string, the applications return the same message value. The message remains registered until the Windows session ends.
like this ........

UINT NEW_MSG  = RegisterWindowMessage("NEW_BROADCAST_MESSAGE")

And 1 app can broadcast the new message.

PostMessage(HWND_BROADCAST, NEW_MSG,  wParam,  LPARAM lParam);

How does the other app use it's received NEW_MSG when integral constants are required by
CASE: ??????

case WM_COMMAND:
switch(LOWORD (wParam)) {
case NEW_MSG: // ERROR !!!!!!!!!!!
0
Comment
Question by:wayan
2 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 200 total points
ID: 1254914
1. Test again the message not the parameter WPARAM.
2. use an if statement separate from your case statement (you can't test using a case statement for the reason you state, this is limitation of switch/case)

e.g.

LRESULT WndProc( HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam )
{

if ( uMessage == NEW_MSG )
{
/* Do something */
return 0;
}

switch (uMessage)
{
 /* etc */
0
 

Author Comment

by:wayan
ID: 1254915
thanks your answer is 100% right
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question