CA - Visual Objects Hello World Example

TEXTBLOCK HELLOWIN.C  --  (c) Charles Petzold, 1992
/*--------------------------------------------------------
   HELLOWIN.C -- Displays "Hello, Windows" in client area
                 (c) Charles Petzold, 1992

   HELLOWIN.PRG - CA Visual Objects adaptation
                        John Forsberg, 1994
  --------------------------------------------------------*/


FUNCTION Start()

  STATIC szAppName := "HelloWin"            AS STRING
  LOCAL hWnd                                                      AS WORD
  LOCAL msg                                                         IS
_WINMSG
  LOCAL wndclass                                               IS
_WINWNDCLASS

  /* Parameters not received by VO */
  LOCAL hPrevinstance := _GetPrevInst()     AS WORD
  LOCAL hInstance          := _GetInst()               AS WORD
  LOCAL nCmdShow      := _GetCmdShow()  AS WORD

  IF hPrevInstance == 0

    wndclass.style         := _OR(CS_HREDRAW, CS_VREDRAW)
    wndclass.lpfnWndProc        := @WndProc()
    wndclass.cbClsExtra            := 0
    wndclass.cbWndExtra         := 0
    wndclass.hInstance              := hInstance
    wndclass.hIcon                      := LoadIcon (hInstance,
IDI_APPLICATION)
    wndclass.hCursor                 := LoadCursor (0, IDC_ARROW)
    wndclass.hbrBackground  := GetStockObject (WHITE_BRUSH)
    wndclass.lpszMenuName := ""
    wndclass.lpszClassName := szAppName

    RegisterClass (@wndclass)
  ENDIF

  hwnd := CreateWindow (szAppName, ;        // window class name
                 "The Hello Program", ;                        // window
caption
                 WS_OVERLAPPEDWINDOW, ;      // window style
                 CW_USEDEFAULT, ;                          // initial x
position
                 CW_USEDEFAULT, ;                          // initial y
position
                 CW_USEDEFAULT, ;                          // initial x
size
                 CW_USEDEFAULT, ;                          // initial y
size
                 0, ;
        // parent window handle
                 0, ;
        // window menu handle
                 hInstance, ;
// program instance handle
                NULL_PTR)                                            //
creation parameters

/*  Not in the book.  Add it if you prefer */
//  if hWnd = 0
//    return FALSE
//  endif

  ShowWindow (hwnd, nCmdShow)
  UpdateWindow (hwnd)

  WHILE (GetMessage (@msg, 0, 0, 0))
       TranslateMessage (@msg)
       DispatchMessage (@msg)
  END

  /* Not in the book.  Add it if you prefer */
  //  UnregisterClass ( szAppName, hInstance )
RETURN msg.wParam

FUNCTION WndProc (hwnd AS WORD, message AS WORD, wParam AS WORD, ;
                  lParam AS LONG) AS LONG  _WINCALL

     LOCAL hdc  AS WORD
     LOCAL ps   IS _WINPAINTSTRUCT
     LOCAL rect IS _WINRECT

     DO CASE
          CASE message == WM_PAINT
            hdc := BeginPaint (hwnd, @ps)

            GetClientRect (hwnd, @rect)

            DrawText (hdc, "Hello, Windows!", -1, @rect, ;
                      _OR(_OR(DT_SINGLELINE, DT_CENTER), DT_VCENTER))

            EndPaint (hwnd, @ps)
            RETURN 0L

          CASE message == WM_DESTROY
            PostQuitMessage (0)
            RETURN 0L

          ENDCASE

RETURN DefWindowProc (hwnd, message, wParam, lParam)

4 4DOS 4th Dimension 
A A#.Net A+ A++ ABAP ABAP - SAP AG ABC Action! ActionScript 1.0 and 2.0 ActionScript 3 Ada Alef++ ALGOL 68 AmigaE AMX NetLinx Android APL AppleScript Arc ASCII ASP ASP.NET ASSEMBLER x86 (DOS, FASM) ASSEMBLER x86 (DOS, MASM) AutoHotkey AutoIt AutoLisp Avenue - Scripting language for ArcView GIS AviSynth AWK 
B B Baan Tools Ball Bash or sh BASIC BATCH bc BCPL Befunge BITGGAL AgileDog BITGGAL Jihwaja BLISS BlitzBasic BlooP, FlooP boo Brainfuck Burning Sand 2 
C C C# C++ C++, Managed (.NET) C++/CLI C-shell C/AL - MBS Navision CA - Visual Objects Calprola Casio FX-9750 CCL CGI written in C Ch Chef Chrome Chuck CIL CintieFramework (VisualBasic.NET) CISC Amiga (Workbench 2.0): Motorola 68000 CISC Atari: Motorola 68000 Clean Clipper CLIST Clojure CLU COBOL ColdFusion ColdFusion (CFML) COMAL Command WI Command WoI Common Lisp ConTeXt CORC CSS Cube 
D D D++ DarkBASIC DC an arbitrary precision calculator DCL batch Delphi DIV DOLL Dream Maker DUNNBOL1 Dylan 
E EAS 0.0.1.* Ed and Ex (Ed extended) Eiffel Emacs Lisp Erlang Euphoria Expanded accumulator machine: Intel x86, DOS, TASM Expanded accumulator machine:Intel x86, Linux, GAS 
F F# Factor False Ferite FileNet WorkFlo Language filePro FOCAL Focus Forte TOOL Forth Fortran Free-Form Syntax FreeBasic Fril Frink 
G Gambas GEMBase 4GL General General-purpose fictional computer: MIX, MIXAL General-purpose fictional computer: MMIX, MMIXAL GML (Game Maker Language) GO (from google) GraalScript 1 GraalScript 2 Groovy 
H Haskell haXe Heron HP 33s HP-41 & HP-42S HQ9+ HTML HTML 4.01 Strict (full) HTML 4.01 Strict (smallest) 
I IBM 1401 IDL Inform 5/6 Inform 7 Informal Ingres 4GL Intercal INTERCAL programming language Io Iptscrae ISETL (Interactive Set Language) 
J J Jal Java Java byte-code JavaFX JavaScript Joy JSP 
K K KEMURI Kogut KPL (Kids Programming Language) 
L Lasso LaTeX 2e Lexico Mobile (in spanish) Liberty BASIC Limbo Linden Scripting Language Lingo (Macromedia Director scripting language) Linotte Lisaac Logo LOLCODE LPC LuaPSP 
M M (MUMPS) M4 Macsyma, Maxima Mainframe: IBM z/Architecture series using BAL Malbolge programming language Maple Mathematica MATLAB Maude Max Maya Embedded Language Message Window Microsoft Small Basic mIRC Script (aliases) mIRC Script (command line) mIRC Script (popups) mIRC Script (remote) Model 204 Modula-2 MOO MOS6510 assembly on a C=64 Mouse MS-DOS batch MUF 
N Natural Neko Nemerle 
O Oberon Object-Oriented C Version OCaml occam On Screen Text OPENSTEP/Cocoa Version OPL OPS5 OPS83 OR Oz programming language 
P P programming language Parrot assembly language Parrot intermediate representation Pascal PAWN PBASIC PDF PeopleCode Perl Perl 6 PHP PICK/BASIC, DATA/BASIC, MV/BASIC Pike PILOT PingPong Programming Language PL/I PL/SQL POP-11 Postscript POV-Ray Pro*C Procedural C Version Processing Progress 4GL Prolog Pure Data PureBasic Python 
R Rebol Redcode REFAL Regular Expression REXX, ARexx, NetRexx, and Object REXX RISC processor: MIPS architecture RISC processor: PowerPC, Mac OS X, GAS RPL RT Assembler RT-11, MACRO-11 RTF Ruby 
S S (and R) S-Lang SAS Sather Scala SCAR Scheme Script sed Seed7 Self sense script ShadowScript Shakespeare Sigma 6/7/8/9 METASYMBOL Simula SLIQ (Script Language Interface for QmodemPro) Smalltalk SML SNOBOL SNUSP Span SPARK SPITBOL Spoon (programming language) SPSS Syntax SQL SSPL STARLET StarOffice/OpenOffice Basic STATA Super NAND Time!! SuperCollider SVG 
T T programming language TACL TAL Tcl (Tool command language) Template Toolkit TeX ThinBASIC This=That TI-BASIC TOM (rewriting language) Traditional Syntax TSQL TTCN-3 Turing 
U UNIX-style shell Unlambda programming language UserLand Frontier 
V VBScript Verilog VHDL Visual Basic Visual Basic .NET Visual Basic Script Visual Prolog VRML 
W Whitespace Windows PowerShell 
X XHTML 1.1 Xip XL XLISP XMLmosaic XS programming language 
Y Yorick 


Copyright © 2010 Hello World Example Powered By HelloWorldExample.net All rights reserved.