Nun Aurbiz
2008-11-03 03:18:12 UTC
How do I make a minimal Windows application in Haskell? I know there are Win API bindings in the libraries, and of course the ffi lets you call into and out of C, but I have no sense of how to bring it all together. I can't find any samples either.
Is the Haskell code the "main" application and you just ffi into the Win API? Or does it ffi into a win_main.c that I write? Or is the win_main.c the "main" application and it calls into Haskell?
Here is what I am talking about by a "minimal Windows application" (written in psuedo C code).
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
LRESULT CALLBACK windowsProcedure(..) {
switch(message) {
case WM_CLOSE:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(..);
}
int APIENTRY WinMain(..){
WNDCLASS window_class;
RegisterClass(&window_class)
window = CreateWindow(..);
ShowWindow(..);
while(true) {
/* do whatever */
while(PeekMessage(..))
if(msg.message == WM_QUIT)
return msg.wParam;
else
DispatchMessage(&msg);
}
return 0;
}
Is the Haskell code the "main" application and you just ffi into the Win API? Or does it ffi into a win_main.c that I write? Or is the win_main.c the "main" application and it calls into Haskell?
Here is what I am talking about by a "minimal Windows application" (written in psuedo C code).
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
LRESULT CALLBACK windowsProcedure(..) {
switch(message) {
case WM_CLOSE:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(..);
}
int APIENTRY WinMain(..){
WNDCLASS window_class;
RegisterClass(&window_class)
window = CreateWindow(..);
ShowWindow(..);
while(true) {
/* do whatever */
while(PeekMessage(..))
if(msg.message == WM_QUIT)
return msg.wParam;
else
DispatchMessage(&msg);
}
return 0;
}