Solved

how to Case a UINT

Posted on 1998-12-07
2
332 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 50 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files 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.

821 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