CONSOLE APPLICATION : MagicApp Project Overview
========================================================================
Files overview
- AppLauncher - Wrapper class which contains COM object and Smart COM initiazer object which finds the IAssoc handler for the given extension.
- Processref - Process reference COM object to avoid dangling reference.
- SmartCoinit - Smart Class to wrap COM init/uninit to avoid memory leaks.
- Utility - Helper functions to parse, validate the path/relative path and finding the host OS (XP or WinNT).
- MessageString - Help and error messages.
- Main - Takes user input and calls AppLauncher to launch.
Usage -
-
Open Cmd.exe -> MagicApp.exe FILENAME (with or without quotes)
-
Double click MagicApp.exe : It will ask for user input i.e. FileName ( without quotes only)
reason - (Double quotes are only needed for shell parsers that use a space as a delimiter for commands and parameters. ) https://groups.google.com/forum/#!topic/microsoft.public.vb.general.discussion/aR71k4-L4YE
-
When ask for user input , following actions are supported - a. File path ( absolute and relative) b. Help c. Quit
Test Method -
- In Main.cpp - Turn "TESTMODE" ON or OFF (1 or 0)
The system has been tested with following test cases
- different file types {doc,pdf,png,wmv,mp3,lua,ini,txt,pptx,xls}
- spaces at the begining, end and middle
- Change the default file type from properties to different application
- Relative path is supported
- Incorrect file path , extensions
References : https://www.codeproject.com/Articles/13601/COM-in-plain-C [Basic of COM] https://msdn.microsoft.com/en-us/library/office/cc839627.aspx [Implementnig IUknown] https://stackoverflow.com/questions/37417757/extract-icon-from-uwp-application [To get the IAssoHandlers] https://blogs.msdn.microsoft.com/oldnewthing/20080528-00/?p=22163/ [For SHSetInstanceExplorer] https://msdn.microsoft.com/en-us/library/windows/desktop/ms644928(v=vs.85).aspx#creating_loop [Message loop]