Modify

Opened 17 years ago

Closed 17 years ago

#862 closed Bug (No Bug)

DllStructCreate DllStructSetData

Reported by: thesnow Owned by:
Milestone: Component: AutoIt
Version: 3.3.0.0 Severity: None
Keywords: Cc:

Description

$Struct=DllStructCreate("char var1[255];char var2[255]")
DllStructSetData($Struct,"var1","test") ;ansi char
DllStructSetData($Struct,"var2","测试") ;non-english char
MsgBox(0,"",DllStructGetData($Struct,"var1")) ;display "test",it's right
MsgBox(0,"",DllStructGetData($Struct,"var2")) ;display "测",it's error

Attachments (2)

test.zip (311 bytes ) - added by thesnow 17 years ago.
bug exp
test2.zip (587 bytes ) - added by thesnow 17 years ago.
exp 2

Download all attachments as: .zip

Change History (8)

by thesnow, 17 years ago

Attachment: test.zip added

bug exp

comment:1 by J-Paul Mesnage, 17 years ago

I think you have to use wchar var2[255]
That's working on a nonchinese windows version

comment:2 by anonymous, 17 years ago

some win32api need char pointer.
wstr can use in dllcall(use in Struct can not work).but i want use Struct ,not dllcall.

by thesnow, 17 years ago

Attachment: test2.zip added

exp 2

comment:3 by anonymous, 17 years ago

There are a lot of AutoIt3 groups using Chinese fans, so suggest modify the bug.

forgive my poor English _

comment:4 by J-Paul Mesnage, 17 years ago

You have to use ShellAboutW with wstr and not ShellAbout.
ShellAbout is not using Unicode.
I cannot testit but

Return DllCall("shell32.dll","int","ShellAboutW", "hwnd",$hwnd, "wstr",$szApp, "wstr",$szOtherStuff, "hwnd",0)

should work

Such help info must go to forum before going here for bug fixing if any.

comment:5 by thesnow, 17 years ago

keywords is:
DllStructSetData drop some non-english text.
keywords is not use ShellAbout API.
I know ShellAboutW use wstr can work.


$Struct=DllStructCreate("char var1[255];char var2[255]")
DllStructSetData($Struct,"var1","test") ;ansi char
DllStructSetData($Struct,"var2","测试") ;non-english char
MsgBox(0,"",DllStructGetData($Struct,"var1")) ;display "test",it's right
MsgBox(0,"",DllStructGetData($Struct,"var2")) ;display "测",it's error


sorry. forgive me bad english.

comment:6 by J-Paul Mesnage, 17 years ago

Resolution: No Bug
Status: newclosed

You cannot expect to keep unicode if you use char, you have to use wchar.
internally AutoIt work in UNICODE and do conversiion when you ask for.
Your conversion is impossible chinese is unicode and cannot be store in ANSI (char) string.

I close this report next time go to forum when you need help.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.