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)
Change History (8)
by , 17 years ago
comment:1 by , 17 years ago
I think you have to use wchar var2[255]
That's working on a nonchinese windows version
comment:2 by , 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.
comment:3 by , 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 , 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 , 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 , 17 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
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.

bug exp