winapi - Call StrFormatByteSize64 function from within C# -
How do I call the StrFormatByteSize64 function from Win API from Win API? I'm trying the following code, but without success:
[DllImport ("shlwapi.dll")] static extern zero StrFormatByteSize64 (Ulong qdw, four [pszBuf], uint cchBuf) ; Four [] temp = new cell [128]; Ulhone Size = 2000; StrFormatByteSize64 (size, temp, 128); Console.WriteLine (Temporary);
The documents of the function can be found here:
Thanks!
This works, however this may not be the safest way:
Using the system; Using System.Runtime.InteropServices; Using System.Text; Public Class Test {[DllImport ("shlwapi.dll")) Static Externis Zero StormTormat Files 64 (Ulleung QW, StringBuilder Builder, UIT CCTF); Static zero main () {ulong size = 2000; Stringbuilder builder = new stingbuilder (128); StrFormatByteSize64 (size, builder, builder. Capability); Console.WriteLine (Builder); }}
I am afraid that I do not know much about the interop - it may be that you do not have to specify the initial capacity of StringBuilder
, for example. I'm not sure :( Anyway, you should provide a starting point for further investigation.
Comments
Post a Comment