| || |
How to use SendMessage?
I'm trying to send a message to a dialog box (exactly a 'Browse For Folder Dialog'). Basically, if I want to select a path, I have to know the name of a drive.
What I mean is, if my drive C is named DriveC (C and I'm trying to pass in a directory 'C:\program files', my path would look like "/Desktop/My Computer/DriveC (C/Program Files'
Now, if we were on Vista, that same path would look like '/Desktop/Computer/DriveC (C/Program Files'.
In other way, I want to send in a path to that dialog box so that it would take it and give me the results I'm looking for.
What I got so far is this:
SendMessage (hhandle, 0x466 ,1, pFolder), where:
hhhandle is a handle id of a dialog box
0x466 is a value of BFFM_SETSELECTION
1 is int to set a folder name
pFolder is a string with a path to the folder of interest.
1 and pFolder I found on the msdn...
Could somebody help me with this please? If not with this, could somebody help how to find the name of the drive based on the drive letter? For example if I would give a parameter C:, I would get in return DriveC
Thank you for your help.
Re: How to use SendMessage?
Just as an FYI...
I found a solution to this problem. here's the implementation
<font class="small">Code:</font><hr /><pre>
[-] dll "Kernel32.dll"
[ ] long GetVolumeInformation (string lpRootPathName optional, out string lpVolumeNameBuffer, long nVolumeNameSize, out long lpVolumeSerialNumber optional, out long lpMaximumComponentLength optional, out long lpFileSystemFlags optional, out string lpFileSystemNameBuffer, long nFileSystemNameSize) alias "GetVolumeInformationW"
[-] testcase ljljk () appstate none
[ ] string sRoot = "C:\"
[ ] string volNameBuf = ""
[ ] long volNameSize = 256
[ ] string FSSystemNameBuf = ""
[ ] long FSSystemNameSize = 256
[ ] print (GetVolumeInformation (sRoot, volNameBuf, volNameSize, null, null, null, FSSystemNameBuf, FSSystemNameSize))
[ ] print (volNameBuf)
[ ] print (FSSystemNameBuf)
In my case the output looks like this:
Function output is: 1
volNameBuf is: NEXT
FSSystemNameBuf is: NTFS
hope this helps.