Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Windows Nt support
bluearms:
Official Code::Blocks 1.0rc2 installer works ok in windows nt. But when closing installed application, I received invalid memory access error.
Recent svn build uses GetMonitorInfo API to position gui, but that api is supported after windows 2000 or windows 98. I found that in the sdk/globals.cpp
Because of that api, svn version can not start in windows nt.
I hopes that api is avoided in the future svn version. or use GetProcAddress(GetModuleHandle("user32.dll"), "GetMonitorInfoA") to check that api is available.
I think some svn version is more stable even in the windows xp.
stahta01:
Under NT 4.0 what would be the valid values for the monitor RECT structure
right
left
bottom
top
Tim S
stahta01:
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.
--- Code: ---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
+
}
--- End code ---
Belgabor:
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?
stahta01:
--- Quote from: Belgabor on January 14, 2007, 04:36:58 am ---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?
--- End quote ---
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.
--- Code: ---if ( wxGetWinVersion() >= wxWinVersion_98 )
--- End code ---
Tim S
Edit: See if wxClientDisplayRect returns useful info for fixing this issue.
Navigation
[0] Message Index
[#] Next page
Go to full version