Results 1 to 3 of 3

Thread: LoadImage

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    LoadImage

    Hi,

    I'm bit lost.
    The original declaration of LoadImage is
    DECLARE FUNCTION LoadImage LIB "USER32.DLL" ALIAS "LoadImageA" (BYVAL hInst AS DWORD, lpsz AS ASCIIZ, BYVAL uType AS DWORD, BYVAL cxDesired AS LONG, BYVAL cyDesired AS LONG, BYVAL fuLoad AS DWORD) AS DWORD
    
    As TB still doesn't support strings, I tried the strptr trick, but still no success

    DECLARE FUNCTION LoadImage LIB "USER32.DLL" ALIAS "LoadImageA" (BYVAL hInst AS DWORD, lpsz AS dword, BYVAL uType AS DWORD, BYVAL cxDesired AS LONG, BYVAL cyDesired AS LONG, BYVAL fuLoad AS DWORD) AS DWORD
    
    %IMAGE_BITMAP       = 0    
    %LR_LOADFROMFILE    = &H0010 
    DIM hImg AS DWORD
    DIM picture AS STRING = App_SourcePath+"mybmp.bmp"
    picture += chr$(0)
    
    hImg = LoadImage ( %NULL, strptr(picture), %IMAGE_BITMAP, 0, 0, %LR_LOADFROMFILE)
      msgbox 0,"Handle obtained: "+FORMAT$(hImg)+$CRLF+"ImageFile: "+picture
    
    Any ideas ?

    Thanks,
    Psch
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

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

    LoadImage

    Psch,

    I'm checking.......
    It should word as your example.
    I've reproduced your sample script into Power Basic code and it works.

    I will let you know.

    Ciao
    Eros
    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
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    LoadImage

    Psch,

    I've found the problem: it is a bug!
    Internal function used to call windows API was not returning any value to the script
    Return value was just ignored. Your script example with STRPTR trick was right.

    Fix will be present into version 1.0.8.2

    Thanks a lot
    Eros
    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. LoadImage
    By catventure in forum thinBasic General
    Replies: 7
    Last Post: 10-11-2006, 17:47

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
  •