BBC BASIC for Windows
Programming >> BBC BASIC language >> Returning reference from a function
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1450199763

Returning reference from a function
Post by Kirkkaf13 on Dec 15th, 2015, 4:16pm

Hello,

I appear to be stuck again with another simple problem. This time I have defined a function in a library file and called it from my program.

The interpreter is returning an error "No such variable in module".

I believe it has something to do with the LOCAL variable I am using but I cannot seem to figure it out after reading the tutorial and documentation on procedures and functions.

Code:
      DEF FN_get_window_title
      LOCAL title%
      DIM title% LOCAL 1000
      SYS "GetWindowText", @hwnd, title%, 1000
      = $$title%


      PRINT FN_get_window_title
 


What am I doing wrong?

Thank you.
Re: Returning reference from a function
Post by hellomike on Dec 15th, 2015, 6:08pm

@hwnd%
Re: Returning reference from a function
Post by Kirkkaf13 on Dec 15th, 2015, 6:47pm

on Dec 15th, 2015, 6:08pm, hellomike wrote:
@hwnd%


Hello hellomike,

I knew it was something simple! I wish the error messages were more informative.