Who can make the longest Hello world program?
-
DriakTravo
- Enthusiast

- Posts: 346
- Joined: Fri Oct 10, 2003 12:42 am
- Location: Tampa,FL,USA
- Contact:
Who can make the longest Hello world program?
Im bored, Who can make the longest, most complicated Hello world program?
-
Codemonger
- Enthusiast

- Posts: 384
- Joined: Sat May 24, 2003 8:02 pm
- Location: Canada
- Contact:
-
DriakTravo
- Enthusiast

- Posts: 346
- Joined: Fri Oct 10, 2003 12:42 am
- Location: Tampa,FL,USA
- Contact:
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!
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
I guess this counts due to the un-necessary complexity of the frankinsteins monster that is the Win32 API!
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
