Hello,
i have made an attempt at this to show im not lazy, but this currently doesnt work, it would mean the world to me if someone could help me finish this code asap, thanks again.
NOTE: Im trying to make this into a DLL for one of my projects
ORIGINAL
using System;
using System.Runtime.InteropServices;
namespace FejesJoco
{
class Program
{
[DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)]
public static extern void SetUserTile(string username, int whatever, string picpath);
[STAThread]
static void Main(string[] args)
{
SetUserTile(args[0], 0, args[1]);
}
}
}
AUTOIT SCRIPT
$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])
TRANSLATION
#using <mscorlib.dll>
using namespace System;
using namespace System::Runtime::InteropServices;
#define DLL_EXPORT extern "C" __declspec(dllexport)
DLL_EXPORT long* SetUserTile(char* username char* imagepath) {
CoInitialize();
[DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)]
public static extern void SetUserTile(string username, int whatever, string picpath);
SetUserTile(username, 0, imagepath);
CoUninitialize();
}
Its probably laughable, but im still learning, any help given is appreciated, thanks
Best Wishes,
Nathaniel Blackburn