Plssss help - At wits end .. Combo Box - for Arabic support

G

Guest

Greetings,

My PDA has PPC 2003 OS. Since it does not natively support Arabic, i am in a
need to show all the controls as Right-to-left arrangment. I am trying to do
it for a combo box.

<StructLayout(LayoutKind.Sequential)> _
Public Structure COMBOBOXINFO
Dim cbSize As Integer
Dim rcItem As Rectangle
Dim rcButton As Rectangle
Dim stateButton As ComboBoxButtonState
Dim hwndCombo As IntPtr
Dim hwndItem As IntPtr
Dim hwndList As IntPtr
End Structure

Public Enum ComboBoxButtonState
STATE_SYSTEM_NONE = 0
STATE_SYSTEM_INVISIBLE = &H8000
STATE_SYSTEM_PRESSED = &H8
End Enum

<DllImport("coredll")> _
Private Shared Function GetCapture() As IntPtr
End Function

<DllImport("coredll", EntryPoint:="SendMessageW")> _
Public Shared Function SendMessageString(ByVal hwnd As IntPtr, _
ByVal wMsg As Integer, _
ByVal wParam As IntPtr, _
ByRef lParam As COMBOBOXINFO) As Integer
End Function

ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

Dim stInpPtr As New IntPtr(0)
Dim cbi As New COMBOBOXINFO
Dim temp
Try
ComboBox1.Capture = True
Dim hwndow As IntPtr = GetCapture()
ComboBox1.Capture = False

Dim chldHandle As IntPtr = GetWindow(hwndow, GW_CHILD)

cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi)
SendMessageString(hwndow, CB_GETCOMBOBOXINFO, stInpPtr, cbi)

The function executes without any errors. But the cbi (object of
COMBOBOXINFO) has all values as zero. Where am i going wrong.
Or is there a better way to do this.

I tried getComboBoxInfor (alternat). that gives me a missing method exception.
<DllImport("coredll")> _
Public Shared Function GetComboBoxInfo(ByVal hwnd As IntPtr, ByRef pcbi
As COMBOBOXINFO) As Boolean
End Function

Thanks in advance,
Boris
 
P

Paul G. Tobey [eMVP]

You might want to try this from native code, just to be sure that the
control actually supports that operation. You also might want to be sure,
given that *everything* is zero in the structure, that you aren't setting
the cbSize field to zero, which would be obviously wrong.

Paul T.
 
G

Guest

There are a few things that you're doing wrong here:
1. The CF v1 doesn't support marshaling of the structures inside structures,
so you might want to change COMBOBOXINFO the following way:

Public Structure COMBOBOXINFO
Dim cbSize As Integer
Dim itemLeft As Integer
Dim itemTop As Integer
Dim itemRight As Integer
Dim itemBottom As Integer
Dim buttonLeft As Integer
Dim buttonTop As Integer
Dim buttonRight As Integer
Dim buttonBottom As Integer
Dim stateButton As ComboBoxButtonState
Dim hwndCombo As IntPtr
Dim hwndItem As IntPtr
Dim hwndList As IntPtr
End Structure

2. GetComboBoxInfo doesn't exist on Windows CE.
 
G

Guest

Thanks Mr.Paul and Mr.Alex for the response.

I tried both your options. Setting the cbi.size to 0 and then tried.
Modified the strtucture as Alex had suggested. There does not seem to be an
error that is occuring but the values that are returned are zero.

SetProcessDefaultLayout, is this function supported by CE ? I keep getting a
missing method exception.

<DllImport("coredll")> _
Private Shared Function SetProcessDefaultLayout(ByVal dwDefaultLayout)
As Boolean
End Function

Where i can find the list of functions that coredll allows you to call from
the native dlls?

Thanks
Boris
 
P

Paul G. Tobey [eMVP]

And, even at that, there will be things in the header files that, in some
cases, don't really exist on the corresponding devices. As indicated in my
message, the best way to be sure of support or lack of support is to try
this from native code. If that works, you'll know that your P/Invoke
operations are at fault. If it's not supported from native code, you can
quit wasting your time looking for problems with your structure layout...

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top