Please help with Menu Capture, thank you.
-
Hi, I am trying the following code to enumerate child windows of Start Menu. However, it doesn't seem to work. Could you take a look and tell me what I did wrong or is there another way to do it. Thank you very much. RECT rcMenu; BOOL CaptureMenuToClipboard(BOOL fIncMouseCursor, BOOL fIncMenuBar) { /*BOOL bSuccess = FALSE; POINT ptStartMenu; ptStartMenu.x = 1; ptStartMenu.y = 1; HWND hStartMenu; HWND hShellTrayWindow = FindWindow("Shell_TrayWnd", NULL); hStartMenu = ChildWindowFromPoint(hShellTrayWindow, ptStartMenu); if (EnumChildWindows(hStartMenu, (WNDENUMPROC)EnumChildProc, NULL)) bSuccess = TRUE; if (bSuccess) { if (!CopyScreenToClipboard(NULL, &rcMenu, fIncMouseCursor)) bSuccess = FALSE; } return bSuccess;*/ } BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) { BOOL bFlag = FALSE; if (GetWindowRect(hwnd, &rcMenu)) bFlag = TRUE; return bFlag; } :) ;) ;) ;) :-D
-
Hi, I am trying the following code to enumerate child windows of Start Menu. However, it doesn't seem to work. Could you take a look and tell me what I did wrong or is there another way to do it. Thank you very much. RECT rcMenu; BOOL CaptureMenuToClipboard(BOOL fIncMouseCursor, BOOL fIncMenuBar) { /*BOOL bSuccess = FALSE; POINT ptStartMenu; ptStartMenu.x = 1; ptStartMenu.y = 1; HWND hStartMenu; HWND hShellTrayWindow = FindWindow("Shell_TrayWnd", NULL); hStartMenu = ChildWindowFromPoint(hShellTrayWindow, ptStartMenu); if (EnumChildWindows(hStartMenu, (WNDENUMPROC)EnumChildProc, NULL)) bSuccess = TRUE; if (bSuccess) { if (!CopyScreenToClipboard(NULL, &rcMenu, fIncMouseCursor)) bSuccess = FALSE; } return bSuccess;*/ } BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) { BOOL bFlag = FALSE; if (GetWindowRect(hwnd, &rcMenu)) bFlag = TRUE; return bFlag; } :) ;) ;) ;) :-D
What do you mean by "enumerate child windows of Start Menu"? the start menu button does not have any child windows, unless you mean the menu, but it will not exist until you depress the start menu button(though its probably cached somewhere). -Ben --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)