+
<HTML>
<HEAD>
<TITLE>wxWindows 2 for Windows FAQ</TITLE>
</HEAD>
-<BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#FF0000 VLINK=#000000>
+<BODY BGCOLOR=#FFFFFF TEXT=#000000 VLINK="#00376A" LINK="#00529C" ALINK="#313063">
<font face="Arial, Lucida Sans, Helvetica">
-<table width=100% border=0 cellpadding=5 cellspacing=0>
+<table width=100% border=0 cellpadding=3 cellspacing=0>
<tr>
-<td bgcolor="#C4ECF9">
-<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000">
-wxWindows 2 for Windows FAQ
+<td bgcolor="#004080" align=left height=24 background="images/bluetitlegradient.gif">
+<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF">
+<b>wxWindows 2 for Windows FAQ</b>
</font>
</td>
</tr>
<ul>
<li><a href="#platforms">Which Windows platforms are supported?</a></li>
<li><a href="#wince">What about Windows CE?</a></li>
+<li><a href="#winxp">What do I need to do for Windows XP?</a></li>
<li><a href="#compilers">What compilers are supported?</a></li>
<li><a href="#bestcompiler">Which is the best compiler to use with wxWindows 2?</a></li>
<li><a href="#unicode">Is Unicode supported?</a></li>
+<li><a href="#doublebyte">Does wxWindows support double byte fonts (Chinese/Japanese/Korean etc.)?</a></li>
<li><a href="#dll">Can you compile wxWindows 2 as a DLL?</a></li>
<li><a href="#exesize">How can I reduce executable size?</a></li>
<li><a href="#mfc">Is wxWindows compatible with MFC?</a></li>
+<li><a href="#setuph">Why do I get errors about setup.h not being found?</a></li>
+<li><a href="#asuffix">Why do I get errors about FooBarA when I only use FooBar in my program?</a></li>
<li><a href="#newerrors">Why my code fails to compile with strange errors about new operator?</a></li>
<li><a href="#mfcport">How do I port MFC applications to wxWindows?</a></li>
<li><a href="#crash">Why do I sometimes get bizarre crash problems using VC++ 5/6?</a></li>
<li><a href="#makefiles">How are the wxWindows makefiles edited under Windows?</a></li>
<li><a href="#vcdebug">How do you use VC++'s memory leak checking instead of that in wxWindows?</a></li>
<li><a href="#shortcutproblem">Why are menu hotkeys or shortcuts not working in my application?</a></li>
+<li><a href="#regconfig">Why can I not write to the HKLM part of the registry with wxRegConfig?</a></li>
+<li><a href="#access">Is MS Active Accessibility supported?</a></li>
</ul>
<hr>
<h3><a name="platforms">Which Windows platforms are supported?</a></h3>
wxWindows 2 can be used to develop and deliver applications on Windows 3.1, Win32s,
-Windows 95, Windows 98, and Windows NT. A Windows CE version is being looked into (see below).<P>
+Windows 95, Windows 98, Windows NT, Windows 2000, and Windows XP. A Windows CE
+version is being looked into (see below).<P>
wxWindows 2 is designed to make use of WIN32 features and controls. However, unlike Microsoft,
we have not forgotten users of 16-bit Windows. Most features
16-bit compilation is supported under Visual C++ 1.5, and Borland BC++ 4 to 5.
<P>
-wxWindows 2 for Windows will also compile on Unix with gcc using TWIN32 from <a href="http://www.willows.com" target=_top>Willows</a>,
-although TWIN32 is still in a preliminary state. The resulting executables are
-Unix binaries that work with the TWIN32 Windows API emulator.<P>
+wxWindows 2 for Windows will also compile on Unix with gcc using Wine from <a href="http://www.winehq.org" target=_top>WineHQ</a>.
+The resulting executables are Unix binaries that work with the Wine Windows API emulator.<P>
You can also compile wxWindows 2 for Windows on Unix with Cygwin or Mingw32, resulting
in executables that will run on Windows. So in theory you could write your applications
using wxGTK or wxMotif, then check/debug your wxWindows for Windows
-programs with TWIN32, and finally produce an ix86 Windows executable using Cygwin/Mingw32,
+programs with Wine, and finally produce an ix86 Windows executable using Cygwin/Mingw32,
without ever needing a copy of Microsoft Windows. See the Technical Note on the Web site detailing cross-compilation.<P>
<h3><a name="wince">What about Windows CE?</a></h3>
the statically-linked 'minimal' sample), shoehorning wxWindows 2 into a Windows CE device's limited
storage should not be a problem.<P>
+<h3><a name="winxp">What do I need to do for Windows XP?</a></h3>
+
+In the same directory as you have your executable (e.g. foo.exe) you
+put a file called foo.exe.manifest in which you have something like
+the following:
+
+<pre>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly
+ xmlns="urn:schemas-microsoft-com:asm.v1"
+ manifestVersion="1.0">
+<assemblyIdentity
+ processorArchitecture="x86"
+ version="5.1.0.0"
+ type="win32"
+ name="foo.exe"/>
+ <description>Foo program</description>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ processorArchitecture="x86"/>
+ </dependentAssembly>
+ </dependency>
+</assembly>
+</pre>
+
+If you want to add it to your application permanently,
+you can also include it in your .rc file using this
+line:<P>
+
+<PRE>
+ 1 24 "winxp.manifest"
+</PRE>
+
+In wxWindows 2.5, this will be in the wx/msw/wx.rc and
+so will happen automatically so long as you include wx.rc
+in your own .rc file.<P>
+
+For an explanation of this syntax, please see
+<a href="http://delphi.about.com/library/bluc/text/uc111601a.htm" target=_new>this
+article</a>.
+<P>
+
<h3><a name="compilers">What compilers are supported?</a></h3>
Please see the wxWindows 2 for Windows install.txt file for up-to-date information, but
Yes, Unicode is fully supported under Windows NT/2000 (Windows 9x don't
have Unicode support anyhow).
+<h3><a name="doublebyte">Does wxWindows support double byte fonts (Chinese/Japanese/Korean etc.)?</a></h3>
+
+An answer from <a href="mailto:goedde@logosoft.de">Klaus Goedde</a>:<p>
+
+"For Japanese under Win2000, it seems that wxWindows has no problems to work with double byte char sets
+(I mean DBCS, that's not Unicode). First you have to install Japanese support on your Win2K system
+and choose for ANSI translation
+HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage=932 (default is 1252 for Western).
+Then you can see all the funny Japanese letters under wxWindows too.<P>
+
+In a wxTextCtrl control you have to set the window style "wxTE_RICH", otherwise this control shows the wrong
+letters.
+
+I don't now whether it works on non W2K systems, because I'm just starting using wxWindows."
+<P>
+
<h3><a name="dll">Can you compile wxWindows 2 as a DLL?</a></h3>
Yes (using the Visual C++ or Borland C++ makefile), but be aware that distributing DLLs is a thorny issue
compile your programs for release using non-debugging and space-optimisation options, but
take with VC++ 5/6 space optimisation: it can sometimes cause problems.<P>
-Statically-linked wxWindows 2 programs are smaller than wxWindows 1.xx programs, because of the way
-wxWindows 2 has been designed to reduce dependencies between classes, and other
-techniques. The linker will not include code from the library that is not (directly or
-indirectly) referenced
-by your application. So for example, the 'minimal' sample is less than 300KB using VC++ 6.<P>
-
If you want to distribute really small executables, you can
-use <a href="http://www.icl.ndirect.co.uk/petite/" target=_top>Petite</a>
+use <a href="http://www.un4seen.com/petite/" target=_top>Petite</a>
by Ian Luck. This nifty utility compresses Windows executables by around 50%, so your 500KB executable
will shrink to a mere 250KB. With this sort of size, there is reduced incentive to
-use DLLs.<P>
+use DLLs. Another good compression tool (probably better than Petite) is <a href="http://upx.sourceforge.net/" target=_top>UPX</a>.
+<P>
+
+Please do not be surprised if MinGW produces a statically-linked minimal executable of 1 MB. Firstly, gcc
+produces larger executables than some compilers. Secondly, this figure will
+include most of the overhead of wxWindows, so as your application becomes more
+complex, the overhead becomes proportionally less significant. And thirdly, trading executable compactness
+for the enormous increase in productivity you get with wxWindows is almost always well worth it.<P>
+
+If you have a really large executable compiled with MinGW (for example 20MB) then
+you need to configure wxWindows to compile without debugging information: see
+docs/msw/install.txt for details. You may find that using configure instead
+of makefile.g95 is easier, particularly since you can maintain debug and
+release versions of the library simultaneously, in different directories.
+Also, run 'strip' after linking to remove all traces of debug info.
+<P>
<H3><a name="mfc">Is wxWindows compatible with MFC?</a></H3>
application. However, don't expect to be able to enable wxWindows windows with OLE-2
functionality using MFC.<P>
+<H3><a name="setuph">Why do I get errors about setup.h not being found?</a></H3>
+
+When you build the wxWindows library, setup.h is copied
+from include/wx/msw/setup.h to e.g. lib/mswd/wx/setup.h (the path
+depends on the configuration you're building). So you need to add
+this include path if building using the static Debug library:<P>
+
+lib/mswd<P>
+
+or if building the static Release library, lib/msw.<P>
+
+See also the <a href="http://wiki.wxwindows.org/wiki.pl?Table_Of_Contents">wxWiki Contents</a>
+for more information.<P>
+
+
+<H3><a name="asuffix">Why do I get errors about FooBarA when I only use FooBar in my program?</H3>
+
+If you get errors like
+<p>
+<center>
+<tt>no matching function for call to 'wxDC::DrawTextA(const char[5], int,
+int)'</tt>
+</center>
+<p>
+or similar ones for the other functions, i.e. the compiler error messages
+mention the function with the <tt>'A'</tt> suffix while you didn't
+use it in your code, the explanation is that you had included
+<tt><windows.h></tt> header which redefines many symbols to have such
+suffix (or <tt>'W'</tt> in the Unicode builds).
+
+<p>
+The fix is to either not include <tt><windows.h></tt> at all or include
+<tt>"wx/msw/winundef.h"</tt> immediately after it.
+
<H3><a name="newerrors">Why my code fails to compile with strange errors about new operator?</a></H3>
The most common cause of this problem is the memory debugging settings in
<H3><a name="mfcport">How do I port MFC applications to wxWindows?</a></H3>
-Set up your interface from scratch using wxWindows (especially wxDesigner --
+Set up your interface from scratch using wxWindows (especially <a href="http://www.robeling.de" target=_top>wxDesigner</a>
+or <a href="http://www.anthemion.co.uk/dialogblocks/" target=_new>DialogBlocks</a> --
it'll save you a <i>lot</i> of time) and when you have a shell prepared, you can start
'pouring in' code from the MFC app, with appropriate
modifications. This is the approach I have used, and I found
This can happen if you have a child window intercepting EVT_CHAR events and swallowing
all keyboard input. You should ensure that event.Skip() is called for all input that
-isn'used by the event handler.
+isn'used by the event handler.<P>
+
+It can also happen if you append the submenu to the parent
+menu {\it before} you have added your menu items. Do the append {\it after} adding
+your items, or accelerators may not be registered properly.<P>
+
+<H3><a name="#regconfig">Why can I not write to the HKLM part of the registry with wxRegConfig?</a></H3>
+
+Currently this is not possible because the wxConfig family of classes is
+supposed to deal with per-user application configuration data, and HKLM is
+only supposed to be writeable by a user with Administrator privileges. In theory,
+only installers should write to HKLM. This is still a point debated by the
+wxWindows developers. There are at least two ways to work around it if you really
+need to write to HKLM.<P>
+
+First, you can use wxRegKey directly, for example:
+
+<pre>
+ wxRegKey regKey;
+
+ wxString idName(wxT("HKEY_LOCAL_MACHINE\\SOFTWARE\\My Company\\My Product\\Stuff\\"));
+ idName += packid;
+
+ regKey.SetName(idName);
+ {
+ wxLogNull dummy;
+ if (!regKey.Create())
+ {
+ idName = wxT("HKEY_CURRENT_USER\\SOFTWARE\\My Company\\My Product\\Stuff\\");
+ idName += packid;
+ regKey.SetName(idName);
+ if (!regKey.Create())
+ return FALSE;
+ }
+ }
+
+ if (!regKey.SetValue(wxT("THING"), (long) thing)) err += 1;
+
+ regKey.Close();
+
+</pre>
+
+Or, you can employ this trick suggested by Istvan Kovacs:
+
+<pre>
+class myGlobalConfig : public wxConfig
+{
+ myGlobalConfig() :
+ wxConfig ("myApp", "myCompany", "", "", wxCONFIG_USE_GLOBAL_FILE)
+{};
+ bool Write(const wxString& key, const wxString& value);
+}
+
+bool myGlobalConfig::Write (const wxString& key, const wxString& value)
+{
+ wxString path = wxString ("SOFTWARE\\myCompany\\myApp\\") + wxPathOnly(key);
+ wxString new_path = path.Replace ("/", "\\", true);
+ wxString new_key = wxFileNameFromPath (key);
+ LocalKey().SetName (wxRegKey::HKLM, path);
+ return wxConfig::Write (new_key, value);
+}
+</pre>
+
+<H3><a name="#access">Is MS Active Accessibility supported?</a></H3>
+
+This is being worked on. Please see <a href="http://www.wxwindows.org/access.htm">this page</a>
+for the current status.
+
+<P>
</font>