...
function BuildMenu()
local oMenu
MENU oMenu 2007
...
MenuDraw2007( pItemStruct,;
If( IsSeparator( pItemStruct ), "", MISText( pItemStruct ) ),;
0,, ::hWnd )
MenuDraw2007( pItemStruct,;
If( IsSeparator( pItemStruct ), "", "xyz" ),;
0,, ::hWnd )
HB_FUNC( MISTEXT ) // pItemStruct --> cPrompt
{
#ifdef _WIN64
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnll( 1 );
#else
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnl( 1 );
#endif
MENUITEMINFO mi;
BYTE buffer[ 100 ];
mi.cbSize = sizeof( MENUITEMINFO );
mi.fMask = MIIM_STRING;
mi.dwTypeData = ( LPSTR ) buffer;
GetMenuItemInfo( ( HMENU ) lpdis->hwndItem, lpdis->itemID, FALSE, &mi );
hb_retc( ( char * ) buffer );
}
HB_FUNC( MISTEXT ) // pItemStruct --> cPrompt
{
#ifdef _WIN64
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnll( 1 );
#else
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnl( 1 );
#endif
MENUITEMINFO mi;
BYTE buffer[ 100 ];
memset( &mi, 0, sizeof( mi ) );
mi.cbSize = sizeof( MENUITEMINFO );
mi.fMask = MIIM_STRING;
mi.dwTypeData = ( LPSTR ) buffer;
if( ! GetMenuItemInfo( ( HMENU ) lpdis->hwndItem, lpdis->itemID, FALSE, &mi ) )
strcpy( buffer, "here" );
hb_retc( ( char * ) buffer );
}
static LPSTR WideToAnsi( LPWSTR cWide )
{
WORD wLen;
LPSTR cString = NULL;
wLen = WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, 0, NULL, NULL );
cString = ( LPSTR ) hb_xgrab( wLen );
WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, wLen, NULL, NULL );
return cString;
}
HB_FUNC( MISTEXT ) // pItemStruct --> cPrompt
{
#ifdef _WIN64
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnll( 1 );
#else
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnl( 1 );
#endif
LPSTR pText;
MENUITEMINFO mi;
BYTE buffer[ 100 ];
memset( &mi, 0, sizeof( mi ) );
mi.cbSize = sizeof( MENUITEMINFO );
mi.fMask = MIIM_STRING;
mi.dwTypeData = ( LPSTR ) buffer;
GetMenuItemInfo( ( HMENU ) lpdis->hwndItem, lpdis->itemID, FALSE, &mi );
pText = WideToAnsi( buffer );
hb_retc( pText );
hb_xfree( pText );
}
HB_FUNC( MISTEXT ) // pItemStruct --> cPrompt
{
#ifdef _WIN64
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnll( 1 );
#else
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnl( 1 );
#endif
LPSTR pText;
MENUITEMINFO mi;
BYTE buffer[ 100 ];
memset( &mi, 0, sizeof( mi ) );
mi.cbSize = sizeof( MENUITEMINFO );
mi.fMask = MIIM_STRING;
mi.dwTypeData = ( LPSTR ) buffer;
GetMenuItemInfo( ( HMENU ) lpdis->hwndItem, lpdis->itemID, FALSE, &mi );
strcat( buffer, "here" );
hb_retc( buffer );
}
dwTypeData
Type: LPTSTR
The contents of the menu item. The meaning of this member depends on the value of fType and is used only if the MIIM_TYPE flag is set in the fMask member.
To retrieve a menu item of type MFT_STRING, first find the size of the string by setting the dwTypeData member of MENUITEMINFO to NULL and then calling GetMenuItemInfo. The value of cch+1 is the size needed. Then allocate a buffer of this size, place the pointer to the buffer in dwTypeData, increment cch, and call GetMenuItemInfo once again to fill the buffer with the string. If the retrieved menu item is of some other type, then GetMenuItemInfo sets the dwTypeData member to a value whose type is specified by the fType member.
When using with the SetMenuItemInfo function, this member should contain a value whose type is specified by the fType member.
dwTypeData is used only if the MIIM_STRING flag is set in the fMask member
HB_FUNC( MISTEXT ) // pItemStruct --> cPrompt
{
#ifdef _WIN64
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnll( 1 );
#else
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) hb_parnl( 1 );
#endif
MENUITEMINFO mi;
BYTE buffer[ 100 ];
memset( &mi, 0, sizeof( mi ) );
mi.cbSize = sizeof( MENUITEMINFO );
mi.fMask = MIIM_STRING;
mi.dwTypeData = NULL;
GetMenuItemInfo( ( HMENU ) lpdis->hwndItem, lpdis->itemID, FALSE, &mi );
mi.dwTypeData = ( LPSTR ) buffer;
mi.cch++;
GetMenuItemInfo( ( HMENU ) lpdis->hwndItem, lpdis->itemID, FALSE, &mi );
hb_retc( buffer );
}
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 45 guests