[Haskell-cafe] a minimal Windows program in Haskell?
Nun Aurbiz
nunofaurbiz at yahoo.com
Sun Nov 2 22:18:12 EST 2008
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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081102/792cc459/attachment.htm
More information about the Haskell-Cafe
mailing list