⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-windows-compatibility-functions.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Windows Compatibility Functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-utilities.html" title="GLib Utilities"><link rel="prev" href="glib-Testing.html" title="Testing"><link rel="next" href="glib-data-types.html" title="GLib Data Types"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"><link rel="index" href="ix06.html" title="Index of new symbols in 2.8"><link rel="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"><link rel="index" href="ix09.html" title="Index of new symbols in 2.14"><link rel="index" href="ix10.html" title="Index of new symbols in 2.16"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Testing.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GLib Reference Manual</th><td><a accesskey="n" href="glib-data-types.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3225798" class="shortcut">Top</a>                  &#160;|&#160;                  <a href="#id3226024" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="glib-Windows-Compatibility-Functions"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3225798"></a><span class="refentrytitle">Windows Compatibility Functions</span></h2><p>Windows Compatibility Functions &#8212; UNIX emulation on Windows</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include &lt;glib.h&gt;#define             <a class="link" href="glib-Windows-Compatibility-Functions.html#MAXPATHLEN:CAPS">MAXPATHLEN</a><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-error-message">g_win32_error_message</a>               (<a class="link" href="glib-Basic-Types.html#gint">gint</a> error);<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-getlocale">g_win32_getlocale</a>                   (void);<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory">g_win32_get_package_installation_directory</a>                                                        (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *package,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *dll_name);<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module">g_win32_get_package_installation_directory_of_module</a>                                                        (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> hmodule);<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-subdirectory">g_win32_get_package_installation_subdirectory</a>                                                        (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *package,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *dll_name,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *subdir);<a class="link" href="glib-Basic-Types.html#guint">guint</a>               <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-windows-version">g_win32_get_windows_version</a>         (void);<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-locale-filename-from-utf8">g_win32_locale_filename_from_utf8</a>   (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *utf8filename);#define             <a class="link" href="glib-Windows-Compatibility-Functions.html#G-WIN32-DLLMAIN-FOR-DLL-NAME:CAPS">G_WIN32_DLLMAIN_FOR_DLL_NAME</a>        (static, dll_name)#define             <a class="link" href="glib-Windows-Compatibility-Functions.html#G-WIN32-HAVE-WIDECHAR-API:CAPS">G_WIN32_HAVE_WIDECHAR_API</a>           ()#define             <a class="link" href="glib-Windows-Compatibility-Functions.html#G-WIN32-IS-NT-BASED:CAPS">G_WIN32_IS_NT_BASED</a>                 ()</pre></div><div class="refsect1" lang="en"><a name="id3226024"></a><h2>Description</h2><p>These functions provide some level of UNIX emulation on the Windows platform.If your application really needs the POSIX APIs, we suggest you try the Cygwinproject.</p></div><div class="refsect1" lang="en"><a name="id3226041"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3226052"></a><h3><a name="MAXPATHLEN:CAPS"></a>MAXPATHLEN</h3><a class="indexterm" name="id3226065"></a><pre class="programlisting">#define MAXPATHLEN 1024</pre><p>Provided for UNIX emulation on Windows; equivalent to UNIX macro <a class="link" href="glib-Windows-Compatibility-Functions.html#MAXPATHLEN:CAPS"><code class="literal">MAXPATHLEN</code></a>, which is the maximum length of a filename(including full path).</p></div><hr><div class="refsect2" lang="en"><a name="id3226093"></a><h3><a name="g-win32-error-message"></a>g_win32_error_message ()</h3><a class="indexterm" name="id3226106"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_win32_error_message               (<a class="link" href="glib-Basic-Types.html#gint">gint</a> error);</pre><p>Translate a Win32 error code (as returned by <code class="function">GetLastError()</code>) intothe corresponding message. The message is either language neutral,or in the thread's language, or the user's language, the system'slanguage, or US English (see docs for <code class="function">FormatMessage()</code>). Thereturned string is in UTF-8. It should be deallocated with<a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td><td> error code.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> newly-allocated error message</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3226204"></a><h3><a name="g-win32-getlocale"></a>g_win32_getlocale ()</h3><a class="indexterm" name="id3226218"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_win32_getlocale                   (void);</pre><p>The <a class="link" href="glib-running.html#setlocale" title="Locale"><code class="function">setlocale()</code></a> function in the Microsoft C library uses localenames of the form "English_United States.1252" etc. We want theUNIXish standard form "en_US", "zh_TW" etc. This function gets thecurrent thread locale from Windows - without any encoding info -and returns it as a string of the above form for use in formingfile names etc. The returned string should be deallocated with<a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> newly-allocated locale name.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3226284"></a><h3><a name="g-win32-get-package-installation-directory"></a>g_win32_get_package_installation_directory ()</h3><a class="indexterm" name="id3226299"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_win32_get_package_installation_directory                                                        (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *package,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *dll_name);</pre><p>Try to determine the installation directory for a software package.</p><p>This function will be deprecated in the future. Use<a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module"><code class="function">g_win32_get_package_installation_directory_of_module()</code></a> instead.</p><p>The use of <em class="parameter"><code>package</code></em> is deprecated. You should always pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p><p>The original intended use of <em class="parameter"><code>package</code></em> was for a short identifier ofthe package, typically the same identifier as used for<code class="literal">GETTEXT_PACKAGE</code> in software configured using GNUautotools. The function first looks in the Windows Registry for thevalue <code class="literal">#InstallationDirectory</code> in the key<code class="literal">#HKLM\Software\<em class="parameter"><code>package</code></em></code>, and if that valueexists and is a string, returns that.</p><p>It is strongly recommended that packagers of GLib-using librariesfor Windows do not store installation paths in the Registry to beused by this function as that interfers with having severalparallel installations of the library. Enabling multipleinstallations of different versions of some GLib-using library, orGLib itself, is desirable for various reasons.</p><p>For this reason it is recommeded to always pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> as<em class="parameter"><code>package</code></em> to this function, to avoid the temptation to use theRegistry. In version 2.18 of GLib the <em class="parameter"><code>package</code></em> parameterwill be ignored and this function won't look in the Registry at all.</p><p>If <em class="parameter"><code>package</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, or the above value isn't found in theRegistry, but <em class="parameter"><code>dll_name</code></em> is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, it should name a DLL loadedinto the current process. Typically that would be the name of theDLL calling this function, looking for its installationdirectory. The function then asks Windows what directory that DLLwas loaded from. If that directory's last component is "bin" or"lib", the parent directory is returned, otherwise the directoryitself. If that DLL isn't loaded, the function proceeds as if<em class="parameter"><code>dll_name</code></em> was <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p><p>If both <em class="parameter"><code>package</code></em> and <em class="parameter"><code>dll_name</code></em> are <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the directory from wherethe main executable of the process was loaded is used instead inthe same way as above.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>package</code></em>&#160;:</span></p></td><td> You should pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for this.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>dll_name</code></em>&#160;:</span></p></td><td> The name of a DLL that a package provides in UTF-8, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a string containing the installation directory for<em class="parameter"><code>package</code></em>. The string is in the GLib file name encoding,i.e. UTF-8. The return value should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> when notneeded any longer. If the function fails <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3226633"></a><h3><a name="g-win32-get-package-installation-directory-of-module"></a>g_win32_get_package_installation_directory_of_module ()</h3><a class="indexterm" name="id3226650"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_win32_get_package_installation_directory_of_module                                                        (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> hmodule);</pre><p>This function tries to determine the installation directory of asoftware package based on the location of a DLL of the softwarepackage.</p><p><em class="parameter"><code>hmodule</code></em> should be the handle of a loaded DLL or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Thefunction looks up the directory that DLL was loaded from. If<em class="parameter"><code>hmodule</code></em> is NULL, the directory the main executable of the currentprocess is looked up. If that directory's last component is "bin"or "lib", its parent directory is returned, otherwise the directoryitself.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -