Using Win32 functions in Visual FoxPro Image Gallery
Windows Multimedia
..msdn
AVIFileExit
AVIFileGetStream
AVIFileInfo
AVIFileInit
AVIFileOpen
AVIFileRelease
AVIFileWriteData
AVIStreamGetFrame
AVIStreamGetFrameClose
AVIStreamGetFrameOpen
AVIStreamInfo
AVIStreamLength
AVIStreamReadFormat
AVIStreamRelease
AVIStreamStart
AVIStreamTimeToSample
capCreateCaptureWindow
capGetDriverDescription
DrawDibClose
DrawDibDraw
DrawDibOpen
mciGetDeviceID
mciGetErrorString
mciSendCommand
mciSendString
midiOutClose
midiOutGetDevCaps
midiOutGetNumDevs
midiOutOpen
midiOutReset
midiOutShortMsg
mixerClose
mixerGetControlDetails
mixerGetDevCaps
mixerGetID
mixerGetLineControls
mixerGetLineInfo
mixerGetNumDevs
mixerOpen
mixerSetControlDetails
mmioAscend
mmioClose
mmioCreateChunk
mmioDescend
mmioFlush
mmioOpen
mmioRead
mmioSeek
mmioWrite
PlaySound
sndPlaySound
timeGetDevCaps
waveInAddBuffer
waveInClose
waveInGetDevCaps
waveInGetErrorText
waveInGetNumDevs
waveInGetPosition
waveInOpen
waveInPrepareHeader
waveInReset
waveInStart
waveInStop
waveInUnprepareHeader
waveOutClose
waveOutGetDevCaps
waveOutGetErrorText
waveOutGetNumDevs
waveOutGetPosition
waveOutGetVolume
waveOutOpen
waveOutPrepareHeader
waveOutReset
waveOutSetVolume
waveOutUnprepareHeader
waveOutWrite
Code examples:
Adding supplementary data to AVI files
How to extract frames from AVI files
How to play AVI file on the _screen
Reading header information from AVI file
Reading parameters of streams in AVI file
Reading parameters of streams in AVI file

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
 
#DEFINE OF_SHARE_DENY_WRITE        0x00000020
#DEFINE streamtypeVIDEO "vids"
#DEFINE streamtypeAUDIO "auds"
DO decl
 
= AVIFileInit()  && init library
 
LOCAL cFilename, hAviFile
cFilename = "c:\windows\clock.avi"
hAviFile = OpenAvi(m.cFilename)
 
IF hAviFile = 0
    ? "Error opening AVI file"
ELSE
    = GetStreamInfo(hAviFile, streamtypeAUDIO, "csAudio", 1,1,30,120)
    = GetStreamInfo(hAviFile, streamtypeVIDEO, "csVideo", 7,7,30,120)
    = AVIFileRelease(hAviFile)
ENDIF
 
= AVIFileExit()  && release library
* end of main
 
FUNCTION OpenAvi(cFilename)
    LOCAL nResult, hFile
    hFile = 0
    nResult = AVIFileOpen(@hFile, cFilename, OF_SHARE_DENY_WRITE, 0)
RETURN Iif(nResult=0, hFile, 0)
 
PROCEDURE GetStreamInfo(hFile, fccType, cs,;
    nRow1, nColumn1, nRow2, nColumn2)
 
    LOCAL hStream
    hStream = 0
 
    = AVIFileGetStream(hFile, @hStream, buf2dword(fccType), 0)
 
    IF hStream = 0
        ? "Could not open stream:", fccType
        RETURN
    ENDIF
 
*|typedef struct { 
*|    DWORD fccType;         0:4
*|    DWORD fccHandler;      4:4
*|    DWORD dwFlags;         8:4
*|    DWORD dwCaps;          12:4
*|    WORD  wPriority;       16:2
*|    WORD  wLanguage;       18:2
*|    DWORD dwScale;         20:4
*|    DWORD dwRate;          24:4
*|    DWORD dwStart;         28:4
*|    DWORD dwLength;        32:4
*|    DWORD dwInitialFrames; 36:4
*|    DWORD dwSuggBufSize;   40:4
*|    DWORD dwQuality;       44:4
*|    DWORD dwSampleSize;    48:4
*|    RECT  rcFrame;         52:16
*|    DWORD dwEditCount;     68:4
*|    DWORD dwFormatChgCnt;  72:4
*|    char  szName[64];      76:64
*|} AVISTREAMINFO; Total bytes = 140
#DEFINE AVISTREAMINFO_SIZE 140
 
    LOCAL cBuffer, nScale, nRate, nX0, nY0, nX1, nY1
 
    cBuffer = Repli(Chr(0), AVISTREAMINFO_SIZE)
    = AVIStreamInfo(hStream, @cBuffer, AVISTREAMINFO_SIZE)
 
    CREATE CURSOR (cs) (stmember C(30), stvalue C(100))
 
    _add(cs, "Stream type", SUBSTR(cBuffer, 1,4))
    _add(cs, "Compressor type", SUBSTR(cBuffer, 5,4))
    _add(cs, "AVISTREAMINFO flags", buf2dword(SUBSTR(cBuffer, 9,4)))
    _add(cs, "Capability flags", buf2dword(SUBSTR(cBuffer, 13,4)))
    _add(cs, "Priority of the stream", buf2word(SUBSTR(cBuffer, 17,2)))
    _add(cs, "Language of the stream", buf2word(SUBSTR(cBuffer, 19,4)))
 
    nScale = buf2dword(SUBSTR(cBuffer, 21,4))
    nRate = buf2dword(SUBSTR(cBuffer, 25,4))
    _add(cs, "Time scale", nScale)
    _add(cs, "Samples per second", nRate/nScale)
 
    _add(cs, "First frame sample number", buf2dword(SUBSTR(cBuffer, 29,4)))
    _add(cs, "Length of the stream", buf2dword(SUBSTR(cBuffer, 33,4)))
    _add(cs, "Audio skew", buf2dword(SUBSTR(cBuffer, 37,4)))
    _add(cs, "Suggested buffer, bytes", buf2dword(SUBSTR(cBuffer, 41,4)))
    _add(cs, "Quality indicator", buf2dword(SUBSTR(cBuffer, 45,4)))
    _add(cs, "Sample size, bytes", buf2dword(SUBSTR(cBuffer, 49,4)))
 
    nX0 = buf2dword(SUBSTR(cBuffer, 53,4))
    nY0 = buf2dword(SUBSTR(cBuffer, 57,4))
    nX1 = buf2dword(SUBSTR(cBuffer, 61,4))
    nY1 = buf2dword(SUBSTR(cBuffer, 65,4))
    _add(cs, "Destination rectangle", LTRIM(STR(nX0))+", "+;
        LTRIM(STR(nY0))+", "+LTRIM(STR(nX1))+", "+LTRIM(STR(nY1)))
 
    _add(cs, "Editing count", buf2dword(SUBSTR(cBuffer, 69,4)))
    _add(cs, "Stream description", SUBSTR(cBuffer, 77))
 
    = AVIStreamRelease(hStream)
 
    GO TOP
    BROW NORMAL NOWAIT
    PosWindow(cs, nRow1, nColumn1, nRow2, nColumn2)
 
PROCEDURE _add(cCursor, cName, vValue)
    IF VARTYPE(vValue) = "N"
        vValue = LTRIM(STR(vValue))
    ENDIF
    INSERT INTO (cCursor) VALUES (cName, vValue)
 
PROCEDURE decl
    DECLARE AVIFileInit IN avifil32
    DECLARE AVIFileExit IN avifil32
    DECLARE INTEGER AVIFileRelease IN avifil32 INTEGER pfile  
    DECLARE INTEGER AVIStreamRelease IN avifil32 INTEGER pavi  
    DECLARE INTEGER AVIStreamLength IN avifil32 INTEGER pavi  
    DECLARE INTEGER AVIStreamStart IN avifil32 INTEGER pavi  
 
    DECLARE INTEGER AVIFileOpen IN avifil32;
        INTEGER @ppfile, STRING szFile,;
        INTEGER mode, INTEGER pclsidHandler
 
    DECLARE INTEGER AVIFileGetStream IN avifil32;
        INTEGER pfile, INTEGER @ppavi,;
        INTEGER fccType, INTEGER lParam
 
    DECLARE INTEGER AVIStreamInfo IN avifil32;
        INTEGER pavi, STRING @psi, INTEGER lSize
 
FUNCTION buf2dword(lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
    BitLShift(Asc(SUBSTR(lcBuffer, 2,1)),  8) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24)
 
FUNCTION buf2word(lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
       Asc(SUBSTR(lcBuffer, 2,1)) * 256
 
PROCEDURE PosWindow(cWindow, nRow1, nColumn1, nRow2, nColumn2)
    MOVE WINDOW (cWindow) TO nRow1, nColumn1
    SIZE WINDOW (cWindow) TO nRow2, nColumn2
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
4654 bytes  
Created: 2003-11-28 20:45:37  
Modified: 2009-02-03 15:26:42  
Visits in 7 days: 130  
Listed functions:
AVIFileExit
AVIFileGetStream
AVIFileInit
AVIFileOpen
AVIFileRelease
AVIStreamInfo
AVIStreamLength
AVIStreamRelease
AVIStreamStart
Printer friendly API declarations
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (184.73.74.47)
3 sec.Function: 'LoadIcon'
6 sec.Example: 'Pocket PC: base class'
13.72 min.Example: 'Pocket PC: custom RAPI class for operating with the System Registry'
13.78 min.Example: 'Storing screen shot of a form to enhanced metafile (*.emf)'
13.83 min.Function: 'SQLCreateDataSource'
Function group: 'ODBC API'
20.78 min.Function: 'CreateWindow'
20.83 min.Function: 'UnlockServiceDatabase'
Function group: 'Service'
55.15 min.Example: 'The window and its ancestors'
55.2 min.Example: 'Creating two-byte hashes for a list of URLs'
10.84 hrs.Solution: 'LanguageBar ActiveX Control'
Google
Advertise here!