Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: Windows API `Hello World!`

  1. #21
    Member zlatkoAB's Avatar
    Join Date
    Apr 2008
    Age
    55
    Posts
    287
    Rep Power
    45

    Re: Windows API `Hello World!`

    Hi Michael...

    I don't believe everything what he saying but this time i think
    that is true.It looks that is Cbasic limited in this concret problem.
    I have source code from VB6 for API Window but I don't try them
    yet.As i see thinBasic can do that with oxygen modul and with
    oxygen .dll .
    Maby it's posible directly - that would be cool.

    Zlatko

  2. #22
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    Re: Windows API `Hello World!`

    Ok, I thought he ment in general not possible.

  3. #23
    Member zlatkoAB's Avatar
    Join Date
    Apr 2008
    Age
    55
    Posts
    287
    Rep Power
    45

    Re: Windows API `Hello World!`

    Hi I must say that is very interesting problematic and like Charles say
    i find something very interesting on Free Basic Forum.Look code:
    #Include "windows.bi"
    
    Dim As MSG msg   ' Message variable (stores massages)
    Dim As HWND hWnd  ' Window variable
    
    ' Create window
    hWnd = CreateWindowEx( 0, "#32770", "Hello", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, 100, 100, 500, 300, 0, 0, 0, 0 )
    
    While GetMessage( @msg, 0, 0, 0 )  ' Get message from window
     TranslateMessage( @msg )
     DispatchMessage( @msg )
     
     Select Case msg.hwnd
      Case hWnd    ' If msg is window hwnd: get messages from window
       Select Case msg.message
        Case 273  ' Get message when 'X' was pressed
         End
       End Select
     End Select
    Wend
    
    You must say that look very simple.
    And little bit weird.So i try something similiar on CBasic and work
    but not properly.I can open new window,without focus and can not
    be closed with closebox button"X".One interesting thing ,window is
    like standalone compiled app
    I don't try on thinBasic bacose i don't know shape of APi-s.
    Is the same like this or different?
    DECLARE "user32",CreateWindowExA(dwExStyle AS INT,lpClassName AS STRING,lpWindowName AS STRING,dwStyle AS INT,x AS INT,y AS INT,nWidth AS INT,nHeight AS INT,hWndParent AS INT,hMenu AS INT,hInstance AS INT,lpParam AS INT),INT
    DECLARE "user32",GetMessageA(lpMsg AS MSG,hwnd AS INT,wMsgFilterMin AS INT,wMsgFilterMax AS INT),INT
    DECLARE "user32",TranslateMessage(lpMsg AS MSG),INT
    DECLARE "user32",DispatchMessageA(lpMsg AS MSG),INT
    DECLARE "user32", PostQuitMessage(nExitCode AS INT)
    

  4. #24

    Re: Windows API `Hello World!`


    Hi Zlatco,

    Try 256 instead of 273. 256 is the WM_KEYDOWN message -

    this is what I tried in o2h (wm is the message variable)

    [code=thinbasic]

    while GetMessage &wm,0,0,0
    TranslateMessage &wm
    DispatchMessage &wm
    '
    select wm.hwnd
    case hwnd
    if wm.message=256 then print `key down` : exit do
    end select
    '
    wend
    [/code]

  5. #25
    Member zlatkoAB's Avatar
    Join Date
    Apr 2008
    Age
    55
    Posts
    287
    Rep Power
    45

    Re: Windows API `Hello World!`

    Hi Charles...

    I always recive error that Argument is wrong type in
    While GetMessageA( wmsg,0, 0, 0 )  :' Get message from window
    
    So which message close window?
    Or what argument is wrong ,hmm it looks very tricky.

  6. #26

    Re: Windows API `Hello World!`



    GetMessage needs the address of the message: varptr(msg) &msg or @msg, whatevever syntax Cbasic uses.

    I am assuming the Win header files follow the standard C version.

    Charles


  7. #27
    Member zlatkoAB's Avatar
    Join Date
    Apr 2008
    Age
    55
    Posts
    287
    Rep Power
    45

    Re: Windows API `Hello World!`

    Aha I see ...
    So there is the main problem .
    CBasic can't pass or see adress so only I can try with pointer.
    But i think that is not posible.
    Whatever thanks on all answers,Charles.

    Zlatko

Page 3 of 3 FirstFirst 123

Similar Threads

  1. End of the World [Again]
    By JosephE in forum General
    Replies: 17
    Last Post: 26-05-2011, 07:58
  2. Most typical face in the world
    By Charles Pegge in forum Shout Box Area
    Replies: 0
    Last Post: 05-03-2011, 07:35
  3. World Matrix Rotation
    By Dylan in forum WCHS thinBasic gaming forum
    Replies: 8
    Last Post: 11-11-2010, 16:38

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •