Jump to content

What happens during a 'ControlCommand - SelectString' ?


Shibuya
 Share

Recommended Posts

I think starting off, the initial command could be something like this:

DllCall("user32.dll", "int", "SendMessage", "hwnd", $combobox_handle, "int", 0x14D, "int", 0, "str", $string)

I believe there's more to it, like a "initialization"/"execution".

Can anyone shed some light on this?

I'm dealing with a combobox that calls up a pop-up box for a certain selection.

'ControlCommand - SelectString' doesn't cut it, as it pauses my sccript

P.S. Thanks to gafrost for the code

The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

Link to comment
Share on other sites

DllCall()'ing SendMessage is going to block, too. You need to use SendMessageTimeout(). Also, what is 0x14D? Will you remember what it is in a day? A week? Define a constant with a symbolic name (For your sanity, it should be the same as the Windows API constant), otherwise, 0x14D is just a magic number which might mean anything.

Link to comment
Share on other sites

DllCall()'ing SendMessage is going to block, too. You need to use SendMessageTimeout(). Also, what is 0x14D? Will you remember what it is in a day? A week? Define a constant with a symbolic name (For your sanity, it should be the same as the Windows API constant), otherwise, 0x14D is just a magic number which might mean anything.

oops, sorry

didn't meant to post a brain teaser or any of the sorts

I just took a snippet out of gafrost's code to use, which I replaced the initial constant declaration with 0x14D

anyway, this is gafrost's original code where I took the snippet from:

;===============================================================================
;
; Description:          _GUICtrlComboSelectString
; Parameter(s):     $h_combobox - controlID
;                           $i_index - Specifies the zero-based index of the item preceding the first item to be searched
;                           $s_search - String that contains the characters for which to search
; Requirement:          None
; Return Value(s):  If the string is found, the return value is the index of the selected item.
;                           If the search is unsuccessful, the return value is $CB_ERR and the current selection is not changed
; User CallTip:     _GUICtrlComboSelectString($h_combobox, $i_index, $s_search) Search the list of a combo box for an item that begins with the characters in a specified string (required: <GuiCombo.au3>)
; Author(s):            Gary Frost (custompcs@charter.net)
; Note(s):              When the search reaches the bottom of the list, it continues from the top
;                           of the list back to the item specified by the wParam parameter.
;                           If $i_index is 1, the entire list is searched from the beginning
;                           A string is selected only if the characters from the starting point
;                           match the characters in the prefix string
;
;===============================================================================
Func _GUICtrlComboSelectString($h_combobox, $i_index, $s_search)
   If IsHWnd($h_combobox) Then
      Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_combobox, "int", $CB_SELECTSTRING, "int", $i_index, "str", $s_search)
      Return $a_ret[0]
   Else
      Return GUICtrlSendMsg($h_combobox, $CB_SELECTSTRING, $i_index, $s_search)
   EndIf
EndFunc  ;==>_GUICtrlComboSelectString

where $CB_SELECTSTRING is declared as:

Global Const $CB_SELECTSTRING = 0x14D

my apologies again B)

anyway, gafrost's code did work partially for me.

it selects the combobox, but didn't bring up the pop-up box

I was thinking that maybe sending a ascii character/command to the control could bring up the pop-up box?

The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

Link to comment
Share on other sites

  • 2 weeks later...

sorry to chime on this topic again

When Valik replied to the topic, I was totally stumped.

Sad to say I don't know anything about API and DLLs and all these seems pretty hard to understand for me.

As I knew absolutely nothing about this API and DLL thing, I thought I'd research and study abit more before asking for more info, to help my understanding.

From the tiny bits of info I've gathered up to now and after reading Valik's reply for the second time, I think what Valik meant is that the DLL command used in "ControCommand - SelectString" is similar to gafrost's DLL call command.

I understand Valik's point that SendMessage() would still block my intended script execution, but I want to figure out what's the difference between the DLL command used in "ControCommand - SelectString" from gafrost's, which makes it able to bring up the pop-up dialog?

The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...