Author Topic: Why it's don't working? (in masm32)  (Read 3823 times)

DemoN

  • Posts: 2
Why it's don't working? (in masm32)
« on: 19 Feb '03 - 23:00 »
I write simple programm on masm32, using BASS.dll:
;-------------------------------------------
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
include \masm32\include\comdlg32.inc
includelib \masm32\lib\comdlg32.lib
include \masm32\include\bass.inc
includelib \masm32\lib\bass.lib
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib

.data
szOpen         db "Open A File",0
szFiles        db "MP3 Files",0,"*.mp3",0,0

.data?
Channel dd ?
hWnd          dd ?
hInstance     dd ?
ofn           OPENFILENAME <>
szFileName db 256 dup (?)

.code
start:
     invoke GetModuleHandleA,NULL
     mov hInstance,eax
         mov szFileName[0],0     ; set 1st byte to zero

           mov ofn.lStructSize, sizeof OPENFILENAME
           m2m ofn.hWndOwner,   hWnd
           m2m ofn.hInstance,   hInstance
           m2m ofn.lpstrFilter, offset szFiles            
           m2m ofn.lpstrFile, offset szFileName
           mov ofn.nMaxFile,    sizeof szFileName
           m2m ofn.lpstrTitle,  offset szOpen
           mov ofn.Flags,       OFN_EXPLORER or OFN_FILEMUSTEXIST or \
                                OFN_LONGNAMES
       
           invoke GetOpenFileName,ADDR ofn
             
           invoke BASS_Init,-1, 44100, 0,hInstance
           mov Channel,eax
         invoke BASS_Start
         invoke BASS_StreamCreateFile,FALSE,addr szFileName,0,0,0
         invoke BASS_StreamPlay, eax, FALSE, 0
         invoke BASS_ErrorGetCode
;-------------------------------------------
BASS_ErrorGetCode - return 00000004
in BASS.inc - "BASS_ERROR_BUFLOST      equ 4   ; the sample buffer was lost - please report this!"

What is this?
Why my mp3 not plaing?
« Last Edit: 19 Feb '03 - 23:02 by DemoN »

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Why it's don't working? (in masm32)
« Reply #1 on: 20 Feb '03 - 16:08 »
Quote
           invoke BASS_Init,-1, 44100, 0,hInstance

The "win" parameter should be a window handle, not the module handle/base address. You could try using "0" if you don't have a window - that may (or may not :)) work.

DemoN

  • Posts: 2
Re: Why it's don't working? (in masm32)
« Reply #2 on: 20 Feb '03 - 22:56 »
O yes,thank you!
I try using this in windows, and it's work OK!
But invoke BASS_Init,-1, 44100,0,0 (with no window) don't work :(