Hi everyone
In our mdlMain we have somewhere :
SystemCallback::SetWindowsKeystrokeMessageFunction(CatchToucheClavier);
And also this following code :
bool CatchToucheClavier(void* windowID, UInt32 messageNumber, uintptr_t wParam, intptr_t lParam, long x, long y)
{
GestionRaccourciToolsBoxGeneral((int)wParam,DIAGID_AlmBoxToolsGeneral);
}
void GestionRaccourciToolsBoxGeneral(int key, RscId dialogID)
{
MSDialogP dialP = almDialog_find(dialogID, NULL);
DialogItem *itemP = NULL;
StRsc_AlmIconCmd *zmRscIconCmdP = NULL;
AlmToolsDlgBoxRsc *zmrscP = NULL;
UInt64 cmd;
ULong valeur;
if (dialogID != DIAGID_DscObjet)
{
int nbItem = mdlDialog_itemsGetNumberOf(dialP);
for (int i = 0; i < nbItem; ++i)
{
itemP = mdlDialog_itemGetByIndex(dialP, i);
if (itemP != NULL && itemP->type == RTYPE_IconCmd)
{
if ((zmRscIconCmdP = (StRsc_AlmIconCmd*)Alm::Basic::Resource_load(
0, RSCST_AlmIconCmd, itemP->id)) != NULL)
{
int j = 0;
while (zmRscIconCmdP->clavier[j] != 0)
{
if ((key == zmRscIconCmdP->clavier[j]))
{
if (itemP!=NULL && itemP->rawItemP != NULL)
{
mdlDialog_hookItemSendUserMsg(itemP->rawItemP, DITEM_MESSAGE_QUEUECOMMAND, NULL);// <=Crash after 3/4 down of a key
Alm::Tool::Resource_free((void**)&zmRscIconCmdP);
break;
}
}
j++;
}
Alm::Tool::Resource_free((void**)&zmRscIconCmdP);
}
}
}
}
}
The goal here, is to handle keyboard key press event for our dialog box DIAGID_AlmBooxToolsGeneral when it doesn't have focus.
In microstation v8i we do not need to use "SystemCallback::SetWindowsKeystrokeMessageFunction" we juste have a hook where we handle DialogMessage DIALOG_MESSAGE_KEYSTROKE.
But i dont know why, since connect , this way does not work anymore.
My issue is after 3 or 4 press on a key this function mdlDialog_hookItemSendUserMsg crash and i don't know why. i tried every possible value for DITEM_MESSAGE_something but it still crashing.
Do you have any idea why?
Is there an other way to handle key press for a windows who does not have focus?
Thanks for your help
Rgdts
Arnaud