Results 1 to 4 of 4

Thread: How to read the value of a function API Win32 ???

  1. #1

    How to read the value of a function API Win32 ???

    Hello, I am new to the forum
    I'm starting to use ThinBasic, I also use FreeBasic.

    I have this code but it gives me an error.
    I need to do it like this to later call some non-windows DLLs.

    '-----------------------------------------------
    Uses "Console"

    Declare Function timeGetTime Lib "winmm.dll" () As Long

    PrintL (timeGetTime) '<--------- error here

    WaitKey
    '-----------------------------------------------

    Thank you very much in advance.
    Cheers
    Last edited by Tolo68; 06-06-2022 at 12:49.

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Ciao,

    please indicate the Alias parameter in the Declare: https://help.thinbasic.com/declare.h...ghtsub=declare
    Alias name is the internal DLL name of the function.

    Also return value of the function is a DWORD: https://docs.microsoft.com/en-us/win...pi-timegettime

    '-----------------------------------------------
    Uses "Console"
    
    
    Declare Function timeGetTime Lib "winmm.dll" ALIAS "timeGetTime" () As dword
    
    
    PrintL (timeGetTime)
    
    
    WaitKey
    '-----------------------------------------------
    
    Let me know.
    Ciao
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    Quote Originally Posted by ErosOlmi View Post
    Ciao,

    please indicate the Alias parameter in the Declare: https://help.thinbasic.com/declare.h...ghtsub=declare
    Alias name is the internal DLL name of the function.

    Also return value of the function is a DWORD: https://docs.microsoft.com/en-us/win...pi-timegettime

    '-----------------------------------------------
    Uses "Console"
    
    
    Declare Function timeGetTime Lib "winmm.dll" ALIAS "timeGetTime" () As dword
    
    
    PrintL (timeGetTime)
    
    
    WaitKey
    '-----------------------------------------------
    
    Let me know.
    Ciao

    Thank you very much, it went well for me, even with LONG instead of DWORD
    Cheers

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Great.

    Yes LONG or DWORD are both 32 bits (4 bytes) numbers so calling WIN32 API function will not generate errors.
    But LONG is signed while DWORD is unsigned and have different number range.
    Here thinBasic numeric data types and their ranges: https://help.thinbasic.com/numericva...hlightsub=long

    Ciao
    Eros
    Last edited by ErosOlmi; 06-06-2022 at 18:52.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. Members who have read this thread
    By ErosOlmi in forum Web and Forum
    Replies: 0
    Last Post: 17-03-2013, 12:50
  2. EventShaper - experimental module to wrap ugly Win32 messages into user defined form
    By Petr Schreiber in forum Experimental modules or library interface
    Replies: 5
    Last Post: 09-05-2012, 19:35
  3. Interesting WIN32 progamming site
    By ErosOlmi in forum Development
    Replies: 1
    Last Post: 23-08-2009, 14:02
  4. Replies: 4
    Last Post: 13-04-2009, 22:55
  5. Some Win32 API usage statistics
    By ErosOlmi in forum Development
    Replies: 0
    Last Post: 15-03-2009, 23:16

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
  •