NX二次开发 UFUN自动切换到制图模块::PostMessage
//VS8.0+VS2010
#include <uf.h>
#include <uf_ui.h>
#include <uf_mb.h>
#include <afx.h>
UF_initialize();
int button_id = 0, module_id = 0;
HWND ugHwnd = NULL;
UF_ask_application_module(&module_id);
if (module_id != UF_APP_DRAFTING)
{
ugHwnd = (HWND)UF_UI_get_default_parent();
UF_MB_ask_button_id("UG_APP_DRAFTING", &button_id);//获得UG_APP_DRAFTING命令按钮id
if (button_id != 0)
{
::PostMessage(ugHwnd, WM_COMMAND, button_id, 0);//按下按钮
}
}
UF_terminate();