aboutsummaryrefslogtreecommitdiff
path: root/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp144
-rw-r--r--cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?rev=1.2&content-type=text/x-cvsweb-markup/index.html98
2 files changed, 242 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp b/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp
new file mode 100644
index 00000000..172f07d1
--- /dev/null
+++ b/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp
@@ -0,0 +1,144 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : cvs</TITLE>
+ <META name="keywords" content="freesoftware,nel,newt,snowballs,richard stallman,GNU,Multi-User Online World">
+
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-free.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Free Software">Free software</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/cvs/"><img src="http://www.nevrax.org/inc/img/t_cvs.gif" ALT="cvs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+
+<!-- title -->
+<table width=100%><tr><td align=left><b> <a href="/cvs/cvsweb.cgi/">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/">code</a> / <a href="/cvs/cvsweb.cgi/code/tool/">tool</a> / <a href="/cvs/cvsweb.cgi/code/tool/open_file/">open_file</a> / open_file.cpp</b></td><td align=right><b></b></td></TR></TABLE>
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>open_file.cpp</B></TD>
+ <TD ALIGN=RIGHT> </td>
+</tr></table>
+<P>
+<p>Default branch: MAIN<BR>
+<HR size=1 NOSHADE><P><a NAME="rev1.2"></a><a NAME="HEAD"></a><a NAME="MAIN"></a>
+ Revision <A HREF="open_file.cpp?rev=1.2&amp;content-type=text/x-cvsweb-markup"><b>1.2</b></A> / (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/tool/open_file/open_file.cpp?rev=1.2&amp;content-type=text/plain" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/tool/open_file/open_file.cpp?rev=1.2&amp;content-type=text/plain','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>) - <a href="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?annotate=1.2">annotate</a> - <A HREF="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?r1=1.2">[select for diffs]</A>
+, <i>Fri Dec 8 10:21:10 2000 UTC</i> (18 months, 3 weeks ago) by <i>corvazier</i>
+<BR>Branch: <b><A HREF="open_file.cpp?only_with_tag=MAIN">MAIN</A>
+</b>
+<BR>CVS Tags: <b><A HREF="open_file.cpp?only_with_tag=HEAD">HEAD</A>
+</b><BR>Changes since <b>1.1: +10 -3
+ lines</b><BR>Diff to previous <A HREF="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp.diff?r1=1.1&amp;r2=1.2">1.1</A>
+<PRE>
+no message
+</PRE>
+<HR size=1 NOSHADE><P><a NAME="rev1.1"></a>
+ Revision <A HREF="open_file.cpp?rev=1.1&amp;content-type=text/x-cvsweb-markup"><b>1.1</b></A> / (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/tool/open_file/open_file.cpp?rev=1.1&amp;content-type=text/plain" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/tool/open_file/open_file.cpp?rev=1.1&amp;content-type=text/plain','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>) - <a href="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?annotate=1.1">annotate</a> - <A HREF="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?r1=1.1">[select for diffs]</A>
+, <i>Fri Dec 8 10:16:16 2000 UTC</i> (18 months, 3 weeks ago) by <i>corvazier</i>
+<BR>Branch: <b><A HREF="open_file.cpp?only_with_tag=MAIN">MAIN</A>
+</b>
+<BR>Diff<PRE>
+Open a file with the app assigned in windows
+</PRE>
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Request Diffs</B></TD>
+ <TD ALIGN=RIGHT> </td>
+</tr></table>
+<P>
+<P>
+<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp.diff" NAME="diff_select">
+Diffs between
+<SELECT NAME="r1">
+<OPTION VALUE="text" SELECTED>Use Text Field
+<OPTION VALUE="1:MAIN">MAIN
+<OPTION VALUE="1.2:HEAD">HEAD
+</SELECT>
+<INPUT TYPE="TEXT" SIZE="12" NAME="tr1" VALUE="1.1" onChange='document.diff_select.r1.selectedIndex=0'>
+ and
+<SELECT NAME="r2">
+<OPTION VALUE="text" SELECTED>Use Text Field
+<OPTION VALUE="1:MAIN">MAIN
+<OPTION VALUE="1.2:HEAD">HEAD
+</SELECT>
+<INPUT TYPE="TEXT" SIZE="12" NAME="tr2" VALUE="1.2" onChange='docuement.diff_select.r2.selectedIndex=0'>
+<BR>Type of Diff should be a&nbsp;<SELECT NAME="f">
+<OPTION VALUE=h SELECTED>Colored Diff<OPTION VALUE=H>Long Colored Diff<OPTION VALUE=u>Unidiff<OPTION VALUE=c>Context Diff<OPTION VALUE=s>Side by Side</SELECT><INPUT TYPE=SUBMIT VALUE=" Get Diffs ">
+</FORM>
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Select branch</B></TD>
+ <TD ALIGN=RIGHT> </td>
+</tr></table>
+<P>
+<P>
+<A name=branch></A>
+<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp">
+View only Branch:
+<SELECT NAME="only_with_tag" onchange="submit()">
+<OPTION VALUE="">Show all branches
+<OPTION>MAIN
+</SELECT>
+<INPUT TYPE=SUBMIT VALUE=" View Branch ">
+</FORM>
+<A name=logsort></A>
+<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp">
+Sort log by:
+<SELECT NAME="logsort" onchange="submit()">
+<OPTION VALUE=cvs>Not sorted<OPTION VALUE=date SELECTED>Commit date<OPTION VALUE=rev>Revision</SELECT>
+<INPUT TYPE=SUBMIT VALUE=" Sort ">
+</FORM>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML></BODY></HTML>
diff --git a/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?rev=1.2&content-type=text/x-cvsweb-markup/index.html b/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?rev=1.2&content-type=text/x-cvsweb-markup/index.html
new file mode 100644
index 00000000..ae82c684
--- /dev/null
+++ b/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp?rev=1.2&content-type=text/x-cvsweb-markup/index.html
@@ -0,0 +1,98 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
+<HEAD><style> A { color:black }</style>
+<!-- hennerik CVSweb $Revision: 1.93 $ -->
+<TITLE>code/tool/open_file/open_file.cpp - view - 1.2</TITLE></HEAD>
+<BODY BGCOLOR="#eeeeee">
+<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="open_file.cpp"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></a> <b>Return to <A HREF="open_file.cpp">open_file.cpp</A>
+ CVS log</b> <IMG SRC="http://www.nevrax.org/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="http://www.nevrax.org/inc/img/picto-dir.gif" ALT="[DIR]" BORDER="0" WIDTH="15" HEIGHT="13"> <b>Up to <a href="/cvs/cvsweb.cgi/">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/">code</a> / <a href="/cvs/cvsweb.cgi/code/tool/">tool</a> / <a href="/cvs/cvsweb.cgi/code/tool/open_file/">open_file</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/">code</a> / <a href="/cvs/cvsweb.cgi/code/tool/">tool</a> / <a href="/cvs/cvsweb.cgi/code/tool/open_file/">open_file</a> / <a href="/cvs/cvsweb.cgi/code/tool/open_file/open_file.cpp">open_file.cpp</a>&nbsp;(<A HREF="/cvs/cvsweb.cgi/~checkout~/code/tool/open_file/open_file.cpp?rev=1.2" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/tool/open_file/open_file.cpp?rev=1.2','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR>
+Revision <B>1.2</B>, <i>Fri Dec 8 10:21:10 2000 UTC</i> (18 months, 3 weeks ago) by <i>corvazier</i>
+<BR>Branch: <b>MAIN</b>
+<BR>CVS Tags: <b>HEAD</b><BR>Changes since <b>1.1: +10 -3
+ lines</b><PRE>
+no message
+</PRE>
+</td></tr></table><HR noshade><PRE>// openhtml.cpp : Defines the entry point for the application.
+//
+
+#include &lt;windows.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+
+LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
+{
+ &nbsp; &nbsp;HKEY hkey;
+ &nbsp; &nbsp;LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &amp;hkey);
+
+ &nbsp; &nbsp;if (retval == ERROR_SUCCESS)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp;long datasize = MAX_PATH;
+ &nbsp; &nbsp; &nbsp; &nbsp;TCHAR data[MAX_PATH];
+ &nbsp; &nbsp; &nbsp; &nbsp;RegQueryValue(hkey, NULL, data, &amp;datasize);
+ &nbsp; &nbsp; &nbsp; &nbsp;lstrcpy(retdata,data);
+ &nbsp; &nbsp; &nbsp; &nbsp;RegCloseKey(hkey);
+ &nbsp; &nbsp;}
+
+ &nbsp; &nbsp;return retval;
+}
+
+bool OpenFile (LPCTSTR filename, LPCTSTR ext, int showcmd)
+{
+ &nbsp; &nbsp;TCHAR key[MAX_PATH + MAX_PATH];
+
+ &nbsp; &nbsp;// First try ShellExecute()
+ &nbsp; &nbsp;HINSTANCE result = ShellExecute(NULL, &quot;open&quot;, filename, NULL,NULL, showcmd);
+
+ &nbsp; &nbsp;// If it failed, get the .htm regkey and lookup the program
+ &nbsp; &nbsp;if ((UINT)result &lt;= HINSTANCE_ERROR)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp;if (GetRegKey(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lstrcat(key, &quot;\\shell\\open\\command&quot;);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TCHAR *pos;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pos = strstr(key, &quot;\&quot;%1\&quot;&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (pos == NULL) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No quotes found
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pos = strstr(key, &quot;%1&quot;); &nbsp; &nbsp; &nbsp; // Check for %1, without quotes
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (pos == NULL) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No parameter at all...
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pos = key+lstrlen(key)-1;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*pos = '\0'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Remove the parameter
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*pos = '\0'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Remove the parameter
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lstrcat(pos, &quot; &quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lstrcat(pos, filename);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int res = WinExec(key,showcmd);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return (res&gt;31);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;else
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return true;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;return false;
+}
+
+int APIENTRY WinMain(HINSTANCE hInstance,
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HINSTANCE hPrevInstance,
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LPSTR &nbsp; &nbsp; lpCmdLine,
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int &nbsp; &nbsp; &nbsp; nCmdShow)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;// TODO: Place code here.
+ &nbsp; &nbsp; &nbsp; &nbsp;if (strcmp (lpCmdLine, &quot;&quot;)==0)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MessageBox (NULL, &quot;Open a file with the default application.\nUsage: open_file [filepath]&quot;, &quot;Open file&quot;, MB_OK|MB_ICONINFORMATION);
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;else
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char ext[512];
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_splitpath (lpCmdLine, NULL, NULL, NULL, ext);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OpenFile(lpCmdLine, ext, SW_SHOW);
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;return 0;
+}
+</PRE> \ No newline at end of file