Hi,
I am trying to access submenu of a menu of a window using win32api .I even tried using win32api in 'c' programming. In both attempts I was not successful. The details are - There is an application which starts three processes when we create process with the main application(*.exe). All the three processes have three main windows. Through program I am trying to access one of the three windows using findwindow (window title) and I am able to get that window handle. Through this window handle I am able to get menu handle. But after this I am not able to get submenu count /item. This is happening to only one window(of one process). The main menu count is coming correct in both python program and 'c' program. But submenu count/items are coming as 0 in both programs though the main menu items are having submenu's. This is not happening with other two windows of processes which are opened simultaneously. All these processes are MDI applications. I am wondering is this menu is of different type ? If so how I can find this type using win32api and how can I access submenu? If the menu is different how it is attached to the main window where in the Microsoft spy tool is giving exactly the same menu handle for this window as what I am getting through program. If we open the application manually and access the menu and submenu it behaves same as any other window applications. I am sending here the c code for review and because of size limit I am not able to send python code . Any help in this regard is highly is appreciated. --------------------------------------------------C program-------------------------------------- #include <windows.h> #include <stdio.h> #include <winuser.h> void main() { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); char* p = "C:\\Program Files\\Citect\\CitectSCADA\\Bin\\CTEXPLOR.EXE"; // Start the child process. if( !CreateProcess(p, // No module name (use command line) NULL, // Command line NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE 0, // No creation flags NULL, // Use parent's environment block NULL, // Use parent's starting directory &si, // Pointer to STARTUPINFO structure &pi ) // Pointer to PROCESS_INFORMATION structure ) { printf( "CreateProcess failed (%d)\n", GetLastError() ); return; } Sleep(1000); HWND hWnd; hWnd = FindWindow(NULL,"Citect Graphics Builder"); HMENU hMenu = GetMenu(hWnd); int menuItems = GetMenuItemCount(hMenu); /*GetSystemMenu */ MENUITEMINFO mi; ZeroMemory( &mi, sizeof(mi) ); mi.cbSize = sizeof(mi); mi.fMask = MIIM_SUBMENU|MIIM_DATA|MIIM_TYPE; mi.fType = MFT_STRING ; /*printf("MenuItems: %d", menuItems);*/ GetMenuItemInfo(hMenu,0,TRUE,&mi); for (int i=0;i<menuItems;i++) { HMENU hSubMenu = GetSubMenu(hMenu,i); int count = GetMenuItemCount(hSubMenu); printf("%d",count); } // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread );*/ return; } Regards, Madhubala
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32