simple DllCall question

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bigdeal
Posts: 66
Joined: 13 Feb 2017, 06:31

simple DllCall question

10 Apr 2017, 17:26

I was looking at helpfile to learn ahk and it says that this would be uppercase and the next should be lowercase, however I tried it and it was both lowercase, so I dunno if this is my mistake or a mistake in the helpfile?

MyVar = ABC
result := DllCall("CharLower", str, DllCall("CharUpper", Str, MyVar, Str), Str)

MyVar = ABC
result := DllCall("CharLower", ptr, DllCall("CharUpper", Str, MyVar, Ptr), Str)
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: simple DllCall question

10 Apr 2017, 20:33

Examples:

Code: Select all

MyVar = ABC

StringLower, MyVar, MyVar
MsgBox,, StringLower, % MyVar

StringUpper, MyVar, MyVar
MsgBox,, StringUpper, % MyVar

MyVar := Format("{:L}", MyVar)
MsgBox,, Format {:L}, % MyVar

MyVar := Format("{:U}", MyVar)
MsgBox,, Format {:U}, % MyVar

DllCall("CharLower", Ptr, &MyVar)
MsgBox,, DllCall CharLower, % MyVar

DllCall("CharUpper", Ptr, &MyVar)
MsgBox,, DllCall CharUpper, % MyVar
References:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

HTH
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: simple DllCall question

10 Apr 2017, 21:15

bigdeal, I believe you misread the help file.
But when the same is done with DllCall(), MyVar would be uppercase after the following call because CharLower would have operated on a different/temporary string whose contents were identical to MyVar:
MyVar (the input/output of CharUpper) and result (the return value of CharLower) are not the same thing.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, Spawnova and 354 guests