Quote: "is there a code for
-playing video files like mpeg
-message box pop-up
-opening programs (executable text files etc)
-creating files (text files)"
I'd always check the Code Snippets Forum., as it was mainly used by the DBP Community... the AppGameKit Community more or less ignores it exists.
You can almost always find a Snippet for DBP showcasing what you're looking for in there.
With this said., I'll tackle these in order:
Quote: "-playing video files like mpeg"
DarkBASIC Professional is entirely Windows / DirectX 9.0c Based (unlike AppGameKit which uses Multiple Cross-Platform API with more Hardcoded approaches).
What this means is that the Video Functions are entirely built on DirectShow., which is a Format Independent Video Playback API that integrates with DirectX (specifically DirectX 7 - 9).
This means that provided the Video Codec is installed (many common formats are by default in Modern Windows)., then you can Load and Play it within DBP.
Today., this essentially means all Common Formats; as their Codecs are installed by Default in Windows... but what you can do., is have a small "Test" File in the Format you want to use.
i.e.
Function LoadVideo( Video$ )
Local VideoID As Integer : VideoID = 1
// Check for Available ID., remember we can ONLY have up to 32 Videos Loaded at once
While Animation Exist(VideoID) And VideoID < 32 : Inc VideoID : EndWhile
// If the VideoID is Valid
If VideoID < 32
// Attempt to Load Video
Load Animation Video$, VideoID
// If it Exists Return VideoID
If Animation Exist(VideoID)
ExitFunction VideoID
EndIf
Else
// If there are No Available ID, then Return 0
ExitFunction 0
EndIf
// We Default to Assume the Load Failed
EndFunction -1
This is a useful approach to the function., because a Return of False (0) means we have no available slots to load with... this is a YOU (Program) issue., as you're using too many Animation Slots; where-as a True (-1) Value means the Video Failed to Load.
And then any Positive Value means it Loaded just Fine.
As such we can then use a Select...Case Statement (Finite State Machine), to handle each of these.
So say:
_RetryLoad:
Select LoadVideo("Test.mpeg")
Case 0:
// Clear a Slot, Try Again
Delete Animation 31
GoTo _RetryLoad
EndCase
Case -1:
// Unsupported Format, so we can run the Codec Redist
AppID = Execute Executable( "DivX.exe", "", ".\Redist" )
While Executable Running(AppID)
// Just idle the App while the Installer is Running
// We do want to just make sure the User can't accidentally
// close the main app in the meantime
Disable EscapeKey
Hide Window
EndWhile
// Now we're installed we can re-enable the App
Enable EscapeKey
Show Window
EndCase
Case Default:
// Don't need to do anything it succeeded
EndCase
EndSelect
Now as a note., these are just EXAMPLES of how you can do it, not a Copy-Paste Solution.
And I've written it deliberately in a way that you can't just copy it into your project... as I'm not writing your App/Game for you., this is a learning tool to understand how to do it yourself.
Quote: "-message box pop-up"
Buried somewhere in DBP is actually a Command for a Message Prompt... but I forgot what it is and the only one that the Help Files lists (as I recall) is the Exit Prompt; which has limited usage, as well it ends the App.
As noted there are various 3rd Party DLL Plug-Ins that do provide this functionality., although I never used any, so couldn't tell you which.
Still a useful aspect of DBP is that we can directly call ANY Windows Function provided we know how to access it.
This gets into more advanced programming., so here's a self-contained Function.
Disable EscapeKey
Sync On
Sync Rate 0
#Constant MB_ABORTRETRYIGNORE 0x00000002
#Constant MB_CANCELTRYCONTINUE 0x00000006
#Constant MB_HELP 0x00004000
#Constant MB_OK 0x00000000
#Constant MB_OKCANCEL 0x00000001
#Constant MB_RETRYCANCEL 0x00000005
#Constant MB_YESNO 0x00000004
#Constant MB_YESNOCANCEL 0x00000003
#Constant MB_ICONEXCLAMATION 0x00000030
#Constant MB_ICONWARNING 0x00000030
#Constant MB_ICONINFORMATION 0x00000040
#Constant MB_ICONASTERISK 0x00000040
#Constant MB_ICONQUESTION 0x00000020
#Constant MB_ICONSTOP 0x00000010
#Constant MB_ICONERROR 0x00000010
#Constant MB_ICONHAND 0x00000010
#Constant MB_IDOK 1
#Constant MB_IDCANCEL 2
#Constant MB_IDABORT 3
#Constant MB_IDRETRY 4
#Constant MB_IDIGNORE 5
#Constant MB_IDYES 6
#Constant MB_IDNO 7
#Constant MB_IDTRYAGAIN 10
#Constant MB_IDCONTINUE 11
Select MessageBox( "Test", "This is a Test Box", MB_OKCANCEL )
Case MB_IDOK:
Repeat
Text 0, 0, "OK Selected"
Text 0,10, "Press Escape to Continue"
Sync
Until EscapeKey()
EndCase
Case MB_IDCANCEL:
Repeat
Text 0, 0, "CANCEL Selected"
Text 0,10, "Press Escape to Continue"
Sync
Until EscapeKey()
EndCase
EndSelect
End
Function MessageBox( Text$, Caption$, Options )
Local LibraryID As Integer : LibraryID = 1
While DLL Exist(LibraryID)
Inc LibraryID
EndWhile
Load DLL "User32.dll", LibraryID
Result = Call DLL( LibraryID, "MessageBoxA", 0, Caption$, Text$, Options || 0x00002000 )
Delete DLL LibraryID
EndFunction Result
Now of course if you want a "Custom" Message Box., well you have to use Dialog Boxes and that's a bit more involved to write.
Again there are 3rd Party DLLs for doing this... but you can just as easily do it in a similar method to the above Message Box.
It'd just take much longer to write than this did.
Quote: "-opening programs (executable text files etc)"
See Above... although keep in mind., not sure if it's an issue with Windows 10 or DBP v1.7x but the Execute Executable doesn't fully support Command Parameters.
Quote: "-creating files (text files)"
F1 > Commands > File Commands
Just check the Help, as the example is for Text Files