Modify

#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 on Mar 13, 2009 at 12:21:32 PM.
bug exp
test2.zip (587 bytes ) - added by thesnow on Mar 13, 2009 at 1:25:08 PM.
exp 2

Download all attachments as: .zip

Change History (8)

by thesnow, on Mar 13, 2009 at 12:21:32 PM

Attachment: test.zip added

bug exp

comment:1 by Jpm, on Mar 13, 2009 at 12:28:21 PM

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

comment:2 by anonymous, on Mar 13, 2009 at 12:51:27 PM

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, on Mar 13, 2009 at 1:25:08 PM

Attachment: test2.zip added

exp 2

comment:3 by anonymous, on Mar 13, 2009 at 2:14:42 PM

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

forgive my poor English _

comment:4 by Jpm, on Mar 13, 2009 at 2:41:30 PM

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, on Mar 13, 2009 at 4:28:52 PM

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 Jpm, on Mar 13, 2009 at 4:49:09 PM

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.