Solved

how to Case a UINT

Posted on 1998-12-07
2
327 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
Comment Utility
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
Comment Utility
thanks your answer is 100% right
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now