File Association Program in Windows Mobile

Source: Internet
Author: User

Generally, clicking an MP3 file will automatically call mediaplayer for playback.

If needed, we can also call our own program to process a file in a specific format.

First, process the registry.

For example, we need to associate the file with the suffix. dat. First, create a subdirectory under hkey_classes_root. dat, name is default, and data is datfile. Next, create a subdirectory datfile under hkey_classes_root, and create two subdirectories under datfile: defaulticon and shell. If there is no requirement for the file display icon, defaulticon uses the default value, and shell creates an Open Directory, open and create the command directory again. Here, you can specify the program to which the file is associated, for example, "/program files/test.exe" "% 1". Note that quotation marks must be added.

Changes to the Registry have come to an end.

Now, click the. dat file to activate the associated program.

But how does the program know which file to associate? The getcommandline () function returns the file path. It is worth noting that each time you click the. dat file, a new program instance is activated. That is to say, getcommandline () only works at the mian entrance. So when a program instance a is activated, if you click the. dat file, how does one get A's file path? I believe that everyone will come up with a variety of smart methods to achieve this.

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.