DLL Libraries: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "QB64 supports some DLL Library statements and functions. Currently the specified DLL file MUST either be in the '''Windows System folder''' (System32) or in the '''QB64 folder!''' NOTE: '''Use them at your own risk! QB64 CANNOT provide specific DLL Library information or support!''' When using unsupported DLL files use DECLARE DYNAMIC LIBRARY and the name of an '''inactive''' library '''without''' the .DLL extension. The following statement and functi...")
 
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
QB64 supports some DLL Library statements and functions. Currently the specified DLL file MUST either be in the '''Windows System folder''' (System32) or in the '''QB64 folder!''' NOTE: '''Use them at your own risk! QB64 CANNOT provide specific DLL Library information or support!''' When using unsupported DLL files use [[DECLARE LIBRARY|DECLARE DYNAMIC LIBRARY]] and the name of an '''inactive''' library '''without''' the .DLL extension. The following statement and function routine examples have been provided by members AS IS:
QB64 supports some DLL Library statements and functions. Currently the specified DLL file MUST either be in the '''Windows System folder''' (System32) or in the '''QB64 folder!''' NOTE: '''Use them at your own risk! QB64 CANNOT provide specific DLL Library information or support!''' When using unsupported DLL files use [[DECLARE LIBRARY|DECLARE DYNAMIC LIBRARY]] and the name of an '''inactive''' library '''without''' the .DLL extension. The following statement and function routine examples have been provided by members AS IS:


 
{{PageExamples}}
{{PageExamples}}
''Example 1:'' This example plays Midi files using the ''playmidi32.dll'' documented here: [http://libertybasicuniversity.com/lbnews/nl110/midi3.htm Liberty Basic University]. Download the following DLL file to your main QB64 folder: [https://www.qb64.org/resources/Playmidi32.dll PlayMidi32.dll]
''Example 1:'' This example plays Midi files using the ''playmidi32.dll'' documented here: [http://libertybasicuniversity.com/lbnews/nl110/midi3.htm Liberty Basic University]. Download the following DLL file to your main QB64 folder: [https://www.qb64.org/resources/Playmidi32.dll PlayMidi32.dll]
{{CodeStart}} '' ''
{{CodeStart}}
{{Cl|DECLARE DYNAMIC LIBRARY}} "playmidi32"
{{Cl|DECLARE LIBRARY|DECLARE DYNAMIC LIBRARY}} "playmidi32"
     {{Cl|FUNCTION}} PlayMIDI& (filename {{Cl|AS}} {{Cl|STRING}})
     {{Cl|FUNCTION}} PlayMIDI& (filename {{Cl|AS}} {{Cl|STRING}})
{{Cl|DECLARE LIBRARY|END DECLARE}}
{{Cl|DECLARE LIBRARY|END DECLARE}}
Line 13: Line 13:
: '''Note:''' Filename needs to be [[CHR$]](0) terminated. QB64 [[STRING]]s are passed to external libraries as pointers to first character.
: '''Note:''' Filename needs to be [[CHR$]](0) terminated. QB64 [[STRING]]s are passed to external libraries as pointers to first character.


<center>'''Note: QB64 requires all DLL files to either be with the program or in the C:\WINDOWS\SYSTEM32 folder!'''</center>


''See also:''


* [[DECLARE DYNAMIC LIBRARY]], [[BYVAL]]
{{PageSeeAlso}}
* [[_OFFSET]], [[_OFFSET (function)]] {{text|(lp, ptr and p names)}}
* [[DECLARE LIBRARY]], [[BYVAL]]
* [[C Libraries]], [[SDL Libraries]], [[Windows Libraries]]
* [[_OFFSET]], [[_OFFSET (function)]] {{Text|(lp, ptr and p names)}}
* [[C Libraries]], [[Windows Libraries]]
* [[Libraries#C++_Variable_Types|C++ Variable Types]]
* [[Libraries#C++_Variable_Types|C++ Variable Types]]
* [[Port Access Libraries]] {{text|(COM or LPT)}}
* [[Port Access Libraries]] {{Text|(COM or LPT)}}
 
 
<center>'''Note: QB64 requires all DLL files to either be with the program or in the C:\WINDOWS\SYSTEM32 folder!'''</center>




{{PageNavigation}}
{{PageReferences}}

Latest revision as of 13:20, 19 November 2024

QB64 supports some DLL Library statements and functions. Currently the specified DLL file MUST either be in the Windows System folder (System32) or in the QB64 folder! NOTE: Use them at your own risk! QB64 CANNOT provide specific DLL Library information or support! When using unsupported DLL files use DECLARE DYNAMIC LIBRARY and the name of an inactive library without the .DLL extension. The following statement and function routine examples have been provided by members AS IS:


Examples

Example 1: This example plays Midi files using the playmidi32.dll documented here: Liberty Basic University. Download the following DLL file to your main QB64 folder: PlayMidi32.dll

DECLARE DYNAMIC LIBRARY "playmidi32"
    FUNCTION PlayMIDI& (filename AS STRING)
END DECLARE
result = PlayMIDI(".\samples\qb64\original\ps2battl.mid" + CHR$(0))
PRINT result
Note: Filename needs to be CHR$(0) terminated. QB64 STRINGs are passed to external libraries as pointers to first character.
Note: QB64 requires all DLL files to either be with the program or in the C:\WINDOWS\SYSTEM32 folder!


See also


QB64 Programming References

Wiki Pages
Main Page with Articles and Tutorials
QB64 specific keywords (alphabetical)
Original QBasic keywords (alphabetical)
QB64 OpenGL keywords (alphabetical)
Keywords by Usage
Got a question about something?
Frequently Asked Questions about QB64
QB64 Phoenix Edition Community Forum
Links to other QBasic Sites:
Pete's QBasic Forum
Pete's QBasic Downloads