system.win32.bmx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. Strict
  2. Import "driver.bmx"
  3. Import "system.win32.c"
  4. Import "-lshell32"
  5. Import "-lcomctl32"
  6. Const WM_BBSYNCOP=$7001 'wp=function, lp=arg
  7. Extern
  8. Function bbSystemStartup()
  9. Function bbSystemPoll()
  10. Function bbSystemWait()
  11. Function bbSystemMoveMouse( x,y )
  12. Function bbSystemSetMouseVisible( visible )
  13. Function bbSystemNotify( text$,serious )
  14. Function bbSystemConfirm( text$,serious )
  15. Function bbSystemProceed( text$,serious )
  16. Function bbSystemRequestFile$( text$,exts$,defext,save,file$,dir$ )
  17. Function bbSystemRequestDir$( text$,dir$ )
  18. Function bbOpenURL( url$ )
  19. Function bbSystemEmitOSEvent( hwnd,msg,wparam,lparam,source:Object )
  20. Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet )
  21. Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object )
  22. End Extern
  23. Type TWin32SystemDriver Extends TSystemDriver
  24. Method New()
  25. bbSystemStartup
  26. End Method
  27. Method Poll()
  28. bbSystemPoll()
  29. End Method
  30. Method Wait()
  31. bbSystemWait()
  32. End Method
  33. Method MoveMouse( x,y )
  34. bbSystemMoveMouse x,y
  35. End Method
  36. Method SetMouseVisible( visible )
  37. bbSystemSetMouseVisible visible
  38. End Method
  39. Method Notify( text$,serious )
  40. bbSystemNotify text,serious
  41. End Method
  42. Method Confirm( text$,serious )
  43. Return bbSystemConfirm( text,serious )
  44. End Method
  45. Method Proceed( text$,serious )
  46. Return bbSystemProceed( text,serious )
  47. End Method
  48. Method RequestFile$( text$,exts$,save,path$ )
  49. Local file$,dir$
  50. path=path.Replace( "/","\" )
  51. Local i=path.FindLast( "\" )
  52. If i<>-1
  53. dir=path[..i]
  54. file=path[i+1..]
  55. Else
  56. file=path
  57. EndIf
  58. ' calculate default index of extension in extension list from path name
  59. Local ext$,defext,p,q
  60. p=path.Find(".")
  61. If (p>-1)
  62. ext=","+path[p+1..].toLower()+","
  63. Local exs$=exts.toLower()
  64. exs=exs.Replace(":",":,")
  65. exs=exs.Replace(";",",;")
  66. p=exs.find(ext)
  67. If p>-1
  68. Local q=-1
  69. defext=1
  70. While True
  71. q=exs.find(";",q+1)
  72. If q>p Exit
  73. If q=-1 defext=0;Exit
  74. defext:+1
  75. Wend
  76. EndIf
  77. EndIf
  78. If exts
  79. If exts.Find(":")=-1
  80. exts="Files~0*."+exts
  81. Else
  82. exts=exts.Replace(":","~0*.")
  83. EndIf
  84. exts=exts.Replace(";","~0")
  85. exts=exts.Replace(",",";*.")+"~0"
  86. EndIf
  87. Return bbSystemRequestFile( text,exts,defext,save,file,dir )
  88. End Method
  89. Method RequestDir$( text$,dir$ )
  90. dir=dir.Replace( "/","\" )
  91. Return bbSystemRequestDir( text,dir )
  92. End Method
  93. Method OpenURL( url$ )
  94. bbOpenURL( url )
  95. End Method
  96. End Type