Great! Glad that resolved it. The differences between Menu architecture in
"_dtaylorus" <dtaylorus@discussions.microsoft.com> wrote in message
news:228CC2CA-F1A8-4602-9B5B-D14ACF7CDC61@microsoft.com...
> Problem solved. It turns out that the handle returned by SHFindMenuBar
> works
> fine as the lParam for WM_COMMAND, even though CESpy shows a different
> lParam
> value if the menu is invoked normally by tapping on it.
>
> Thanks!
>
> "_dtaylorus" wrote:
>
>> Hi Peter,
>>
>> Thanks for the response. Your blog has been helpful to me on more than
>> one
>> occasion.
>>
>> I'm able to find the softkey bar window (class "menu_worker") using
>> SHFindMenuBar without any trouble. Its parent is the form hWnd, and it
>> has
>> no child windows, so that seems to be a dead end as far as finding the
>> related MS_SOFTKEY_CE_1.0 window goes.
>>
>> I'm also able to find my form menu handle using the TB_GETBUTTONINFO
>> message. GetMenu (SHCMBM_GETMENU) only works on the Smartphone platform,
>> not
>> on the PocketPC.
>>
>> But I still don't see any way to get the correct lParam value to use to
>> send
>> a WM_COMMAND message that will invoke a .NET CF menu command.
>>
>> -David
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> "Peter Foot [MVP]" wrote:
>>
>> > There is a softkey bar for each application potentially. I can't
>> > remember
>> > but possibly the GetMenu API call will work - pass in the handle to
>> > your
>> > main form and see what handle is returned.
>> >
>> > Regards,
>> >
>> > Peter
>> >
>> > --
>> > Peter Foot
>> > Microsoft Device Application Development MVP
>> >
www.peterfoot.net |
www.inthehand.com >> > In The Hand Ltd - .NET Solutions for Mobility
>> >
>> > "_dtaylorus" <dtaylorus@discussions.microsoft.com> wrote in message
>> > news:F308EF11-E3B7-4189-9B17-50D5DC4B3CF3@microsoft.com...
>> > >I thought it would be a simple matter to SendMessage(hWnd, WM_COMMAND,
>> > > commandId, lParam), where hWnd is the form window handle and lParam
>> > > is 0.
>> > > (Surprise... it doesn't work on a WM5 PPC.)
>> > >
>> > > Using CESpy, I can see that for real menu clicks, lParam is set to
>> > > the
>> > > handle of a window with a class name of "MS_SOFTKEY_CE_1.0".
>> > >
>> > > Sure enough, if I manually set lParam to this value in the debugger,
>> > > SendMessage works as expected.
>> > >
>> > > So now the question is: How do I _reliably_ get the handle to this
>> > > MS_SOFTKEY_CE_1.0 window? There can be any number of them at a given
>> > > time.
>> > > I need to know which one to use for the active form.
>> > >
>> > > Thanks!
>> > > -David
>> >