English 中文(简体)
How can I get a volume serial number using wxWidgets?
原标题:

I m looking for a function/class in wxWidgets which can give me a volume serial number (like win32 GetVolumeInformation function does).

I assume that the volume serial number must be pretty much cross-platform.

Thanks in advance.

问题回答

There is no such wxWidgets API, AFAIK.

You might look at this thread in the QT forum:

http://lists.trolltech.com/qt-interest/2004-04/thread00756-0.html

The lpVolumeSerialNumber member of GetVolumeInformation() is a OS-assigned serial number (when a drive is formatted). It s not specific to Windows per se, but file systems Microsoft uses (e.g. FATs, NTFS, etc.).

What are you trying to achieve? If you need a consistent number across platforms (assuming the same physical hard drive(s)) look into retrieving the physical HDD serial number. You can do this in Windows via WMI and/or DeviceIoControl(). I m sure similar IOCTL s exist in Linux or you can utilize iostat -En or perhaps cfgadm -alv (See http://prefetch.net/blog/index.php/2010/07/13/locating-physical-disk-drives-in-solaris/ -- I believe most Un*x and Linux systems have about the same utilities for this)





相关问题
XML-RPC Standard and XML Data Type

I was looking at XML-RPC for a project. And correct me if I m wrong, but it seems like XML-RPC has no XML datatype. Are you supposed to pass as a string? or something else? Am I missing something? ...

How can I get a volume serial number using wxWidgets?

I m looking for a function/class in wxWidgets which can give me a volume serial number (like win32 GetVolumeInformation function does). I assume that the volume serial number must be pretty much ...

Creating & Editing MS-Word documents on a linux server?

Looking to develop server-side application that will process documents. The source documents are mostly MS-Word 2003, 2007, i.e. the MS version of Docx. Want the server application to be able to run ...

Compiling windows binaries from Ubuntu?

I am doing a cross-platform C (not ++) game with both linux (main) and windows (alternate) binaries. Until now I used devcpp to compile in windows, but I have trouble getting some libraries to work ...

SWT Cross-Platform Enter Detection

I have a global filter (Display.addFilter) in SWT in which I want to detect Enter key. In Windows, pressing Enter generates SWT.CR in keyCode part of KeyListener event. Is this assumption safe for ...

Python app distribution cross-platform

I want to distribute my app on OSX (using py2app) and as a Debian package. The structure of my app is like: app/ debian/ <lots of debian related stuff> scripts/ ...

热门标签