Page 1 of 1

Who can make the longest Hello world program?

Posted: Mon Nov 10, 2003 1:00 am
by DriakTravo
Im bored, Who can make the longest, most complicated Hello world program?

Posted: Mon Nov 10, 2003 1:12 am
by Codemonger
I'll let you know next year when I'm finished writing it :lol:

Posted: Mon Nov 10, 2003 2:49 am
by DriakTravo
really? is it possible to make one that long?

Posted: Mon Nov 10, 2003 11:03 am
by blueznl
proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it! proof it!

Posted: Mon Nov 10, 2003 8:15 pm
by Kale
I guess this counts due to the un-necessary complexity of the frankinsteins monster that is the Win32 API! :twisted:

Code: Select all

;===========================================================================
;-PROCEDURES
;===========================================================================

;Window callback
Procedure WindowCallback(hWnd, Message, wParam, lParam) 
    Select Message
        Case #WM_CLOSE
            UnregisterClass_("WindowClass", GetModuleHandle_(#NULL))
            Destroywindow_(hWnd)
            ProcedureReturn 0
        Case #WM_DESTROY
            UnregisterClass_("WindowClass", GetModuleHandle_(#NULL))
            PostQuitMessage_(0)
            ProcedureReturn 0
        Case #WM_PAINT
            hDC.l = GetDC_(hWnd)
                GetClientRect_(hWnd, @WindowSize.RECT)
                hFont.l = CreateFont_(230, 22, 0, 0, #FW_BLACK, 0, 0, 0, #DEFAULT_CHARSET, #OUT_DEFAULT_PRECIS, #CLIP_DEFAULT_PRECIS , #PROOF_QUALITY, #DEFAULT_PITCH, "Times New Roman")
                SelectObject_(hDC, hFont)
                DrawText_(hDC, "Hello World", -1, @WindowSize, #DT_SINGLELINE | #DT_CENTER | #DT_VCENTER)
            ReleaseDC_(hWnd, hDC)
    EndSelect
    Result = DefWindowProc_(hWnd, Message, wParam, lParam) 
    ProcedureReturn Result
EndProcedure

;Window class
WindowClass.WNDCLASS
Classname.s = "WindowClass"
WindowClass\style = #CS_HREDRAW | #CS_VREDRAW
WindowClass\lpfnWndProc = @WindowCallback()
WindowClass\cbClsExtra = 0
WindowClass\cbWndExtra = 0
WindowClass\hInstance = GetModuleHandle_(#NULL)
WindowClass\hIcon = LoadIcon_(#NULL, #IDI_APPLICATION)
WindowClass\hCursor = LoadCursor_(#NULL, #IDC_ARROW)
WindowClass\hbrBackground = GetStockObject_(#WHITE_BRUSH)
WindowClass\lpszMenuName = #NULL
WindowClass\lpszClassName = @Classname
RegisterClass_(WindowClass)

;===========================================================================
;-GEOMETRY
;===========================================================================

;Calculate the window position to display it centrally
ScreenWidth.l = GetSystemMetrics_(#SM_CXSCREEN)
ScreenHeight.l = GetSystemMetrics_(#SM_CYSCREEN)
WindowWidth.l = 300
WindowHeight.l = 200
WindowXPosition.l = (ScreenWidth / 2) - (WindowWidth / 2)
WindowYPosition.l = (ScreenHeight/ 2) - (WindowHeight/ 2)

;Open a window 
hWnd.l = CreateWindowEx_(0, "WindowClass", "Hello World", #WS_VISIBLE | #WS_OVERLAPPEDWINDOW | #WS_SIZEBOX , WindowXPosition, WindowYPosition, WindowWidth, WindowHeight, 0, 0, GetModuleHandle_(#NULL), 0) 

;===========================================================================
;-MAIN LOOP
;===========================================================================

If hWnd
    While Getmessage_(Message.MSG, 0, 0, 0)
        TranslateMessage_(Message)
        DispatchMessage_(Message)
    Wend
EndIf