Jump to content

Command "AddString" in function ControlCommand get error


dd1978
 Share

Recommended Posts

I honestly don't know.

have you try with ControlListView ?

Remarks
Some commands may fail when using a 32-bit AutoIt process to read from a 64-bit process.

Likewise commands may fail when using a 64-bit AutoIt process to read from a 32-bit process

 

I know that I know nothing

Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

The code in Example_03 is still return -1, either compile by X64 or X86

following is content in tab Summary in my Au3Info:

>>>> Window <<<<
Title:  Form_ListBox
Class:  WindowsForms10.Window.8.app.0.141b42a_r9_ad1
Position:   26, 26
Size:   338, 217
Style:  0x16CF0000
ExStyle:    0x00050100
Handle: 0x00000000000206C8

>>>> Control <<<<
Class:  WindowsForms10.LISTBOX.app.0.141b42a_r9_ad1
Instance:   1
ClassnameNN:    WindowsForms10.LISTBOX.app.0.141b42a_r9_ad11
Name:   ListBox1
Advanced (Class):   [NAME:ListBox1]
ID: 329282
Text:   
Position:   28, 28
Size:   176, 88
ControlClick Coords:    59, 54
Style:  0x562110C1
ExStyle:    0x00000200
Handle: 0x0000000000050642

>>>> Mouse <<<<
Position:   121, 139
Cursor ID:  0
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<


>>>> Hidden Text <<<<

 

Link to comment
Share on other sites

  • Developers

As you can clearly see: Everybody is stabbing in the dark as we have nothing concrete to test with.
Is there anyway you can post a script example that should work and what we can test with?  

...else we remain in this mode and will be called "No Bug" as there are many things that could cause this not to work. 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@dd1978 this  example working !

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Create GUI
    GUICreate("List Box Get/Set Sel (v" & @AutoItVersion & ")", 400, 296)
    Local $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    GUISetState(@SW_SHOW)

    ; Add strings
    _GUICtrlListBox_BeginUpdate($idListBox)
    For $iI = 0 To 9
        _GUICtrlListBox_AddString($idListBox, StringFormat("%03d : string", $iI))
    Next
    _GUICtrlListBox_EndUpdate($idListBox)

    ; Select a items
    _GUICtrlListBox_SetSel($idListBox, 3)

    ;----------------------------------------------------------------------------------------
    ;Test ControlCommand GetCount
    Local $win_ppt = "[TITLE:List Box Get/Set Sel (v3.3.16.1); CLASS:AutoIt v3 GUI]"
    Local $hWnd = WinActivate($win_ppt, "")
    Local $Test = ControlCommand($hWnd, "", "ListBox1", "GetCount", "")

    MsgBox($MB_SYSTEMMODAL, "$Test ControlCommand GetCount", $Test)
    ;----------------------------------------------------------------------------------------

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

 

I downloaded your file to try it out. Unfortunately without result!
However, I did another ListBox and it works ???

I do not know why

 

Edited by ioa747
del zip

I know that I know nothing

Link to comment
Share on other sites

@ioa747from your upload I notice that your win form is .net 5 and the form resource is defined in a DLL

I am under .net 4.5 and work on VS2019. Is this reason?

And could you try to write a win form project that compile form resource in EXE and take a look whether it works?

Link to comment
Share on other sites

I have tried many times but cannot get reason.

create win form under VS2019 with net 4.5: AddString command of function ControlCommand always get an error and nothing is added to list box

create dialog under VS2019 with MFC: AddString command of function ControlCommand get an error but new lines were added to list box

create dialog under VS2019 with MFC: GetCount command of function ControlCommand works well

All above are tested against same code with any necessary modifying

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...