Recent posts

#11
OxygenBasic Examples / Re: Define question
Last post by Frank Brübach - July 24, 2024, 06:39:08 PM
Hello Charles I have Got it ;)


uses console

#Def abc Printl
abc "Hello myWorld" ' ok

#Def defg Printl
defg "Hello yourWorld" ' ok

#Def zorro abc
zorro "Hello ZorrosWorld" ' ok

#Def batman zorro
batman "Hello Batman+ZorrosWorld" ' ok

'batman "1" zorro "2"
batman "Batman without zorro" ' ok
 
batman "1" zorro "1" ' ok ' 1 11

wait
printl "print key to continue"
#12
General Discussion / New Cold Fusion Device Generat...
Last post by Charles Pegge - July 24, 2024, 08:41:29 AM
Sabine Hossenfelder
22 jul 2024

#13
OxygenBasic Examples / Re: Combobox SDK help
Last post by Frank Brübach - July 23, 2024, 03:04:17 PM
Thanks Charles found the solution some minutes ago.. yes the Style Codes were wrong I placed them First  only AS Dummy but its so important I See

I looked at msdn Pages and found pub const %cbs_sort = 256i32 for example..

  ' demo test2 GO for combobox, sdk modus, by frank bruebach
  ' oxygenbasic, 23-07-2024
  '
  $ filename "t.exe"
  uses Winutil

  #lookahead ' for procedures

    %IDB_BUTTON=1001
    %IDB_COMBO=1002
   %cbs_sort= 256i32
   %CBS_DROPDOWN= 2i32
   %CBS_SIMPLE= dword 0x0001

   ' pub const %cbs_sort i32 = 256i32 commctrl.h
   ' cbs_simple dword = 0x0001
   ' cbs_dropdown i32 = 2i32
   ' 
  '=========
  'MAIN CODE
  '=========
 
  dim cmdline as asciiz ptr, inst as sys
  @cmdline=GetCommandLine
  inst=GetModuleHandle 0
  '
  'WINDOWS START
  '=============
  '
  WinMain inst,0,cmdline,SW_NORMAL
  end

 
function combobox_addstring(byval hwndcombo as dword , byval ltext as string ) as string
function=sendMessage(hwndcombo,CB_ADDSTRING, 0, ltext ) 'strptr(ltext)
end function
   

sub combobox_setcursel(byval hwndcombo as dword , byval index as long )
sendMessage(hwndcombo,CB_SETCURSEL, index,0 )
end sub


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

  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax
  with wc
  .style = CS_HREDRAW or CS_VREDRAW
  .lpfnWndProc = @WndProc
  .cbClsExtra =0
  .cbWndExtra =0   
  .hInstance =inst
  .hIcon=LoadIcon 0, IDI_APPLICATION
  .hCursor=LoadCursor 0,IDC_ARROW
  .hbrBackground = GetStockObject WHITE_BRUSH
  .lpszMenuName =null
  .lpszClassName = strptr "Demo"
  end with
  sys r=RegisterClass (@wc)
 
  Wwd = 420 : Wht = 300
  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
  if not hwnd
    mbox "Unable to create window"
    exit function
  end if
  '
  ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  sys bRet
  '
  do while bRet := GetMessage (@wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend

  End Function

  '#recordof winmain
  '#recordof wndproc



  dim as rect crect 'for WndProc and TimerProc

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

    static as sys hdc
    static as String txt
    static as PaintStruct Paintst
    'sys hfont as long
 
    '==========
    select wMsg
    '==========
       
      '--------------
      case WM_CREATE
      '=============

            SetWindowText(hwnd, "Button and Combobox")

            sys hInstance = GetWindowLongPtr(hWnd, GWL_HINSTANCE)

            sys hWndStdButton = CreateWindowEx(
            0,
            "BUTTON",
            "test button",
            WS_VISIBLE or WS_CHILD,
            10,  10,
            120, 24,
            hWnd,
            IDB_BUTTON,
            hInstance,
            NULL)

'            sys hfont
'            SendMessage(hWndStdCombo, WM_SETFONT, hFont, TRUE)

            sys hWndStdCombo = CreateWindowEx(
            0,
            "Combobox",
            "Test",
            WS_CHILD or WS_VISIBLE or WS_BORDER or ES_AUTOHSCROLL or WS_HSCROLL or WS_VSCROLL _
            OR ES_MULTILINE OR WS_TABSTOP OR CBS_SIMPLE OR CBS_SORT, ''_ '%CBS_DROPDOWNLIST,
            10,  130,
            120, 124,
            hWnd,
            IDB_COMBO,
            hInstance, 'GetWindowLongPtr(hWnd, GWL_HINSTANCE),
            NULL)

'---------------------------- 1. way ------------------------------------------------------------- //
           
        ' Add items to the combobox
            Dim combItem As String
            combItem = "Ironman"     : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Thor"        : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Spiderman"   : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Black Widow" : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Batman"      : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Captain America" : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Captain Marvel" : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
   
        ' Set the current selection
            SendMessage(hWndStdCombo, CB_SETCURSEL, 1, 0)
            SendMessage(hWndStdCombo, WM_SETREDRAW, true, 0) 'important


'---------------------------- 2. way ------------------------------------------------------------- //

    ' // Fill the control with some data
    ' Add items to the combobox using a loop
        'Dim wszText As String
        DIM wszText[80] AS STRING
        int i
        For i = 1 To 9
            wszText = "Marvel " + Right("00" + Str(i), 2)
            SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(wszText))
        Next

    ' Set the current selection
        SendMessage(hWndStdCombo, CB_SETCURSEL, 1, 0)
        SendMessage(hWndStdCombo, WM_SETREDRAW, true, 0) 'important


   case WM_COMMAND
            select case loword(wParam)
                case IDB_BUTTON
                    select case hiword(wParam)
                        case BN_CLICKED
                            MessageBox(NULL, "Selected Button", "testmy Button", MB_OK or MB_ICONINFORMATION)
                    end select
           end select

      '-------------- 
      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,"Hello World!",-1,&cRect,0x25
       EndPaint hWnd,&Paintst
       
      '--------------   
      case WM_KEYDOWN
      '==============

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

    Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0      'ESCAPE

      End Select
     

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

  end function

 
#14
OxygenBasic Examples / Re: Combobox SDK help
Last post by Charles Pegge - July 23, 2024, 12:58:26 PM
Hi Frank,

something wrong with your style codes:

            WS_CHILD or WS_VISIBLE or WS_BORDER or ES_AUTOHSCROLL or WS_HSCROLL or WS_VSCROLL, '*** ok
            'WS_CHILD or WS_VISIBLE or WS_BORDER or ES_AUTOHSCROLL or WS_HSCROLL or WS_VSCROLL _
            'OR ES_MULTILINE OR WS_TABSTOP OR CBS_SIMPLE OR CBS_SORT, ''_ '%CBS_DROPDOWNLIST,
#15
OxygenBasic Examples / Combobox SDK help
Last post by Frank Brübach - July 23, 2024, 08:13:43 AM
Good morning.. hello Charles..,

I have built a little combobox SDK Style example. There are two ways I have explored. But I am Not Sure how use the items for displaying the combobox. My list IS still empty..

One little Thing of my Setup is wrong or I am Missing an important Thing for this running one.. , thanks frank


   ' demo test for combobox, sdk modus, by frank bruebach
  ' oxygenbasic, 23-07-2024
  '
  $ filename "t.exe"
  uses Winutil

  #lookahead ' for procedures

    %IDB_BUTTON=1001
    %IDB_COMBO=1002
    %CBS_SIMPLE=23456
    %CBS_SORT=24567
    %CBS_NOINTEGRALHEIGHT=24678
    %CBS_DROPDOWNLIST=24679
  '=========
  'MAIN CODE
  '=========
 
  dim cmdline as asciiz ptr, inst as sys
  @cmdline=GetCommandLine
  inst=GetModuleHandle 0
  '
  'WINDOWS START
  '=============
  '
  WinMain inst,0,cmdline,SW_NORMAL
  end

 
function combobox_addstring(byval hwndcombo as dword , byval ltext as string ) as string
function=sendMessage(hwndcombo,CB_ADDSTRING, 0, ltext ) 'strptr(ltext)
end function
   

sub combobox_setcursel(byval hwndcombo as dword , byval index as long )
sendMessage(hwndcombo,CB_SETCURSEL, index,0 )
end sub


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

  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax
  with wc
  .style = CS_HREDRAW or CS_VREDRAW
  .lpfnWndProc = @WndProc
  .cbClsExtra =0
  .cbWndExtra =0   
  .hInstance =inst
  .hIcon=LoadIcon 0, IDI_APPLICATION
  .hCursor=LoadCursor 0,IDC_ARROW
  .hbrBackground = GetStockObject WHITE_BRUSH
  .lpszMenuName =null
  .lpszClassName = strptr "Demo"
  end with
  sys r=RegisterClass (@wc)
 
  Wwd = 420 : Wht = 300
  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
  if not hwnd
    mbox "Unable to create window"
    exit function
  end if
  '
  ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  sys bRet
  '
  do while bRet := GetMessage (@wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend

  End Function

  '#recordof winmain
  '#recordof wndproc



  dim as rect crect 'for WndProc and TimerProc

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

    static as sys hdc
    static as String txt
    static as PaintStruct Paintst
    'sys hfont as long
 
    '==========
    select wMsg
    '==========
       
      '--------------
      case WM_CREATE
      '=============

            SetWindowText(hwnd, "Button and Combobox")

            sys hInstance = GetWindowLongPtr(hWnd, GWL_HINSTANCE)

            sys hWndStdButton = CreateWindowEx(
            0,
            "BUTTON",
            "test button",
            WS_VISIBLE or WS_CHILD,
            10,  10,
            120, 24,
            hWnd,
            IDB_BUTTON,
            hInstance,
            NULL)

'            sys hfont
'            SendMessage(hWndStdCombo, WM_SETFONT, hFont, TRUE)

            sys hWndStdCombo = CreateWindowEx(
            0,
            "Combobox",
            "Test",
            WS_CHILD or WS_VISIBLE or WS_BORDER or ES_AUTOHSCROLL or WS_HSCROLL or WS_VSCROLL _
            OR ES_MULTILINE OR WS_TABSTOP OR CBS_SIMPLE OR CBS_SORT, ''_ '%CBS_DROPDOWNLIST,
            10,  130,
            120, 124,
            hWnd,
            IDB_COMBO,
            hInstance, 'GetWindowLongPtr(hWnd, GWL_HINSTANCE),
            NULL)

'---------------------------- 1. way ------------------------------------------------------------- //
           
        ' Add items to the combobox
            Dim combItem As String
            combItem = "Ironman"     : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Thor"        : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Spiderman"   : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Black Widow" : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Batman"      : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Captain America" : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
            combItem = "Captain Marvel" : SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(combItem))
   
        ' Set the current selection
            SendMessage(hWndStdCombo, CB_SETCURSEL, 1, 0)
            SendMessage(hWndStdCombo, WM_SETREDRAW, true, 0) 'important


'---------------------------- 2. way ------------------------------------------------------------- //

    ' // Fill the control with some data
    ' Add items to the combobox using a loop
        'Dim wszText As String
        DIM wszText[80] AS STRING
        int i
        For i = 1 To 9
            wszText = "Marvel " + Right("00" + Str(i), 2)
            SendMessage(hWndStdCombo, CB_ADDSTRING, 0, STRPtr(wszText))
        Next

    ' Set the current selection
        SendMessage(hWndStdCombo, CB_SETCURSEL, 1, 0)
        SendMessage(hWndStdCombo, WM_SETREDRAW, true, 0) 'important


   case WM_COMMAND
            select case loword(wParam)
                case IDB_BUTTON
                    select case hiword(wParam)
                        case BN_CLICKED
                            MessageBox(NULL, "Selected Button", "testmy Button", MB_OK or MB_ICONINFORMATION)
                    end select
           end select

      '-------------- 
      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,"Hello World!",-1,&cRect,0x25
       EndPaint hWnd,&Paintst
       
      '--------------   
      case WM_KEYDOWN
      '==============

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

    Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0      'ESCAPE

      End Select
     

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

  end function

 
#16
Alliance for Responsible Citizenship
17 jun 2024

#17
Psychic Medium REVEALS How Souls Leave The Body And What They Do NEXT..You'll Be AMAZED!!

Wisdom From North
16 jun 2024



Earlier Interview:

Psychic Paramedic with Sarah Grace

New Thinking Allowed with Jeffrey Mishlove
25 jan 2023


#18
OxygenBasic Examples / Re: Define question
Last post by Charles Pegge - July 20, 2024, 07:52:59 AM
In classic BASIC, print is a statement with its own syntax. comma means tab and semicolon means concatenate.

Additionally the print statement automatically ends with crlf unless it ends with comma or semicolon.

In OxygenBasic, print is a normal procedure taking one string expression, and it does not have a predefined lprint for direct printer output. print normally outputs to MessageBox but the console library redefines it for console line output.
#19
OxygenBasic Examples / Re: Define question
Last post by Frank Brübach - July 19, 2024, 11:10:48 PM
Thanks Charles..

I have done three little examples with macros..

And Last one with listitem2 Shoes legs 1 etcpp

In freebasic its possible to #define print_three_Params(P1,p2,p3) Print P1,p2,p3

Oxygen
uses console

' it's possible to create a macro with three params in one line?
' macro PRINT_THREE_PARAMS(p1, p2, p3) Print p1, p2, p3
'
macro Print3( a,b,c )
    Print a
    Print " "
    Print b
    Print " "
    Print c
    print "!"
end macro

Print3( "Hello", "Dianas ", "World " )
wait
printl "press key to continue"


macro PRINT_THREE_PARAMS(p1, p2, p3)
Print p1
print p2
print p3
end macro

PRINT_THREE_PARAMS( " Hello2 ", " Dianas2 ", " World2 " )

wait
printl "press key to continue"

'' CodeSelect
def listitem print "%1" + chr(9) + "%2" + chr(13,10)
'
listitem shoes 1
listitem socks 2
listitem hat   3

wait
printl "press key to continue"

def listitem2 print "%1" + chr(9) + "%2" + chr(13,10) + "%3" +chr(13,10) 'print "%3" '+chr(13,10)
'
listitem2 shoes legs 1
listitem2 socks feet 2
listitem2 hat head 3

wait
printl "press key to continue"


'-------------------------------- //
'
' ---> freebasic: this example works well below

'' #define PRINT_THREE_PARAMS(p1, p2, p3) Print p1, p2, p3

' test program
'' PRINT_THREE_PARAMS("hello ", "Dianas ", " world")

'' Wait for user to press a key
'' Print "Press any key to continue..."

'' Sleep
#20
General Discussion / Global cyber outage crises exp...
Last post by Charles Pegge - July 19, 2024, 09:56:12 PM
Global cyber outage crises exposes world 'vulnerability' as banks, airlines, media outlets hit

Times Radio