win32api

A module, encapsulating the Windows Win32 API.

Functions

BeginUpdateResource(filename, delete) Get a handle that can be used by the UpdateResource().
EndUpdateResource(handle, discard) End the update resource of the handle.
EnumResourceLanguages(hModule, lpType, lpName) List languages of a resource module.
EnumResourceNames(hModule, resType) Enumerates all the resources of the specified type within a module.
EnumResourceTypes(hModule) Enumerates resource types within a module.
FreeLibrary(hModule) Free the loaded dynamic-link library (DLL) module.
GetSystemDirectory() Get the System directory.
GetTickCount() The number of milliseconds that have elapsed since startup
GetWindowsDirectory() Get the Windows directory.
LoadLibraryEx(fileName, handle, flags) Loads the specified DLL, and returns the handle.
LoadResource(hModule, type, name[, language]) Find and Load a resource component.
UpdateResource(handle, type, name, data[, ...]) Update a resource.


win32ctypes.pywin32.win32api.BeginUpdateResource(filename, delete)[source]

Get a handle that can be used by the UpdateResource().

Parameters:
  • fileName (unicode) – The filename of the module to load.
  • delete (bool) – When true all existing resources are deleted
Returns:

result (hModule) – Handle of the resource.

See also

win32ctypes.pywin32.win32api.EndUpdateResource(handle, discard)[source]

End the update resource of the handle.

Parameters:
  • handle (hModule) – The handle of the resource as it is returned by BeginUpdateResource()
  • discard (bool) – When True all writes are discarded.

See also

win32ctypes.pywin32.win32api.EnumResourceLanguages(hModule, lpType, lpName)[source]

List languages of a resource module.

Parameters:
  • hModule (handle) – Handle to the resource module.
  • lpType (str or int) – The type of resource to enumerate. If lpType is a string starting with ‘#’, it should be followed by the decimal number that define the integer resource type identifier.
  • lpName (str or int) – The name of resource to enumerate. If lpType is a string starting with ‘#’, it should be followed by the decimal number that define the integer resource type identifier.
Returns:

resource_languages (list) – List of the resource language ids.

See also

win32ctypes.pywin32.win32api.EnumResourceNames(hModule, resType)[source]

Enumerates all the resources of the specified type within a module.

Parameters:
  • hModule (handle) – The handle to the module.
  • resType (str or int) – The type of resource to enumerate. If resType is a string starting with ‘#’ is should be followed by the decimal number that define the integer resource type identifier.
Returns:

resource_names (list) – The list of resource names (unicode strings) of the specific resource type in the module.

See also

win32ctypes.pywin32.win32api.EnumResourceTypes(hModule)[source]

Enumerates resource types within a module.

Parameters:hModule (handle) – The handle to the module.
Returns:resource_types (list) – The list of resource types in the module.

See also

win32ctypes.pywin32.win32api.FreeLibrary(hModule)[source]

Free the loaded dynamic-link library (DLL) module.

If necessary, decrements its reference count.

Parameters:handle (hModule) – The handle to the library as returned by the LoadLibrary function.
win32ctypes.pywin32.win32api.GetSystemDirectory()[source]

Get the System directory.

Returns:result (str) – The path to the System directory.

See also

win32ctypes.pywin32.win32api.GetTickCount()[source]

The number of milliseconds that have elapsed since startup

Returns:counts (int) – The millisecond counts since system startup. Can count up to 49.7 days.

See also

win32ctypes.pywin32.win32api.GetWindowsDirectory()[source]

Get the Windows directory.

Returns:result (str) – The path to the Windows directory.

See also

win32ctypes.pywin32.win32api.LoadLibraryEx(fileName, handle, flags)[source]

Loads the specified DLL, and returns the handle.

Parameters:
  • fileName (unicode) – The filename of the module to load.
  • handle (int) – Reserved, always zero.
  • flags (int) – The action to be taken when loading the module.
Returns:

handle (hModule) – The handle of the loaded module

See also

win32ctypes.pywin32.win32api.LoadResource(hModule, type, name, language=0)[source]

Find and Load a resource component.

Parameters:
  • handle (hModule) – The handle of the module containing the resource. Use None for current process executable.
  • type (str or int) – The type of resource to load.
  • name (str or int) – The name or Id of the resource to load.
  • language (int) – Language to use, default is LANG_NEUTRAL.
Returns:

resource (bytes) – The byte string blob of the resource

See also

win32ctypes.pywin32.win32api.UpdateResource(handle, type, name, data, language=0)[source]

Update a resource.

Parameters:
  • handle (hModule) – The handle of the resource file as returned by BeginUpdateResource().
  • type (str or int) – The type of resource to update.
  • name (str or int) – The name or Id of the resource to update.
  • data (bytes) – A bytes like object is expected.
  • language (int) – Language to use, default is LANG_NEUTRAL.

See also