Formatting device from a script on Windows

volcano Mark.Geyzer at gmail.com
Tue Sep 19 08:09:07 EDT 2006


weir wrote:
> this may help, you need ctypes module.
>
> ##############################
> from ctypes import *
>
> fm = windll.LoadLibrary('fmifs.dll')
>
> def myFmtCallback(command, modifier, arg):
>     print command
>     return 1	# TRUE
>
> FMT_CB_FUNC = WINFUNCTYPE(c_int, c_int, c_int, c_void_p)
>
>
> FMIFS_HARDDISK = 0x0C
> fm.FormatEx(c_wchar_p('H:\\'), FMIFS_HARDDISK, c_wchar_p('NTFS'),
> c_wchar_p('title'), True, c_int(0), FMT_CB_FUNC(myFmtCallback))

Thanks for info, but somehow I am getting "invalid syntax" on this.
What could go wrong?




More information about the Python-list mailing list