Main Menu

Recent posts

#1
I lived here for a few months back in the early 1980s.

How Britain Made a Dystopian City
Milton Keynes

JimmyTheGiant
28 mar 2024

#2
General Discussion / Re: How To Make Cities Beautif...
Last post by Theo Gottwald - Yesterday at 07:21:49 PM
That wold be great, but I doubt this to happen before the next war.
#3
General Discussion / Re: Why There Are Only 50 Peop...
Last post by Theo Gottwald - Yesterday at 07:20:56 PM
Really amazing.
He can read a book and remember every word.
But I believe that many children could learn that in europe or India when trained in the right way.
#4
General Discussion / How To Make Cities Beautiful A...
Last post by Charles Pegge - Yesterday at 12:31:57 PM
The Aesthetic City
27 July 2024



Architecture Schools are BROKEN - But A RENAISSANCE Is Coming

The Aesthetic City
20 jun 2024

#5
General Discussion / Why There Are Only 50 People i...
Last post by Charles Pegge - September 05, 2024, 02:58:20 PM
Thoughty2
24 dec 2023

#6
General Discussion / Why Einstein Couldn’t Get a Jo...
Last post by Charles Pegge - September 03, 2024, 10:57:40 PM
Newsthink
16 may 2024

#7
General Discussion / Gary Kildall - The Man That Sh...
Last post by Charles Pegge - September 03, 2024, 02:44:46 AM
Al's Geek Lab
14 sep 2023







#8
General Discussion / Managing Red, Yellow, Green, B...
Last post by Charles Pegge - September 02, 2024, 10:18:26 AM
Surrounded by Idiots | 4 Types of Human Behavior | Thomas Erikson

LITTLE BIT BETTER
7 may 2024

#9
General Discussion / Our oceans have learnt how to ...
Last post by Charles Pegge - September 01, 2024, 10:41:58 PM
Just Have a Think

#10
OxygenBasic / Re: Problem with switch select...
Last post by Charles Pegge - September 01, 2024, 01:12:06 PM
Yes, I see my original 'expected' results were not correct but the actual results were correct.


There is an example (one of yours Roland?) demonstrating the usefulness of switch

demos\WinGUI\DialogFindReplace.o2bas


In this instance, switch bit is specified so that multiple flag bits can be processed in one block.

  $ filename "t.exe"
  'uses RTL32
  uses MinWin
  uses DialogFindReplace

  #lookahead ' for procedures

  '=========
  'MAIN CODE
  '=========
 
  dim cmdline as asciiz ptr, inst as sys
  &cmdline=GetCommandLine
  inst=GetModuleHandle 0
  '
  'WINDOWS
  '-------
  '
  WinMain inst,0,cmdline,SW_NORMAL
  end

  '

  dim as sys hDlgFr

  '--------------------------------------------------------------------
  Function WinMain(sys inst, prevInst, asciiz*cmdline, sys show) as sys
  '====================================================================


  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax

  wc.style = CS_HREDRAW or CS_VREDRAW
  wc.lpfnWndProc = @WndProc
  wc.cbClsExtra =0
  wc.cbWndExtra =0   
  wc.hInstance =inst
  wc.hIcon=LoadIcon 0, IDI_APPLICATION
  wc.hCursor=LoadCursor 0,IDC_ARROW
  wc.hbrBackground = GetStockObject WHITE_BRUSH
  wc.lpszMenuName =null
  wc.lpszClassName = strptr "Demo"

  RegisterClass @wc
 
  Wwd = 320 : Wht = 200
  Tax = GetSystemMetrics SM_CXSCREEN
  Wtx = (Tax - Wwd) /2
  Tax = GetSystemMetrics SM_CYSCREEN
  Wty = (Tax - Wht) /2
 
  hwnd = CreateWindowEx 0,wc.lpszClassName,"OXYGEN BASIC",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0
  ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  sys bRet
  '
  '
  while bRet := GetMessage @wm, 0, 0, 0
    if bRet = -1
      'show an error message
      exit do
    elseif not IsDialogMessage hDlgFr,@wm
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend

  End Function



  dim as rect crect 'for WndProc and TimerProc

  '------------------------------------------------------------------
  function WndProc ( sys hWnd, wMsg, wParam, lparam ) as sys callback
  '==================================================================

    static sys         hdc
    static String      txt="Find and Replace Test", frs=""
    static PaintStruct Paintst
    static sys         DlgFrMsg, flags
    static char        f[100],r[100]
 
    '==========
    select wMsg
    '==========
       
      '--------------
      case WM_CREATE
      '=============

      GetClientRect  hWnd,&cRect
      DlgFrMsg=RegisterWindowMessage FINDMSGSTRINGA
      hDlgFr=FindReplaceDialog(f,r,96,hwnd,flags)

      '-------------- 
      case WM_DESTROY
      '===============
         
      PostQuitMessage 0
       
      '------------
      case WM_PAINT
      '============


      'TEXT
      'http://msdn.microsoft.com/en-us/library/dd144821(v=VS.85).aspx

      'DRAWING AND PAINTING
      'http://msdn.microsoft.com/en-us/library/dd162760(v=VS.85).aspx

      GetClientRect  hWnd,&cRect
      hDC=BeginPaint hWnd,&Paintst
      'style
      '0x20 DT_SINGLELINE
      '0x04 DT_VCENTER
      '0x01 DT_CENTER
      '0x25

       SetBkColor   hdc,yellow
       SetTextColor hdc,red
       DrawText hDC,strptr txt,-1,&cRect,0x25
       EndPaint hWnd,&Paintst
       
      '--------------   
      case WM_KEYDOWN
      '==============

      '============           
      Select wParam
      '============

Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0            'ESCAPE
        Case 82 : hDlgFr=FindReplaceDialog(f,r,96,hwnd,flags) 'R

      End Select
     

      '------------   
      case DlgFrMsg
      '============

      FINDREPLACE* fr
      @fr=lparam
      frs=fr.lpstrFindWhat

      switch bit fr.flags
      '
      case FR_DIALOGTERM
        hDlgFr = 0
        fr.lpstrFindWhat=""
        fr.lpstrReplaceWith=""
        fr.flags=0
        frs="Press R for Find/Replace Dialog"
      case FR_MATCHCASE
         frs+=" MATCHCASE"
      case FR_WHOLEWORD
         frs+=" WHOLEWORD"
      case FR_FINDNEXT
         frs+=" FINDNEXT"
      case FR_REPLACE
         frs+=" REPLACE"
      case FR_REPLACEALL
         frs+=" REPLACEALL"
      end select
      '
      txt=frs
      InvalidateRect hWnd, @crect

      '--------       
      case else
      '========
         
        function=DefWindowProc hWnd,wMsg,wParam,lParam
       
    end select

  end function ' WndProc