|
GetSaveFileName() will do the job
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi,
Please let me know is there any API to Get the Drive in which im inserting the Disk..
|
|
|
|
|
See GetLogicalDrives .
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
But how will i know in which drive my disk is inserted
|
|
|
|
|
Hi
Get GetLogicalDrives.
and use the folloing function to find out the drive type
UINT uDriveType = GetDriveType(sDriveLabel)
0 - Unknown drive
1 - Invalid Path
2 - Removable Drive
..etc
Regards
.....Jack
|
|
|
|
|
Handle WM_DEVICECHANGE message
|
|
|
|
|
If possible can u suggest me any sample regarding the same...
|
|
|
|
|
|
I had code to access the serial number of a hard drive. I was running this in user mode, getting a handle to the drive as follows:
HANDLE hDrive ;
wchar_t driveName[128];
for(int i = 0; i < 16; ++i)
{
wsprintf(driveName, L"\\\\.\\PhysicalDrive%d", drive);
hDrive = CreateFile(driveName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE , NULL, OPEN_EXISTING, 0, NULL);
...
}
I'm now trying to do the same thing in a driver. However I'm not sure how to open the actual drive. Currently the code I have is:
HANDLE hDrive;
WCHAR sDriveName[128];
OBJECT_ATTRIBUTES oa;
UNICODE_STRING usDriveName;
IO_STATUS_BLOCK iosb;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
int drive;
for(drive = 0; drive < MAX_IDE_DRIVES; drive++)
{
_snwprintf(sDriveName, 128, L"\\Device\\Harddisk%lu", drive);
RtlInitUnicodeString(&usDriveName, sDriveName);
InitializeObjectAttributes(&oa, &usDriveName, OBJ_INHERIT, NULL, NULL);
if(NT_SUCCESS(ZwOpenFile(&hDrive, FILE_ALL_ACCESS, &oa, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_DIRECTORY_FILE)))
{
...
}
}
However the call to ZwOpenFile is failing with iosb.Status == 3.
Any ideas what I am doing wrong here??
Thanks.
|
|
|
|
|
andrew_dk wrote: However the call to ZwOpenFile is failing with iosb.Status == 3.
Does that equal STATUS_WAIT_3 ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
The return value from the call to ZwOpenFile is STATUS_OBJECT_NAME_NOT_FOUND, so I guess the issue is I have the name wrong. More investigation needed on my part.
|
|
|
|
|
Hello everybody
I have to modify a project made in MFC. I was trying to change the position of one Button in the ,i has made changes in file.rc (resource file ) ,but it not works ,it seems to like fix.
Please some body help me
Thanks in advance
|
|
|
|
|
Is the button visible for you. normally when you change the value in the .rc file the position of the control will change.
|
|
|
|
|
Why don't you use the resource editor for the purpose?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Why do you need to modify the .rc file?
Why not use the dialog editor to move the control?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Dear Friends !
Can anyone help me out !
i get friendly name while inserting the device into system. No issue in it.
But i want to get the friendly name of the removable drive by giving the drive letter
for example
if i give G: then it should give the device inserted in G as "Trancend ..."
I hope some once can do in clever !
thanks in advance
Regards
.....Jack
|
|
|
|
|
|
Thank you for the solution.
but This returns only the volume information.
it teturns the name of the volume not a friendly name of the device.
i checked with the above WINAPI function it just returns the volume name
for example: the device inserted is "Trances 4GB Removable..." but it shows the volume name "Jack"
if i am wrong sorry and i hope when we insert the removable device it mounds with the device partition. that is the reason While we use WM_DEVICE_CHANGE enables to track the device and even to get the friendly name using GUID
But i am very scared how to get the friendly name of the removable drive using the drive name.
i am trying...
thanks...
Regards
.....Jack
|
|
|
|
|
Bet you can get that using WMI.
I use WMI Explorer[^] to explore what information there is in the WMI database for my system. I just plugged in my flash drive, and it seems to have a 'friendly name' in the Caption property of its Win32_DiskDrive instance.
This VBScript (you can run it from the command-line with cscript filename.vbs ) can be used to retrieve that - the C++ equivalent is straightforward, but long-winded.
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set drives = objWMIService.ExecQuery("Select * FROM Win32_DiskDrive")
For Each drive in drives
WScript.StdOut.WriteLine drive.caption
Next
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks a lot !
My actual requirement towards this issue is this:
I am logging the file activities in Win32 DLL with the following details Create/Copy/Delete/Move details in the USB Drive - done
Along with Removable Drive Friendly Name – doing
I am not much familiar with system side Activities.
I hope we can use the WMI in Win32 dll applications . I will try it out.
And If u have any idea on this help me out.
Thank you.
|
|
|
|
|
jacob raj wrote: I hope we can use the WMI in Win32 dll applications .
Yes, you can - it's just a set of COM interfaces and objects, so is callable from C++.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello Friends
I was using findfirstFile to find files in a folder but now i hv to search in subfolder.Do u know any solution or any other function?
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
|
You need a recursive function to find the files within sub-folders.
Check if the dwFileAttributes is FILE_ATTRIBUTE_DIRECTORY and if it is, pass its name as the root folder and call the same function from within.
The function signature would be something like this.
int RecursiveFind(TCHAR* lpFileName, TCHAR* lpRootFolder);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
FILE_ATTRIBUE_DIRECTORY is there but i m not getting,
Here is the scenario:
char defaultPath[256]="C:\\Program Files\\sample\\";
char filename[256]="abc.max";
WIN32_FIND_DATA FindData;
HANDLE hFind;
hFind = FindFirstFile( filename, &FindData );
m i using like this.But i m not getting.
|
|
|
|