我正在从Vb6中的MS Access调用外部应用程序,并尝试更改组合框选择,但是我尝试过的所有sendmessage常量都无法正常工作。到目前为止,我拥有的代码已成功打开应用程序,导航至正确的窗口,展开组合框,并且就我所知。我还附加了指向Spy ++树的链接
Sub RunSailwaveUpdates()
Dim hwnd As Integer
Dim SortSelect As String
SortSelect = "Fleet"
hwnd = FindWindow(vbNullString, "Sailwave -
C:\Users\Public\Documents\Sailwave\Results\Summer Points.blw")
start_doc = ShellExecute(0&, "open", "
C:\Users\Public\Documents\Sailwave\Results\Summer Points.blw", 0, 0,
SW_NORMAL)
If start_doc = 2 Then Exit Sub
If start_doc = 3 Then Exit Sub
Do
DoEvents
hwindow2 = FindWindow(vbNullString, "Sailwave -
C:\Users\Public\Documents\Sailwave\Results\Summer Points.blw")
hwindow3 = FindWindowEx(hwindow2, ByVal 0&, "ClaChildClient", vbNullString)
scoreseriesbutton = FindWindowEx(hwindow3, 0&, "ClaButton_0400000H", "Score
Series")
Loop Until hwindow2 > 0 And hwindow3 > 0 And scoreseriesbutton > 0
WaitSeconds (0.5)
Call SendMessage(scoreseriesbutton, BM_CLICK, 0, ByVal 0&)
Do
DoEvents
scoreseries = FindWindow(vbNullString, "Score Series")
scoreseries2 = FindWindowEx(scoreseries, 0&, "ClaChildClient", vbNullString)
groupoption = FindWindowEx(scoreseries2, 0&, "ClaRadio_0400000H", "Score
groups of competitors separately - scoring system is applied to each
group")
groupfield = FindWindowEx(scoreseries2, 0&, "ClaPrompt_0400000H", "Grouping
field")
groupfield1 = FindWindowEx(scoreseries2, ByVal 0&, "ClaDrop_0400000H", " ")
groupfield3 = GetWindow(groupfield, GW_HWNDNEXT)
Loop Until scoreseries > 0 And groupoption > 0 And groupfield > 0 And
groupfield1 > 0 And scoreseries2 > 0 And groupfield1 > 0 And groupfield3 > 0
WaitSeconds (0.5)
Call SendMessage(groupoption, BM_CLICK, 0, ByVal 0&)
Do
DoEvents
Call SendMessage(groupfield3, CB_SHOWDROPDOWN, 1, 0)
Call SendMessage(groupfield3, CB_SETCURSEL, 2, 0)
Call SendMessage(groupfield3, WM_SETREDRAW, 1, 0)
selectedsort = SendMessage(groupfield3, CB_GETCURSEL, 0, 0)
Loop Until selectedsort > 0
End Sub