PDA

View Full Version : Obligatory Newbie Question #1



Kuron
24-09-2017, 11:22
Apologies, if this is not where the question should be placed...

How do you access a DLL from TB? I have read the manual and can't seem to find anything.

Thank you in advance for any help.

ErosOlmi
24-09-2017, 12:16
To be able to use a function that is inside a DLL you need to tell thinBasic what function, what DLL, what parameters.
To do so, use DECLARE statement.
See help here: http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?declare.htm

Example:

'---Declare WinBeep function from KERNEL32 dll library
DECLARE FUNCTION WinBeep LIB "KERNEL32.DLL" ALIAS "Beep" ( _
BYVAL dwFreq AS DWORD, _
BYVAL dwDuration AS DWORD _
) AS LONG


Ciao
Eros

Kuron
24-09-2017, 18:30
Thank you. Exactly what I needed. I knew it was something that had to be there that I was inadvertently overlooking.

Kuron
24-09-2017, 19:50
Are there any tips for getting thinBasic to fully unload once you are finished with it? After several of hours after closing the program, it is still hogging resources. :confused:


http://i65.tinypic.com/1zbt5hk.jpg

ErosOlmi
24-09-2017, 20:07
Mainly it depends on how you write your code.
It seems you have an endless loop.

If you post some code, I can check and see.

Kuron
24-09-2017, 21:12
Found the culprit (at least I think this is the cause). Had forgot to disable Panda before compiling, and as I mentioned elsewhere, Panda immediately quarantines the compiled EXE and that causes TB to freeze up. It seems the only to fully get TB shut down is a reboot at that point.

Going to get rid of Panda. Sadly it was the least resource intensive and the least false positive problematic for my very low spec system.

primo
25-09-2017, 08:07
Kuron, look the answer of ReneMiner here about my question: http://www.thinbasic.com/community/showthread.php?12650-about-exiting-the-program-correctly
as an example open the file C:\thinBasic\SampleScripts\UI\Canvas\Canvas_SineCurve.tbasic
and when the draw finish click the close button 'X' you will see thinbasic.exe stay in memory.
one of the solutions as ReneMiner wrote is to use this approach:
change Canvas_WaitKey(27) to:
Do
Loop Until Canvas_WaitKey = 27 Or IsWindow(hWin) = FALSE

i have posted before a bat file to check if thinbasic.exe still in memory, this is the file , name it as fileName.BAT
TASKLIST /FI "IMAGENAME eq thinbasic.exe"
tskill thinbasic
pause

this BAT file works in windows xp, but don't know if it works in windows 7 or more.
i don't use antivirus, i use Returnil virtual to run every thing in virtual mode, i think they stop to sell returnil now, it is not completely safe but it better than nothing.

Kuron
25-09-2017, 20:53
Thank you primo. I appreciate the feedback. Seems in my case getting rid of Panda solved the problem. The cloud version of Comodo (which I was unaware of until today) was not any better although it was extremely light on resources. So, back to solely using ClamWin. This has solved the issue for me (at least for now).