Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FindMimeFromData
Message
From
29/05/2001 07:43:35
 
 
To
29/05/2001 07:16:55
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00512103
Message ID:
00512133
Views:
10
Hi!

Hmm, I do not remember any case I required to verify if some file extension is really matchesto its content. I just used the extension to determine file type. If file does not contain what it must contain, the routine that uses that file usually throws the error to user to let user know that file is invalid. Why you need that feature?

As I suggested, ppwzMimeOut is double-pointer (pointer to the pointer). Just a string reference gets a garbage from the memory because it is a single pointer pointer. You require to use some tools or API functions to allocate memory for that buffer, pass a pointer to it to the API function, then get a result from that memory by API function calls. There is a tool in the Files section or somewhere in teh UT messages that allows to handle pointers in the VFP.

HTH.

>Thanks Vlad,
>
>This seems to work.
>And yes, you have it right. My intention is to determine the file type of the disk in windows.
>And indeed the closest I came to this was the MIME type.
>Untill now I didn't find a way to really assure that for example a file with an extension .dbf isn't a plain txt file but really a dbf file.
>
>I hope the FindMimeFromData will already provide me with some feedback and allows me to do some automation and implement some extar safety.
>
>BTW,
>I assume that the @ppwzMimeOut gets populated with the mime type.
>But the variable contains some 'strange' characters I can't define.
>Do you have an idea how to transform this so it returns something meaningfull.
>something like zip, dbf...
>Or how to have the mime type returned from this function.
>
>
>Thanks.
>
>
>>Hi!
>>
>>Try following:
>>
>>DECLARE INTEGER FindMimeFromData IN ??? integer pBC, ;
>>string @pwzUrl, string @pBuffer, integer cbSize, string @pwzMimeProposed,;
>>integer dwMimeFlags, string @ppwzMimeOut, integer dwReserved
>>
>>If you want to use NULL value for pwzUrl, pBuffer or pwzMimeProposed parameters, declare these parameters as integer type and pass zero to function. I'm also not sure about ppwzMimeOut parameter. If it is double-pointer, you will require to use the API functions to allocate the memory for that parameter.
>>
>>HTH.
>>
>>P.S.
>>Well, if you meant the file type of the disk file in Windows, it is determined by Windows using the file extension. And I do not remember any function that verifies if, for example, '.DBF' file really is not a text file. As about the FindMimeFromData function, it just "Determines the MIME type from the data provided." as I see in the MSDN help. If you meant something else, well, be more exact in your questions next time.
>>
>>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform