11
Mach SDK plugin questions and answers. / Error Trigged when adding Menu in myPostInitControl() function
« on: May 10, 2011, 05:01:22 PM »
Hello,
I've try to add a menu whith the code below in myPostInitControl :
{
CFrameWnd *MachFrame = MachView->MachFrame; //Prblem here -> MachFrame = 0x00000
CMenu *menu = MachFrame->GetMenu();
HMENU hSubmenu = CreatePopupMenu();
int pos = FindMenuItem3(menu,"PlugIn Control");
//here we can add menu items to MAch3's menu..
int x = pos;
HMENU control = GetSubMenu( menu->m_hMenu, pos);
InsertMenu ( control, -1, MF_BYPOSITION, RangeStart , _T("kk") );
MachFrame->DrawMenuBar();*/
}
Compling is OK but when I start mach3, I've gort a error triged . After debugging the dll, I saw that MachFrame is equal to 0x00000 so there is a probleme somewhere.... Do you know where is the problem whith this code ?
I've use the "mach3 internal and plugin bible" http://www.google.fr/url?sa=t&source=web&cd=1&ved=0CB0QFjAA&url=http%3A%2F%2Fwww.cnczone.com%2Fforums%2Fattachment.php%3Fattachmentid%3D113858%26d%3D1283534276&rct=j&q=mach3%20plugin%20bible&ei=iafJTZ6aK8TMhAe1h-isDQ&usg=AFQjCNEpq4AGpFKRAqSJRPQAkVSXY1PcwQ&sig2=fiIfMq0sLSH2yqb4P_68Vg&cad=rja
Thanks a lot for your help.
PS : I can add a menu by searching the "Mach3 CNC" window and using his HWND, that works perfectly... but myNotify is not called when I click a menu item under mach3...
So I dont know hox to do for handle Menu Item click in thsi case ...
I've try to add a menu whith the code below in myPostInitControl :
{
CFrameWnd *MachFrame = MachView->MachFrame; //Prblem here -> MachFrame = 0x00000
CMenu *menu = MachFrame->GetMenu();
HMENU hSubmenu = CreatePopupMenu();
int pos = FindMenuItem3(menu,"PlugIn Control");
//here we can add menu items to MAch3's menu..
int x = pos;
HMENU control = GetSubMenu( menu->m_hMenu, pos);
InsertMenu ( control, -1, MF_BYPOSITION, RangeStart , _T("kk") );
MachFrame->DrawMenuBar();*/
}
Compling is OK but when I start mach3, I've gort a error triged . After debugging the dll, I saw that MachFrame is equal to 0x00000 so there is a probleme somewhere.... Do you know where is the problem whith this code ?
I've use the "mach3 internal and plugin bible" http://www.google.fr/url?sa=t&source=web&cd=1&ved=0CB0QFjAA&url=http%3A%2F%2Fwww.cnczone.com%2Fforums%2Fattachment.php%3Fattachmentid%3D113858%26d%3D1283534276&rct=j&q=mach3%20plugin%20bible&ei=iafJTZ6aK8TMhAe1h-isDQ&usg=AFQjCNEpq4AGpFKRAqSJRPQAkVSXY1PcwQ&sig2=fiIfMq0sLSH2yqb4P_68Vg&cad=rja
Thanks a lot for your help.
PS : I can add a menu by searching the "Mach3 CNC" window and using his HWND, that works perfectly... but myNotify is not called when I click a menu item under mach3...
