Member Avatar for nblackburn

Hey guys,

i found this awesome example on the internet written using autoit 3 script, i was wondering how this would translate in c++ so i can use this for one of my projects, any ideas would be awesome, thanks once again...

$sUserName = "username"
$sPicPath = "usertile.png"

; call CoInitialize
DLLCall("ole32.dll","int","CoInitialize","ptr",0)

$hPicPath = DLLStructCreate("wchar[128]")
DllStructSetData($hPicPath, 1, $sPicPath)

$hUserName = DLLStructCreate("wchar[128]")
DllStructSetData($hUserName, 1, $sUserName)

$aRet = DllCall(@SystemDir & "\shell32.dll", "long", 262, "ptr", DllStructGetPtr($hUserName), "int", 0, "ptr", DllStructGetPtr($hPicPath))

MsgBox(4096, "SetUserTile", $aRet[0])

Best Wishes,
Nathaniel Blackburn

Since the functions and objects defined in .dlls can be used directly in a C++ program simply by linking against them, e.g. g++ myobj.o -o myprog -lole32 (or just adding the OLE library to your VS project), the notation in C++ should be much simpler. I have no actual experience doing this, I'm afraid, but found a sample C/C++ snippet here: http://www.relisoft.com/win32/olerant.html -- hope that gets you going!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.