How to open a DBCombo with API calls?

P

Peter van der Veen

Hi

In my prgragm i use an API call to open the combobox when it get the
focus.

The code i use is this


Public Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam
As Any) As Long

Public Const CB_SHOWDROPDOWN = &H14F
Public Const CB_GETDROPPEDSTATE = &H157

Public Sub OpenCloseCombo(chwnd As Long)
Dim rc As Long
rc = SendMessage(chwnd, CB_GETDROPPEDSTATE, 0, 0)
If rc = 0 Then
SendMessage chwnd, CB_SHOWDROPDOWN, True, 0
Else
SendMessage chwnd, CB_SHOWDROPDOWN, False, 0
End If
End Sub




But this does not work with the DBCombo.

Anyone an idea how to do that?



Peter
 
C

Cor Ligthert

Peter,

First I am curious, what is the reason that you want an unmanaged control in
your program?

Secondly when you really want it you can try it by changing the longs for
integer
(That is shifted in VBNet from VB6)

I hope this helps?

Cor
 
H

Herfried K. Wagner [MVP]

Peter van der Veen said:
But this does not work with the DBCombo.

Anyone an idea how to do that?

For VB.NET: Set the combobox's 'DroppedDown' property to 'True'.

For VB6: Consider posting to one of the groups in the microsoft.public.vb.*
hiearchy, for example microsoft.public.vb.controls.databound or similar.
 

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