file. Add {$ Apptype console}, add mmsystem to the uses clause, and delete other reference units. Delete the statements between Begin and end. At this point, we can use the same program as the Turbo PASCAL program and call windows APIs and resources. Add the resource file ---- {$ R myfist. res. Write down between Begin and end:
Writeln ('demo program, press any key to start! ');Readln;Playsound (pchar ('mywav '), hinstance, snd_sync or snd_resource )
a precise timer in its multimedia Windows system.Layer API, multimedia timer can be used to accurately read the current time of the system, and can completeEvents, functions, or processes. The difference is that before calling the DWORD timeGetTime (void) functionAnd Mmsystem. h are added to the project. Otherwise, the DWORD timeGetTime (void) function is prompted during compilation. Because of thisThe function is scheduled to be controlled through q
1. mmsystem must be added. h header file II. winmm must be added. lib library file 3. The waveinopen function provides two methods: the recording message back-to-Window Function and the dedicated callback function. If you want to separate the recording layer from the UI Layer, it is best to use the dedicated callback function, the procedure is as follows: mmresult MMR = waveinopen ( hwavein, wave_mapper, waveform,
(DWORD) (miccallback), DWORD (this),
* lpFrequency)
BOOL QueryPerformanceCounter (LARGE_INTEGER * lpPerformanceCount) gets the counter value
Then, divide the difference between two counters by Frequency to get the time.
The test procedure is as follows:
[C-sharp]View plaincopyprint?
# Include
# Include
Using namespace std;
Int main ()
{
LARGE_INTEGER m_nFreq;
LARGE_INTEGER m_nBeginTime;
LARGE_INTEGER nEndTime;
QueryPerformanceFrequency ( m_nFreq); // get the clock cycle
QueryPerformanceCounter ( m_nBeginTime); // get
run.Release Version: used for official releaseDebug version: used during debugging
Class 2: The program does not add necessary libraries.
When the source program on the copy network is compiled on the local machine, the database used for connection is not added to the newly created Project, therefore, some functions and variables cannot find the defined library file, which leads to errors.
Texture. OBJ: Error lnk2001: unresolved external symbol _ imp _ glenable @ 4Texture. OBJ: Error lnk200
very precise interval. The difference is that before calling the DWORD timegettime (void) function, you must add winmm. lib and mmsystem. H to the project. Otherwise, DWORD is prompted during compilation.The timegettime (void) function is not defined. Since this function is scheduled to be controlled through queries, a scheduled cycle should be established to control scheduled events.
Method 6: Use the multimedia timer timesetevent () function. The t
can be easily seen if there is pause or frame jump during playback. If you are playing a normal movie, you may be able to fool the past :-) how can we achieve accurate millisecond-level latency? I have embarked on a long journey.
Can I try other methods? The API functions gettickcount () and Microsoft's multimedia clock (functions in mmsystem. Lib) have been tested and found that gettickcount () and VB are of the same type, with an accuracy of more t
method ().
For localtime (), the prototype is: struct TM * localtime (const time_t * timep); change the gmtime of the test program to localtime, you can see that the output time is the time and date for obtaining. To get a more friendly time and date, you can use the asctime or ctime function for output like date. The prototype is char * ctime (const time_t * timeval). The test code is as follows:
1 #include
3. You can use
Bool queryperformancefrequency (large_integer * lpfrequency)
Bool qu
needed:Procedure Tfrmain.loadiconclick (Sender:tobject);BeginAnimate1.resname: = ' Myavi '; Resource identificationAnimate1.active: = True;End;A little summary in practice: Not all AVI resources can be played with tanimate components, to be tested when the program is programmed. If you encounter an AVI resource that cannot be played with the Tanimate component, you can detach it from the resource file and play it using the appropriate playback components such as Tmediaplayer. Remove the detache
name should be "W". " WW "and so on, so that the first letter as far as possible, so as to avoid the main program icon order upside down. This way, when someone else is using your program, there are a number of options if they want to choose another icon.Add:1. Resource types In addition to the above types, you can also font files, string files, and so on.2. Resource files can also be used under the console, not only in the standard graphical interface.Let's try this out:Create a new project, d
this property.Because the default cursor in the array has an index value of 0, it is best to set the custom cursor index value to 1 unless you want to replace the default cursor.Procedure Tfrmain.btnusecursorclick (Sender:tobject);BeginSCREEN.CURSORS[1]: =loadcursor (hinstance, resource Identifier);Image1.cursor: = 1;End(3) The icon in the Access resource file puts the icon in the resource file, which can be used to dynamically change the application icon.Procedure Tfrmain.loadiconclick (Sender
A few days ago, you need to play a midi music Loop in a Delphi applet. Why not MP3 or WAV or other? Because the MIDI format is small in size. (In short I have my inevitable reason, more spray nonsense meaning)The playback feature is selected using the mciSendString function in MMSystem, and notice that the "OPEN" operation requires the media type "type SEQUENCER" (that is, MIDI audio), and then use the "Play XX REPEAT"Operation want to be able to loo
, newtransparent );Rgbbk = setbkcolor (hdcdest, rgbtransparent );// Actual BLT is a simple source copy; transparency is automatic.Bitblt (hdcdest, X, Y, dx, Dy, hdcsrc, x0, y0, srccopy );Setbkcolor (hdcdest, rgbbk );Setbkmode (hdcdest, oldmode );}
This makes things easier. Unfortunately, few device drives currently support transparent block transfer-the block transfer feature is not available for those installed in windows3.1. This should change in the near future.
And currently, windows. H d
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) listbox1: tlistbox; listbox2: tlistbox; button1: tbutton; button2: tbutton; Procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses mmsystem; // Device List; the wave_mapper parameter is often used when a device is specifi
'Author: Gordon F. MacLeod
'How to play a CD audio disc via API
'Descare the following APIDeclare function mcisendstring lib "mmsystem" (byval lpstrcommand $, byval lpstrreturnstr as any, byval wreturnlen %, byval hcallback %)
'Add the code below to appropriate routines
Sub partition play_click ()Dim LRET as longDim ncurrenttrack as integer
'Open the deviceLRET = mcisendstring ("Open cdaudio alias CD wait", 0 , 0, 0)
'Set the time format
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.