Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I hate constants
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00620384
Message ID:
00620440
Views:
14
The 0x0400 is correct value for FOF_NOERRORUI constant.
If SHFileOperation return value is none zero, you can use following code to display API error message.
Declare Integer GetLastError In kernel32.dll as GetLastError

Declare Integer FormatMessage In kernel32.dll as FormatMessage ;
		Integer dwFlags, ;
		String @lpSource, ;
		Integer dwMessageId, ;
		Integer dwLanguageId, ;
		String @lpBuffer, ;
		Integer nSize, ;
		Integer Arguments

lcErrorTxt = ApiError()
? lcErrorTxt
RETURN 
*--------------------------------
FUNCTION ApiError

Local lcErrBuffer, lcErrorMess, liNewErr, lnErrorCode
lcErrBuffer = REPL(CHR(0),1000)
lnErrorCode = GetLastError()
liNewErr = FormatMessage(0x1000;
 	,.NULL., lnErrorCode, 0, @lcErrBuffer,500,0)

lcErrorMess = Transform(lnErrorCode) + "    " + LEFT(lcErrBuffer, AT(CHR(0),lcErrBuffer)- 1 )

RETURN lcErrorMess
>I'm still struggling with this API stuff. I think I've posted more messages in the last week than in the last year! Anyway, the latest road block I've hit is trying to turn off the error messages when copying files with SHFileOperation. I had no luck figuring out how to tell me when a file couldn't be copied, so I've resorted to copying one file at a time and checking the return value. That's slower, but it works. The trouble is I can't get it to shut up. I don't want it telling the user when there's an error. I found the constant FOF_NOERRORUI, but no value to go with it. So I went searching some more and found a code fragment that defined it to be 0x0400. But that can't be right because the minute I add that into the list, no files copy. Even if there's nothing wrong with the files and they copied just fine without that.
>
>So does anyone know what number that's supposed to be? And while we're at it, is there any way to find out what the exact error was? Right now, I just know the file name that fails. I found an example in VB, but I can't figure out where in the heck the "err" object is coming from, so that's no use to me.
>
>Help? Anyone? This API stuff is killing me.
>
>Michelle
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform