User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 427,177 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,133 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Legacy and Other Languages advertiser: Programming Forums
Mar 16th, 2005
Views: 9,252
I look at BCX-basic as a modernized qbasic. This simple code creates a Windows GUI program that plays a midi instrumental music file. To keep it simple, the file it looks for is "TheRose.mid" file. If you don't have this file, you have the option of editing the code, or simply to rename a midi file you have and stick it in the working folder.
qbasic Syntax | 5 stars
  1. ' uses the mci-library to play a midi file (.mid)
  2. ' the mci-libary winmm.lib is in PellesC\lib\win
  3. ' needs BCX basic, download the free package from:
  4. ' http://www.rjpcomputing.com/programming/bcx/devsuite.html
  5.  
  6. $LIBRARY <winmm.lib>
  7.  
  8. ' this generates WinMain() and sets the Classname
  9. GUI "MIDI3"
  10.  
  11. CONST ID_Button1 = 101
  12.  
  13. DIM Form1 AS HWND
  14. DIM Butt1 AS CONTROL
  15. DIM MciCommand$
  16.  
  17. ' required to create the form and it's components
  18. SUB FORMLOAD
  19. Form1 = BCX_FORM("Play a Midi ...",30,20,140,40 )
  20. Butt1 = BCX_BUTTON("Play",Form1,ID_Button1,10,10,30,12)
  21. DECLARE FUNCTION MCI_Execute LIB "winmm.dll" ALIAS "mciExecute" (A$)
  22. Show(Form1)
  23. END SUB
  24.  
  25. ' code between BEGIN EVENTS/END EVENTS takes care of the event messages
  26. BEGIN EVENTS
  27. SELECT CASE CBMSG
  28. CASE WM_CREATE
  29. EXIT FUNCTION
  30. CASE WM_COMMAND
  31. IF CBCTL = ID_Button1 THEN
  32. '
  33. ' this plays TheRose.mid or change to whatever you have ...
  34. '
  35. MciCommand$ = "play TheRose.mid"
  36. MCI_Execute (MciCommand$)
  37. EXIT FUNCTION
  38. END IF
  39. ' clean up and exit properly
  40. CASE WM_CLOSE
  41. mciSendString ("close all",0,0,0)
  42. DestroyWindow (Form1)
  43. EXIT FUNCTION
  44. END SELECT
  45. END EVENTS
  46.  
  47.  
Comments (Newest First)
billzilla | Newbie Poster | Jun 21st, 2006
This emachione did not come with qbasic...can you reco a site to download a copy freee? check out
www.tiptopwebsite.com/brainwaves
billzilla
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 9:28 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC