Thanks,
David Eddy
noch...@earthlink.net
SHFILEOPSTRUCT FileStruct;
memset(&FileStruct, 0, sizeof(FileStruct));
FileStruct.wFunc = FO_RENAME;
FileStruct.pFrom = "*.txt\0";
FileStruct.pTo = "*.doc\0";
SHFileOperation(&FileStruct);
Hope this helps
Ben Walsh
http://www.planet-source-code.com/vb/
You will find many example of this API call to copy/rename/delete/move files
and folders.
Peter
Hello,
Does this code really work for you? When I try and implement it like this I
get a Window's error that says:
"Cannot create or replace *. Cannot find the specified file... Make sure you
specify the correct path and filename"
Any ideas why?
David
hi...@btinternet.com wrote in message <34EEABEC...@btinternet.com>...
>Hi Eddy
>You can rename files using wildcards as follows:
>
>SHFILEOPSTRUCT FileStruct;
>memset(&FileStruct, 0, sizeof(FileStruct));
>FileStruct.wFunc = FO_RENAME;
>FileStruct.pFrom = "*.txt\0";
>FileStruct.pTo = "*.doc\0";
>SHFileOperation(&FileStruct);
>
>Hope this helps
>
>Ben Walsh
>
Public Const FO_RENAME = &H4
Public Const FOF_FILESONLY = &H80 ' on *.*, do only files
Public Const FOF_NOCONFIRMATION = &H10 ' Don't prompt the user.
Public Function BinReName(FromFileName As String, ToFileName As String) As
Boolean
Dim FileOperation As SHFILEOPSTRUCT
Dim lReturn As Long
On Error Resume Next
With FileOperation
.wFunc = FO_RENAME
.pFrom = FName
.pTo = TName
.fFlags = FOF_NOCONFIRMATION Or FOF_FILESONLY
End With
lReturn = SHFileOperation(FileOperation)
BinReName = (lReturn = 0)
End Function
Hope this works for you.
Jyrki H.
jyrki.ha...@ids.fi
David Eddy wrote in message <6ckl7d$f...@chile.earthlink.net>...
I tried using this function in my code, and got the following error:
Can't find DLL entry point SHFileOperationA in shell32.dll
I have seen this error before, but can't remember how to fix it. I am
calling other shell32.dll functions in my program without error. I
pasted the declare, type and contants from the VB5 API viewer. Does
anyone recognize this, and know what the solution is?
I'm using Win95B (OSR2) if that makes any difference.
--
Michael R. Urban
Lead Meteorologist
National Weather Service, WFO Wichita, Kansas
ur...@sac.ict.noaa.gov
Jyrki H wrote:
> Try using this function (Ret = BinRename("c:\temp\*.TXT","c:\temp\*.doc") )
> :
>
> Public Const FO_RENAME = &H4
> Public Const FOF_FILESONLY = &H80 ' on *.*, do only files
> Public Const FOF_NOCONFIRMATION = &H10 ' Don't prompt the user.
>
> Public Function BinReName(FromFileName As String, ToFileName As String) As
> Boolean
> Dim FileOperation As SHFILEOPSTRUCT
> Dim lReturn As Long
> On Error Resume Next
> With FileOperation
> .wFunc = FO_RENAME
> .pFrom = FName
> .pTo = TName
> .fFlags = FOF_NOCONFIRMATION Or FOF_FILESONLY
> End With
> lReturn = SHFileOperation(FileOperation)
> BinReName = (lReturn = 0)
> End Function
>
> Hope this works for you.
>
> Jyrki H.
> jyrki.ha...@ids.fi
>
Something likes this (just an example)
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "
RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal
lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Try deleting the space and see what happens.
Stephen Goneau
Michael Urban wrote in message <34F3B6...@sac.ict.noaa.gov>...
Jyrki.
hi...@btinternet.com wrote in message <34F3F8AD...@btinternet.com>...