I’m using a Main Menu control in a windows form on a Windows Mobile 6.5 application. It is programmed so if I scan a barcode, the program takes me to a different page. However, if I scan a page while the main menu is open, I no longer am able to open the main menu on the child screen. I tried performing a “click” on the parent form in my decoder event (which hides the menu), but the menu still won’t show on the child screen. How can I get the menu to work again on the child screen? It works fine if the menu wasn’t open while scanning.
Public Shared Sub DecodeEvent(ByVal sender As System.Object, ByVal e As HandHeldProducts.Embedded.Decoding.DecodeAssembly.DecodeEventArgs, ByVal scanInformation As ICurrentScanInformation, ByVal dashboardScreenServiceClient As DashboardScreenServiceClient)
Dim oDecodeAssembly As New DecodeAssembly
If scanInformation IsNot Nothing AndAlso scanInformation.AllowedScans IsNot Nothing Then
ShowOffenderDialog(scanInformation.ScreenName, CType(scanInformation, Form), sourceId, source, True, e.Message)
Else
MsgBox.ExclamationMsg("This type of barcode scan is not allowed.")
End If
End Sub
Public Shared Sub ShowOffenderDialog(ByVal parentScreenName As String, ByVal owner As Form, ByVal sourceId As System.Int32, ByVal source As System.String, ByVal scan As System.Boolean, Optional ByVal offenderCd As String = "")
Try
/*open up a new screen*/
offenderDetails = New frmOffenderDetails(parentScreenName, offenderCd, sourceId, source, scan)
offenderDetails.ShowDialog()
owner.BringToFront()
Catch ex As Exception
Utility.DisplayApplicationMessage(parentScreenName, "ShowDialog", ex)
End Try
End Sub
If I step over all of my frmOffenderDetails code, the menu still won’t display, so it doesn’t have anything to do with that form.
Using RemoteSpy++, I determined that the menu’s name is MNU on my device. So I used the following code to find the menu:
Solution 1 (for Honeywell Pocket PC devices):
I was unable to fix the error on the Honeywell Pocket PC device by closing the menu before the decode event, so I just notified the user it was open and to try again with the menu closed:
Solution 2:
I have not tried it, but would assume you can also P/Invoke if you do not have a Honeywell device.
Declare the following function:
And call it like this to find the handle of the menu:
The second part is the same as solution 1: