LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Does a popup panel receive wnd messages?

hello,
 
I create a child window on a CVI panel, first register a new wnd class
 

//register class

cls.cbSize = sizeof(WNDCLASSEX);

cls.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;

cls.lpfnWndProc = ((WNDPROC)WIN_PROCESS_CALIBRATION);

cls.cbClsExtra = 0;

cls.cbWndExtra = 0;

cls.hInstance = getInstanceHandle();

cls.hIcon = NULL;

cls.hCursor = LoadCursor(getCameraPtr()->getInstanceHandle(), IDC_CROSS);

cls.hbrBackground = NULL;

cls.lpszMenuName = (LPCSTR)NULL;

cls.lpszClassName = "A name";

cls.hIconSm = NULL;

atomClass = RegisterClassEx(&cls);

and then put the child window on a cvi panel:

GetPanelAttribute(m_iPanel, ATTR_SYSTEM_WINDOW_HANDLE, &hWnd);

m_hDisplayArea = CreateWindow("A name", WS_CHILD|WS_VISIBLE,  iLeft, iTop, iWidth, iHeight, hWnd, NULL, NULL, NULL);

of course I have a static function for the child window message processing:

LRESULT CALLBACK WIN_PROCESS_CALIBRATION(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)

{

PAINTSTRUCT ps;

HDC hdc;

switch (message)

{

case WM_COMMAND:

break;

case WM_PAINT:

hdc = BeginPaint(hWnd, &ps);

// TODO: Add any drawing code here...

EndPaint(hWnd, &ps);

break;

case WM_DESTROY:

break;

default:

return DefWindowProc(hWnd, message, wParam, lParam);

}

return 0;

}

then I display parent panel and the child window: DisplayPanel(m_iPanel), OK, works! child window receicve message and you can fill in code under //todo line to show what you want on the child window.

then I change another way to show panel, InstallPopup(m_iPanel). failed! child window processing function WIN_PROCESS_CALIBRATION is never be visited!

who can tell me how to solve the problem while I really need a modal dialog.

thanks advance!

0 Kudos
Message 1 of 3
(3,034 Views)
One thing you should know is that the CVI User Interface Library sometimes destroys and re-creates the underlying hwnd's of its panels when certain actions take place. One of those times is when the modality of a panel changes, which happens when you call the InstallPopup function. Therefore, you should wait until calling InstallPopup before you get the hwnd from the CVI panel.
 
If you need to do the customized drawing both before and after the call to InstallPopup, then you will need to create your window twice. Do you receive a WM_DESTROY message from inside the call to InstallPopup? You could put code under that message that will recreate your window, and this way you should be able to handle those times when CVI changes windows on you.
 
Keep in mind that the CVI UI Library was not written to be compatible with general purpose win32 programming that modify its panels. So every time you do something like this it's a bit of an adventure. It might work, or it might not...
 
Luis
NI
0 Kudos
Message 2 of 3
(3,023 Views)

thanks!

it does work!!

0 Kudos
Message 3 of 3
(3,005 Views)