A quick patch that might fix this issue. A real patch should set the values right, left, bottom & top using some NT4/win95 system call.
Note: There is two blanks lines at bottom of patch, these are there on purpose.
Index: src/sdk/globals.cpp
===================================================================
--- src/sdk/globals.cpp (revision 3481)
+++ src/sdk/globals.cpp (working copy)
@@ -624,8 +624,10 @@
void PlaceWindow(wxWindow *w, cbPlaceDialogMode mode, bool enforce)
{
+#if (_WIN32_WINNT >= 0x0410)
HMONITOR hMonitor;
MONITORINFO mi;
+#endif
RECT r;
int the_mode;
@@ -649,15 +651,16 @@
else
the_mode = (int) mode;
+#if (_WIN32_WINNT >= 0x0410)
hMonitor = MonitorFromWindow((HWND) referenceWindow->GetHandle(), MONITOR_DEFAULTTONEAREST);
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
r = mi.rcWork;
int monitorWidth = r.right - r.left;
- int monitorHeight = r.bottom - r. top;
+ int monitorHeight = r.bottom - r.top;
switch(the_mode)
{
@@ -729,6 +730,10 @@
}
w->SetSize(windowRect.x, windowRect.y, windowRect.width, windowRect.height, wxSIZE_ALLOW_MINUS_ONE);
+#else
+ w->SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxSIZE_AUTO);
+#endif
+
}
Sorry for chiming into an issue that doesn't really concern me :p
That patch allows you to compile a NT4 version, but wouldn't it be better to follow bluearms' suggestion and do a runtime check so a compiled version works on both?
That answer to that is it depends. We need a way to set the values right, left, bottom & top to valid setting.
If this is possible using an NT40/Win95 call that still exists under XP and win2003 we may be able to just use it. Else we should see what version of windows we are running and use good defaults. I don't think looking at the DLL for an entry point is the normal way to code this, but it should work.
My patch was just a quick one to solve the issue for a single user NOT one good enough to submit to C::B team.
if ( wxGetWinVersion() >= wxWinVersion_98 )
Tim S
Edit: See if wxClientDisplayRect returns useful info for fixing this issue.
if ( wxGetWinVersion() >= wxWinVersion_98 )
Tim S
If you just OS check and use API in the source, it can not be solution. Compiled binary requires all DLL reference must be resolved in the runtime (or maybe load time). So in windows 95 and windows nt, unsupported API reference must not exist in the binary. So only option is just use supported API or use dynamic load of DLL and must check API at runtime. OS checking is not necessary, because suspious API can be checked directly at runtime.
I have uploaded the patch for this to Berlios
[ Patch #1823 ] Fix sdk/globals.cpp for WinNT 4.0 Bug
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1823&group_id=5358
Note: Is the problem at Berlios gotten worse it took many trys for me to upload the patch?
The ANSI Binary has been uploaded for win95 and WinNT 4.0 users to test at http://www.savefile.com/projects/1039215
pick the file called codeblocks_ansi.7z
Note: Patches that exists in my ANSI build include
[ Patch #1823 ] Fix sdk/globals.cpp for WinNT 4.0 Bug
https://developer.berlios.de/patch/?func=detailpatch&patch_id=1783&group_id=5358
[ Patch #1783 ] GetConfigFolder patch to make it work in a Portable win32
Note: I also disabled the crashhandler with this patch because PVECTORED_EXCEPTION_HANDLER did NOT exist when I told minGW GCC that I was a WINVER 0400.
Index: src/src/crashhandler.h
===================================================================
--- src/src/crashhandler.h (revision 3483)
+++ src/src/crashhandler.h (working copy)
@@ -1,7 +1,7 @@
#ifndef CRASH_HANDLER
#define CRASH_HANDLER
-#if (__WXMSW__)
+#if defined(__WXMSW__) && defined(PVECTORED_EXCEPTION_HANDLER)
#include <winnt.h>
Index: src/src/crashhandler.cpp
===================================================================
--- src/src/crashhandler.cpp (revision 3483)
+++ src/src/crashhandler.cpp (working copy)
@@ -1,4 +1,4 @@
-#if (__WXMSW__)
+#if defined(__WXMSW__) && defined(PVECTORED_EXCEPTION_HANDLER)
#include "sdk.h"
#ifndef CB_PRECOMP
#include <wx/filefn.h>
Tim S