Jump to content
Sign in to follow this  

First dll call

Recommended Posts


Hi I have never made a dll call... and I would like to start with this dll I was hoping someone could help me out of this predicament...


CreateDesktopW (Unicode) and CreateDesktopA (ANSI)

the autoit help doesnt make sense to me...

Share this post

Link to post
Share on other sites

Dim $tBuff = DllStructCreate('wchar[' & StringLen('Text') & '];wchar[' & StringLen('String') & ']')
 DllStructSetData($tBuff, 1, 'Text')
 DllStructSetData($tBuff, 2, 'String')

Dim $Ret = DllCall('user32.dll', 'ptr', 'CreateDesktopW', 'wstr', DllStructGetPtr($tBuff, 1), 'wstr', _
             DllStructGetPtr($tBuff, 2), 'uint', 1, 'uint', 1, 'ptr', 0)

The ANSI version is simpler, just use 'str' as the type and pass the string or it's pointer what ever you like.

Edit: Stupid mistake, remove the string concatenation operator '&' in the dll call. Use only the underscore instead.

Edited by Authenticity

Share this post

Link to post
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
Sign in to follow this