Hi Antonio,
how can we implement SHCreateMenuBar command in FWPPC ?
We have modified the example with TB_STYLEBUTTON but it doesn't works.
Have you an working menu CE 6.0 example compiled with FWPPC ?
regards
Menu doesn't work CE 6.0
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Menu doesn't work CE 6.0
SHCreateMenuBar() is already provided in FWPPC with function CESetMenu():
Code: Select all
HB_FUNC( CESETMENU )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
static SHMENUBARINFO mbi;
memset( &mbi, 0, sizeof( SHMENUBARINFO ) );
mbi.cbSize = sizeof( SHMENUBARINFO );
mbi.hwndParent = hWnd;
mbi.nToolBarId = hb_parnl( 2 );
mbi.hInstRes = GetModuleHandle( NULL );
mbi.nBmpId = hb_parnl( 3 );
mbi.cBmpImages = hb_parnl( 4 );
SHCreateMenuBar( &mbi );
hb_retnl( SendMessage( mbi.hwndMB, SHCMBM_GETMENU, 0, 0 ) );
}
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Menu doesn't work CE 6.0
You don't need to call SHCreateMenuBar() as FWPPC does it automatically.
It seems as something has changed in Windows CE 6. We are testing this now:
https://social.msdn.microsoft.com/Forum ... smobiledev
mbi.dwFlags = SHCMBF_HMENU; // Adding this line should solve the problem
It seems as something has changed in Windows CE 6. We are testing this now:
https://social.msdn.microsoft.com/Forum ... smobiledev
mbi.dwFlags = SHCMBF_HMENU; // Adding this line should solve the problem
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Menu doesn't work CE 6.0
Hi Antonio,
so we have just to wait for a solution.
Let us to know, because if there isn't we'll try another way
regards
so we have just to wait for a solution.
Let us to know, because if there isn't we'll try another way
regards
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Menu doesn't work CE 6.0
After reading this article:
https://www.codeproject.com/Articles/22 ... e-menu-bar
I have tried this code:
But it is not working as expected. As described in these posts, SHCreateMenuBar() is broken in new Windows mobile versions:
https://social.msdn.microsoft.com/Forum ... icesnative
It is not a FWPPC issue. It is a Windows CE bug
https://www.codeproject.com/Articles/22 ... e-menu-bar
I have tried this code:
Code: Select all
#include "FWCE.ch"
#define MF_BYCOMMAND 0
#define MF_ENABLED 0
#define MF_STRING 0
//----------------------------------------------------------------------------//
function Main()
local oWnd, hMenu
DEFINE WINDOW oWnd TITLE "TestMenu" ;
MENU BuildMenu()
oWnd:oMenu:hMenu = CreateMenu()
MyAppendMenu( oWnd:oMenu:hMenu, nOr( MF_BYCOMMAND, MF_ENABLED, MF_STRING ),;
110, "First" )
MyAppendMenu( oWnd:oMenu:hMenu, nOr( MF_BYCOMMAND, MF_ENABLED, MF_STRING ),;
120, "Second" )
MyAppendMenu( oWnd:oMenu:hMenu, nOr( MF_BYCOMMAND, MF_ENABLED, MF_STRING ),;
130, "Third" )
MsgInfo( MyCESetMenu( oWnd:hWnd, oWnd:oMenu:hMenu ) )
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu, oItem
DEFINE MENU oMenu RESOURCE 102
REDEFINE MENUITEM oItem ID 110 OF oMenu ACTION ( MsgInfo( "Clientes" ), oItem:SetCheck( .t. ) )
REDEFINE MENUITEM ID 120 OF oMenu ACTION MsgInfo( "Proveedores" ) WHEN .F.
REDEFINE MENUITEM ID 1310 OF oMenu ACTION MsgInfo( "Añadir" )
REDEFINE MENUITEM ID 1320 OF oMenu ACTION MsgInfo( "Modificar" )
REDEFINE MENUITEM ID 210 OF oMenu ACTION MsgInfo( "Albaranes" )
REDEFINE MENUITEM ID 310 OF oMenu ACTION MsgInfo( "Manual" )
return oMenu
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
typedef struct _CONTEXT CONTEXT, *PCONTEXT;
#include <windows.h>
#include <aygshell.h>
#include <sipapi.h>
#include <shlobj.h>
#include <fwppc.h>
HB_FUNC( CREATEMENU )
{
hb_retnl( ( HB_LONG ) CreateMenu() );
}
HB_FUNC( MYAPPENDMENU )
{
LPWSTR pW = ( LPWSTR ) AnsiToWide( ( char * ) hb_parc( 4 ) );
hb_retl( AppendMenu( ( HMENU ) hb_parnl( 1 ), hb_parnl( 2 ), hb_parnl( 3 ), pW ) );
hb_xfree( pW );
}
HB_FUNC( MYCESETMENU )
{
static SHMENUBARINFO mbi;
memset( &mbi, 0, sizeof( SHMENUBARINFO ) );
mbi.cbSize = sizeof( SHMENUBARINFO );
mbi.hwndParent = ( HWND ) hb_parnl( 1 );
mbi.nToolBarId = hb_parnl( 2 );
mbi.hInstRes = GetModuleHandle( NULL );
mbi.nBmpId = hb_parnl( 3 );
mbi.cBmpImages = hb_parnl( 4 );
mbi.dwFlags = SHCMBF_HMENU;
SHCreateMenuBar( &mbi );
hb_retnl( SendMessage( mbi.hwndMB, SHCMBM_GETMENU, 0, 0 ) );
}
#pragma ENDDUMP
https://social.msdn.microsoft.com/Forum ... icesnative
It is not a FWPPC issue. It is a Windows CE bug
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Menu doesn't work CE 6.0
You may simulate a menu using buttons:
Code: Select all
#include "Fwce.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd
@ 20, 0 BUTTON "First" SIZE 70, 20 OF oWnd
@ 20, 11.5 BUTTON "Second" SIZE 70, 20 OF oWnd
@ 20, 23 BUTTON "Third" SIZE 70, 20 OF oWnd
ACTIVATE WINDOW oWnd
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Menu doesn't work CE 6.0
// The format for menu RCDATA resource is:
//
//resourceId SHMENUBAR DISCARDABLE
//BEGIN
// referencedMenuId,
// buttonCount,
//
// /* button 0 */
// I_IMAGENONE /* iconId? */, commandId /* like IDC_something, received through WM_COMMAND */,
// buttonState /* TBSTATE_ENABLED */, buttonStyle /* TBSTYLE_BUTTON | TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE */,
// captionId /* string resource IDS_OK */, 0 /* no idea */, menuIndex /* starting from 0 - leftmost, or NOMENU if TBSTYLE_BUTTON */,
//
// /* button 1 */
// I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
// IDS_HELP, 0, 0,
// ...
//END
https://github.com/kjk/moriarty-sm/blob ... Common.rc2
//
//resourceId SHMENUBAR DISCARDABLE
//BEGIN
// referencedMenuId,
// buttonCount,
//
// /* button 0 */
// I_IMAGENONE /* iconId? */, commandId /* like IDC_something, received through WM_COMMAND */,
// buttonState /* TBSTATE_ENABLED */, buttonStyle /* TBSTYLE_BUTTON | TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE */,
// captionId /* string resource IDS_OK */, 0 /* no idea */, menuIndex /* starting from 0 - leftmost, or NOMENU if TBSTYLE_BUTTON */,
//
// /* button 1 */
// I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
// IDS_HELP, 0, 0,
// ...
//END
https://github.com/kjk/moriarty-sm/blob ... Common.rc2