Hello,
I am writing an application in visual basic that automates another
application through the use of system message APIs.
Here's what it does. It first finds a dialog box with the "Export
Data" title in it. It then finds the first combo box in it and then
changes the value in it. This codes changes the value in the combobox
without any problems.
The problem I'm having is that the dialog box doesn't seem to know
that the combobox has changed. If I change the value of the combobox
with my mouse, then the form reloads the other listboxes with
different values based off of the value that is in the combobox. If I
use SETSURSEL then the combobox gets the new value, but the listboxes
doesn't reload. I need the listboxes to reload as if I selected a new
combobox item with my mouse.
Can anyone give me a working example of how to do this in visual basic
6?
Thanks,
Rob
Const CB_SETCURSEL = &H14E
Const CBN_SELCHANGE = 1
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const CBN_CLOSEUP = 8
'Get the handle for the export data dialog box - this works
Do While exporthwnd = 0
exporthwnd = FindWindow(vbNullString, "Export Data")
DoEvents
Loop
'Get the handle of the combobox dropdown, which is in the export data
dialog box - this works
cbohndle = FindWindowEx(exporthwnd, &H0&, "ComboBox", vbNullString)
'Select an item - this works
SendMessage(cbohndle, CB_SETCURSEL, 2, 0)
'Select the item -- notify the parent that there's been a change
'this doesn't work
PostMessage exporthwnd, WM_COMMAND, CBN_SELCHANGE, cbohndle |