- oook.. nehmen wir an, man lädt sich den flat assembler herunter, der in der Purebasic-hilfe beschreiben wird.
http://flatassembler.net
jetz will man das beispiel für "how to use a camera" in Pb reinwerfen.
da man sich ja schon etwas damit auskennt, setzte man alles in !.
wenn ichs in den Ordner INCLUDE von Fasm reinwirft ( indem die gebrauchten Dateien sind)
kann man mit Fasm das ganze compilieren. bei Purebasic kommt der Fehler: couldn't find WIN32A.INC.
(sinngemäß)
- wie bring ich den Include 'win32a.inc' befehl zum laufen?
- hier hab ich alles zusammengestellt. einfach webcam.exe starten. oder mit dem beiliegenden FASMW.exe den Sourcecode Webcam.asm compilieren.
Die Problemdatei "CAmera flatasm pb.pb" is auch dabei.
Download:
http://www.file-upload.net/download-652 ... M.zip.html
edit:
code soweit verstanden optimiert...o_O
/edit
Code:
Code: Alles auswählen
; +-------------------------------------------+
; | Program ...... FASMCam |
; | Author ....... Marcus Araujo |
; | Description .. this application shows how |
; | to access webcam via FASM. |
; +-------------------------------------------+
!Include 'C:/Dokumente und Einstellungen/Max/Desktop/WEBCAM per PB-ASM/WIN32A.INC'
! IDD_MAIN = 100
! WM_CAP_DRIVER_CONNECT = WM_USER + 10
! WM_CAP_DRIVER_DISCONNECT = WM_USER + 11
! WM_CAP_FILE_SAVEDIB = WM_USER + 25
! WM_CAP_SET_PREVIEW = WM_USER + 50
! WM_CAP_SET_PREVIEWRATE = WM_USER + 52
! WM_CAP_SET_SCALE = WM_USER + 53
! ID_START = 201
! ID_STOP = 202
! ID_CLICK = 203
! _camtitle db 'FASMWEBCAM'
! _filename db 'IMAGE.BMP' ; Filename
! nDevice dd 0 ; Device Number -> It can range from 0 through 9
! nFPS dd 50 ; Frames per second. Must be 1000/FPS. E.g. 20 FPS = 50
! proc MainDlg hdlg, msg, wParam, lParam
! push Ebx Esi Edi
! cmp [msg], WM_INITDIALOG
! je .wminitdlg
! cmp [msg], WM_COMMAND
! je .wmcommand
! cmp [msg], WM_CLOSE
! je .wmclose
! Xor Eax, Eax
! jmp .finish
! .wminitdlg:
! invoke capCreateCaptureWindow, _camtitle, WS_VISIBLE + WS_CHILD, 10, 10,\
! 266, 252, [hdlg], 0
! mov [hWebcam], Eax
! jmp .finish
! .wmcommand:
! cmp [wParam], BN_CLICKED shl 16 + ID_START
! je .startbutton
! cmp [wParam], BN_CLICKED shl 16 + ID_STOP
! je .stopbutton
! cmp [wParam], BN_CLICKED shl 16 + ID_CLICK
! je .clickbutton
! .wmclose:
! invoke SendMessage, [hWebcam], WM_CAP_DRIVER_DISCONNECT, _camtitle, 0
! invoke EndDialog, [hdlg], 0
! .finish:
! pop Edi Esi Ebx
! ret
! .startbutton:
! invoke SendMessage, [hWebcam], WM_CAP_DRIVER_CONNECT, [nDevice], 0
! invoke SendMessage, [hWebcam], WM_CAP_SET_SCALE, TRUE, 0
! invoke SendMessage, [hWebcam], WM_CAP_SET_PREVIEWRATE, [nFPS], 0
! invoke SendMessage, [hWebcam], WM_CAP_SET_PREVIEW, TRUE, 0
! jmp .finish
! .stopbutton:
! invoke SendMessage, [hWebcam], WM_CAP_DRIVER_DISCONNECT, _camtitle, 0
! jmp .finish
! .clickbutton:
! invoke SendMessage, [hWebcam], WM_CAP_FILE_SAVEDIB, 0, _filename
! jmp .finish
! endp
!section '.data' Data readable writeable
! hInstance dd ?
! hWebcam dd ?
!section '.code' code readable executable
! codestart:
! invoke GetModuleHandle, 0
! mov [hInstance], Eax
! invoke DialogBoxParam, Eax, IDD_MAIN, HWND_DESKTOP, MainDlg, 0
! invoke ExitProcess, 0
!section '.idata' Import Data readable writeable
! library kernel, 'KERNEL32.DLL',\
! user, 'USER32.DLL',\
! avicap, 'AVICAP32.DLL'
! Import kernel,\
! GetModuleHandle,'GetModuleHandleA',\
! ExitProcess, 'ExitProcess'
! Import user,\
! DialogBoxParam, 'DialogBoxParamA',\
! EndDialog, 'EndDialog',\
! SendMessage, 'SendMessageA'
!
! Import avicap,\
! capCreateCaptureWindow, 'capCreateCaptureWindowA'
!section '.rsrc' resource Data readable
! directory RT_DIALOG, dialogs
! resource dialogs,\
! IDD_MAIN, LANG_ENGLISH + SUBLANG_DEFAULT, main_dialog
! dialog main_dialog, 'FASM Webcam', 0, 0, 190, 200, WS_CAPTION + WS_POPUP + WS_SYSMENU +\
! DS_MODALFRAME + DS_CENTER
! dialogitem 'BUTTON', 'START', ID_START, 10, 170, 50, 20, WS_VISIBLE + WS_TABSTOP
! dialogitem 'BUTTON', 'STOP', ID_STOP, 70, 170, 50, 20, WS_VISIBLE + WS_TABSTOP
! dialogitem 'BUTTON', 'CLICK', ID_CLICK, 130, 170, 50, 20, WS_VISIBLE + WS_TABSTOP
! EndDialog
; IDE Options = PureBasic 4.10 (Windows - x86)
; CursorPosition = 21
; FirstLine = 10
End