Hi All,

I usually build my windows vims by cross compiling them on my linux box.
This generally works like a charm, however over the years quite a few hacks and ad-hoc fixes have accumulated and I have now finally decided to get rid of them ;)

One of the few things that might be interesting for others is a fix for the following phenomenon: On 32bit Windows the gvim binary works fine,
while on a 64bit Windows nothing happens when it is executed.

A little debugging at that time revealed that when the window procedure for the text area is called with the WM_NCCREATE it essentially just defers handling of the message to DefWindowProc which in turn returns FALSE on my 64bit windows machines. According to the MSDN-docs this aborts the window creation and the corresponding CreateWindowEx function will receive a NULL handle.

To add to the mystery a build compiled the express edition of Visual Studio worked fine as far as I remember.

Since then I have used the attached patch and just blindly returned TRUE for NCCREATE. It must have worked without I'll effects because until now I completely forgot about it ;)

So can anyone else reproduce this particular problem, or better yet, can any win32-api gurus make some sense out of whats going on here?

As for the build environment:
Currently I am using gcc-4.4.2 with the windows headers and crt of the mingw64 project from their svn-trunk. However when this first occurred I was using the official release from the original mingw32 project.

I just verified that all this still happens in a VirtualBox installation of Vista 64, with a vanilla vim build from the current mercurial tip with this command:
  make -f Make_ming.mak GUI=yes \
        CC=i686-w64-mingw32-gcc  \
        CXX=i686-w64-mingw32-g++ \
        WINDRES=i686-w64-mingw32-windres \
        GETTEXT= ICONV= \
        gvim.exe vimrun.exe

Best regards,
Andy
--
Once you've seen one nuclear war, you've seen them all.
diff -r 2bd96108392e src/gui_w48.c
--- a/src/gui_w48.c     Thu Jan 28 22:58:16 2010 +0100
+++ b/src/gui_w48.c     Tue Feb 02 21:56:49 2010 +0100
@@ -1085,6 +1085,14 @@
            return TRUE;
 #endif
 
+    /* XXX: this makes vim work on vista64
+     * seemingly defwindowproc returns false for NCCREATE there
+     * causing the window creation to fail
+     */
+    case WM_NCCREATE:
+       /* not sure is necessary, but it shouldn't hurt either */
+       MyWindowProc(hwnd, uMsg, wParam, lParam);
+       return TRUE;
     default:
        return MyWindowProc(hwnd, uMsg, wParam, lParam);
     }

Attachment: pgp2smhnHtWHj.pgp
Description: PGP signature

Raspunde prin e-mail lui