How to compile a Windows Mobile Smartphone recording program

Source: Internet
Author: User

Recording is a very practical function. We can use it to record voice notes and phone calls, and develop simple voice chat software. Of course, recording is not only used for this purpose.

Today, we will introduce how to develop a simple Windows Mobile Smartphone recording.ProgramThis mini-program includes two functions: Recording and playing recording. You can also control the recording and stop recording through the 5-key numeric keypad.

Implementation Principle: Opennetcf has encapsulated a recorder class and a player class. We can combine these two classes to create a simple recording program. These two classes are in the opennetcf. Multimedia. Audio namespace. By referencing opennetcf. dll, you can use the recorder and player classes. I am using v1.4.

Recording:
Recorder recorder =NewRecorder ();
// Stream must be the field of the recorder class, And seconds is the maximum recording time.
Recorder. recordfor (stream, seconds, soundformats. mono8bit11khz );

Stop recording:
Recorder. Stop ();

Play:
Stream S = file. openread (File );
Player player =NewPlayer ();
Player. Play (s );

Stop playing:
Player. Stop ();

Implementation Principle: How do I register the keyboard's 5 keys as the recording shortcut key? Windows CE provides the registerhotkey function to register system-level shortcuts, while the unregisterhotkey function is used to cancel system-level shortcuts.

[Dllimport ("Coredll. dll", Entrypoint ="Registerhotkey", Setlasterror =True)]
Private Static Extern BoolRegisterhotkey (intptr hwnd,IntID, keymodifiers modifiers,IntKey );

[Dllimport ("Coredll. dll", Entrypoint ="Unregisterhotkey", Setlasterror =True)]
Private Static Extern BoolUnregisterhotkey (intptr hwnd,IntKey );

After registering a system-level shortcut key, we need to intercept the wm_hotkey message in the wndproc method and handle the corresponding key event. However,. Net CF does not place the wndproc method in the system. Windows. Forms. Form class as in the full version of. Net CF, but in the Microsoft. WindowsCE. Forms. messagewindow class. Therefore, we need to inherit messagewindow and intercept wm_hotkey messages. We can encapsulate the registration shortcut key function into a class.

The recording program works as follows:
 

Source code: Voicerecorder.rar

The official opennetcf 2.0 example provides an example called mobilevoicenotes, which is also implemented using the recorder and player classes.

for the tools and components used, refer to Windows Mobile development tools and resources.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.