Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows HTML
I import "htmlayout.dll", call "HTMLayoutLoadFile" function, and the winform come out, but it just display blank. can anybody tell me what is wrong?
 
here is the code:
(println "win32demo")
 
(define (import-list library flist)
    (dolist (fname flist) (import library (string fname))))
 
(define-macro (@setq %var %value)
    (set %var (eval %value))
    (println %var " " (eval %var)))
 
(import-list "kernel32" '(GetModuleHandleA GetConsoleWindow))
(import-list "user32" '(PostQuitMessage DefWindowProcA))
(import-list "user32" '(LoadCursorA RegisterClassA CreateWindowExA))
(import-list "user32" '(ShowWindow UpdateWindow))
(import-list "user32" '(GetMessageA TranslateMessage DispatchMessageA))
 
(import-list "htmlayout.dll" '(HTMLayoutLoadFile))
 
(setq WM_CREATE 1 WM_DESTROY 2 WM_ERASEBKGND 0x0014 WM_CHAR  0x102 WM_LBUTTONDOWN 0x201)
(setq IDC_ARROW 0x7F00 CS_VREDRAW 1 CS_HREDRAW 2 COLOR_WINDOW 5)
(setq WS_OVERLAPPEDWINDOW 0xCF0000 HWND_MESSAGE -3 SW_SHOWDEFAULT 10)
 
(@setq hinstance (GetModuleHandleA 0))
(@setq hconsole (GetConsoleWindow))
(@setq cursor (LoadCursorA 0 IDC_ARROW))
 
(define (window-callback-function hwnd message wparam lparam)
    (cond
        ((= message WM_CREATE) (println "created") (HTMLayoutLoadFile hwnd "default.htm") 0)
        ((= message WM_LBUTTONDOWN) (println "click!") 0)
        ((= message WM_CHAR) (println (format "char %c" wparam)) 0)
        ((= message WM_ERASEBKGND) (println "WM_ERASEBKGND!") true)
        ((= message WM_DESTROY) (println "destroyed") (PostQuitMessage 0) 0)
        (true (DefWindowProcA hwnd message wparam lparam))))
 
(setq wndproc (callback 0 'window-callback-function))
(setq classname (HTMLayoutClassNameA))
 
(println classname)
 
(setq wc (pack (dup "ld" 10)
            (| CS_HREDRAW CS_VREDRAW)   ; style
            wndproc                     ; lpfnWndProc
            0                           ; cbClsExtra
            0                           ; cbWndExtra
            hinstance                   ; hInstance
            0                           ; hIcon
            cursor                      ; hCursor
            (+ COLOR_WINDOW 1)          ; hbrBackground
            0                           ; lpszMenuName
            classname                   ; lpszClassName
         ))
 
(@setq hwc (RegisterClassA wc))
(@setq hwnd (CreateWindowExA
                0                       ; dwExStyle
                classname         ; lpClassName
                "newlisp window"        ; lpWindowName
                WS_OVERLAPPEDWINDOW     ; dwStyle
                80 60 640 480           ; x y w h
                0                       ; hwndParent
                0                       ; hMenu
                hinstance               ; hInstance
                0                       ; hParam
           ))
 
; hconsole and HWND_MESSAGE are other useful values for hwndParent
 
(ShowWindow hwnd SW_SHOWDEFAULT)
(UpdateWindow hwnd)
 

 
(setq msg (pack "n28"))
 
(until (member (GetMessageA msg hwnd 0 0) '(0 -1))
    (TranslateMessage msg)
    (DispatchMessageA msg))
 
(println "the end")
 
(exit)
Posted 18-Mar-13 1:24am
eshioin346

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 410
1 Abhinav S 260
2 Nirav Prabtani 252
3 Andreas Gieriet 155
4 Dave Kreskowiak 155
0 OriginalGriff 7,545
1 Sergey Alexandrovich Kryukov 6,757
2 Maciej Los 3,909
3 Peter Leow 3,693
4 CHill60 2,712


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 18 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100