Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Windows 95 API SHFileOperation
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00092316
Message ID:
00092902
Views:
27
>>>>Has anyone used the SHFileOperation API call in SHELL32.DLL ? it presents the user with a Win95 dialogue box that you see when either copying, renaming, deleting or moving files ( you know the one with the folder flying across the box? ), as it expects to be passed a C type struct I am confused as to how to access it?.
>>>>Many thanks
>>>>Peter Kane
>>>
>>>You can emulate the structure by passing a string containing the concatenated values. However, the structure calls for pointers to strings, so you'll need something like Vlad Tatavu's Pointers Class to get that information.
>>
>>George,
>>thank you for your help, however the structure is a mixture of longs and strings, if I concatenate the structure into a string do I need a pointer to the entire string?
>>Still confused
>>
>>Pete Kane
>>
>>n.b I have the Pointers class.
>
>Simply pass the string by reference once it's built. Be sure, in the declaration, to indicate it as such (using the @ symbol).
>
>I haven't played with this function, but I'd be interested in hearing about the results.

George,
We have a success on our hands, what you have to do is convert all the type long fields in the struct to a string, and obtain a pointer to ( using the pointer classes in my case ) the string fields, concatenate the fields and you're in business. I enclose a sample VFP program for your observation

Regards and thanks
Pete Kane
pk_fox@msn.com

clear all

&& Sample Fox program ( very rough ) of using the SHFileOperation API

&& This program assumes you've got ( and registered ) Vlad Tatavu's pointers.ocx

SET CLASSLIB TO ("c:\pete\api pointer classes\pointers.vcx")
oPointers = CREATEOBJECT("Pointers.pointersctrl1")

declare integer GetActiveWindow in win32api
declare long SHFileOperation in shell32 string @

hwnd = oPointers.Converter.NumberToInteger4String(GetActiveWindow())
wFunc = oPointers.Converter.NumberToInteger4String(0x3)
pFrom = oPointers.GetPointer("c:\pkcopy\*.*" + chr(0) + chr(0))
pTo = oPointers.GetPointer("c:\temp")
fFlags = oPointers.Converter.NumberToInteger4String(0x80)
fAnyOperationsAborted = repl(chr(0),4)
hNameMappings = repl(chr(0),4)
lpszProgressTitle = oPointers.GetPointer("Peters Test")

fileop = hwnd+ wFunc + pFrom + ;
pTo + fFlags + fAnyOperationsAborted ;
+ hNameMappings + lpszProgressTitle

result = SHFileOperation(@fileop)

return(result)
Regards,
Peter J. Kane



Pete
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform