Jump to content

Recommended Posts

Posted (edited)

Hi, username that I can't be bothered to copy out...

I used SHGetFolderPath in my application >iTunesTweet, so with a bit of work, you should be able to figure out SHSetFolderPath.

Func SHGetSpecialFolderPath($csidl)
    Local $hwndOwner = 0, $lpszPath = "", $fCreate = False, $MAX_PATH = 260
    $lpszPath = DllStructCreate("char[" & $MAX_PATH & "]")
    $BOOL = DllCall("shell32.dll", "int", "SHGetSpecialFolderPath", "int", $hwndOwner, "ptr", _
            DllStructGetPtr($lpszPath), "int", $csidl, "int", $fCreate)
    If Not @error Then
        Return SetError($BOOL[0], 0, DllStructGetData($lpszPath, 1))
    Else
        Return SetError(@error, 0, 0)
    EndIf
EndFunc ;==>SHGetSpecialFolderPath
Edited by James
Posted

Just for reference, this function is in WinAPIEx which is the AutoIt beta.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
  On 7/8/2013 at 1:45 PM, James said:

 

Hi, username that I can't be bothered to copy out...

I used SHGetFolderPath in my application >iTunesTweet, so with a bit of work, you should be able to figure out SHSetFolderPath.

Func SHGetSpecialFolderPath($csidl)
    Local $hwndOwner = 0, $lpszPath = "", $fCreate = False, $MAX_PATH = 260
    $lpszPath = DllStructCreate("char[" & $MAX_PATH & "]")
    $BOOL = DllCall("shell32.dll", "int", "SHGetSpecialFolderPath", "int", $hwndOwner, "ptr", _
            DllStructGetPtr($lpszPath), "int", $csidl, "int", $fCreate)
    If Not @error Then
        Return SetError($BOOL[0], 0, DllStructGetData($lpszPath, 1))
    Else
        Return SetError(@error, 0, 0)
    EndIf
EndFunc ;==>SHGetSpecialFolderPath

Can you help me? 

Posted

James already did, what is your new problem?

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

OK, but you read MSDN?

  Quote

 

Deprecated. Assigns a new path to a system folder identified by its CSIDL.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I'm not sure you can with that function.

  Quote
CSIDL_MYDOCUMENTS The virtual folder that represents the My Documents desktop item.

 

  Quote
Only physical folders are valid. If a virtual folder is specified, this function fails.

 

Of course I could be wrong.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

What OS are you using?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

I thought I had it, but I'm crashing AutoIt when I try to run this in Win 7 x64 (running as Admin)

231 is ordinal for SHSetFolderPathA

0x0010 is for desktop folder

$aRet = DllCall("Shell32.dll", "handle", 231, "int", 0x0010, "handle", 0, "str", "C:\Users\0xdefea7\Desktop\Test")
If @error Then MsgBox(16, "Error", @error)
  • Solution
Posted
  On 7/9/2013 at 4:48 AM, 0xdefea7 said:

 

I thought I had it, but I'm crashing AutoIt when I try to run this in Win 7 x64 (running as Admin)

231 is ordinal for SHSetFolderPathA

0x0010 is for desktop folder

$aRet = DllCall("Shell32.dll", "handle", 231, "int", 0x0010, "handle", 0, "str", "C:\Users\0xdefea7\Desktop\Test")
If @error Then MsgBox(16, "Error", @error)

it work on xp:

DllCall("Shell32.dll","handle",231,"int",0x0010,"HANDLE",0,"DWORD",0,"str","C:\Desktop")

Thank you.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...