Надо делать так:
IAsyncResult ar = BeginInvoke(new Action(() =>{StartDDE();}));
public StartDDE()
{
IntPtr quikWindow = FindQuikWindow();
IntPtr mainMenu = GetMenu(quikWindow);
uint serviceMenuIndex = FindMenuItemByPart(mainMenu, "С&ервисы");
IntPtr serviceMenu = GetSubMenu(mainMenu, (int)serviceMenuIndex);
int exportMenuIndex = (int)FindMenuItemByPart7(serviceMenu, "&Экспорт/импорт данных");
IntPtr exportMenu = GetSubMenu(serviceMenu, exportMenuIndex);
int menuItem = (int)GetMenuItemID(exportMenu, 2);
PostMessage(quikWindow, 0x111, (IntPtr)menuItem, (IntPtr)0);
}
Тогда вылетать ничего не будет и можно бегать по меню и подменю!!!
IAsyncResult ar = BeginInvoke(new Action(() =>{StartDDE();}));
public StartDDE()
{
IntPtr quikWindow = FindQuikWindow();
IntPtr mainMenu = GetMenu(quikWindow);
uint serviceMenuIndex = FindMenuItemByPart(mainMenu, "С&ервисы");
IntPtr serviceMenu = GetSubMenu(mainMenu, (int)serviceMenuIndex);
int exportMenuIndex = (int)FindMenuItemByPart7(serviceMenu, "&Экспорт/импорт данных");
IntPtr exportMenu = GetSubMenu(serviceMenu, exportMenuIndex);
int menuItem = (int)GetMenuItemID(exportMenu, 2);
PostMessage(quikWindow, 0x111, (IntPtr)menuItem, (IntPtr)0);
}
Тогда вылетать ничего не будет и можно бегать по меню и подменю!!!