Admin Production ni-theme
Current Publication

SetRoutedWinMsgResult

LabWindows/CVI

SetRoutedWinMsgResult

int SetRoutedWinMsgResult (int panelHandle, int result);

Purpose

When the panel receives the Windows message you specify, it calls the panel callback with an event value of EVENT_WINDOWS_MSG.

Call this function to specify the result of processing the message. The value to return is specific to the message that you process and you must consult the documentation for the specific message in order to determine which value to return.

The value that you specify in this function is used only if you return 1 from the callback that receives the event.

Example Code

int PanelCallback(int panel, int event, void *callbackData, int eventData1, int eventData2)
{
switch (event)

{
case EVENT_WINDOWS_MSG:

{
InterceptedWindowsMsg msg;

GetRoutedWinMsgParams (panel, &msg);

// Check for application activate via a Windows message
// because the top level panel does not get the CVI
// EVENT_GOT_FOCUS event if one of its child panels
// has the focus when it is activated
if ((msg.Msg == WM_MOVE) && msg.wParam)

{
// application was activated, put your code here

// for this particular message, return 0 to indicate
// that the message was processed
SetRoutedWinMsgResult (panel, 0);
return 1; // do not process this message any further
}

}

break;
}

return 0;

}

For backwards compatibility in 32-bit programs, LabWindows/CVI also passes a pointer to the message parameters as the eventData1 parameter of the panel callback function, which you can use to modify the result field of the message parameters. In 64-bit programs, however, eventData1 is 0, and you must use this function to specify a message result.

(Linux) This function is not supported.

Parameters

Input
Name Type Description
panelHandle int The specifier for a particular top–level panel that is currently in memory.

This handle will have been returned by the LoadPanel, NewPanel, or DuplicatePanel function.
result int Pass the value that you want to return to Windows after processing the message.

Example Code

int PanelCallback(int panel, int event, void *callbackData, int eventData1, int eventData2)
{
switch (event)

{
case EVENT_WINDOWS_MSG:

{
InterceptedWindowsMsg msg;

GetRoutedWinMsgParams (panel, &msg);

// Check for application activate via a Windows message
// because the top level panel does not get the CVI
// EVENT_GOT_FOCUS event if one of its child panels
// has the focus when it is activated
if ((msg.uMsg == WM_MOVE) && msgwParam)

{
// application was activated, put your code here

// for this particular message, return 0 to indicate
// that the message was processed
SetRoutedWinMsgResult (panel, 0);
return 1; // do not process this message any further
}

}

break;
}

return 0;

}

Return Value

Name Type Description
status int The status code that the function returns.

0 indicates success.

A negative value indicates an error.

This function may return a Programmer's Toolbox or UI Library error code. Call GetGeneralErrorString to obtain a text description of the error.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 2009 and later