Hello,
After reading the post Ctrl - Alt Keypress, I wrote a program as below:
int panelHandle = 0; WNDPROC currentWndProc = 0; int main (int argc, char *argv[]) { ............ panelHandle = LoadPanel (0, "test.uir", test); InstallMainCallback (EventFunc, NULL, 0); InstallParentWndProc (); ............ }
int CVICALLBACK EventFunc (int panelOrMenuBarHandle, int controlOrMenuItemID, int event, void *callbackData, int eventData1, int eventData2) { ............ if (event == EVENT_KEYPRESS) { ...........//codes trying to catch Ctrl+C/V keyevents and do sth. } ............ }
LRESULT CALLBACK ChainedParentWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_KEYDOWN: if ((GetKeyState (VK_CONTROL) & 0x8000) && (wParam == 'C')) { break;//can catch Ctrl+C here } else if ((GetKeyState (VK_CONTROL) & 0x8000) && (wParam == 'V')) { break;//can catch Ctrl+V here } default: return (CallWindowProc (currentWndProc, hwnd, message, wParam, lParam)); } retrun FALSE;//or DefWindowProc//or CallWindowProc//doesn't make sense }
int InstallParentWndProc () { intptr_t PanelWindowHandle; ............ GetPanelAttribute (panelHandle, ATTR_SYSTEM_WINDOW_HANDLE, &PanelWindowHandle); currentWndProc = (WNDPROC)GetWindowLongPtr ((HWND)PanelWindowHandle, GWLP_WNDPROC); SetWindowLongPtr ((HWND)PanelWindowHandle, GWLP_WNDPROC, (LONG_PTR)ChainedParentWndProc); ............ }
Question is, I want to handle “Ctrl+C/V" keyevents in EventFunc so that I can get infos about both panels and control IDs, and do some own operations. I have run the codes and only ChainedParentWndProc can catch the keys. Is there any way passing special keyevents to CVI MainCallback?
Besides, can CVI swallow copy/paste operations?
Any suggestion is welcome and helpful, thanks.
Yours Fu.