//000502 new function to return string of all items
	VString Export ()
	{
		//BEEP;
		
		VLinkedListStringItem* pItem = GetFirstItem();
		VString	sOut;

		while ( pItem )
		{
			sOut.Append (pItem->String());

			//070830 this sub is for building an Export TT. we no longer want the
			//		trailing \t, too hard to read and TT parses OK without it
			//sOut.Append ("\t-\t\n,");	//000601 for Export TT. 041101 added hyphen
			sOut.Append ("\t-\n,");

			pItem = pItem->GetNextItem();
		}
		
		return sOut.String ();
	}
コード例 #2
0
	/** Register an applications file extension and type with the system. To
	remove them during un-install, call RemoveOpenCommand().
	pszDotFileExtension is the file extension used when the system should
	launch your application when the user clicks on a file of your type.
	This must include the leading period. For instance, if your application
	deals with TXT files, pass .TXT for pszDotFileExtension. pszFileType is
	the name of the file association the system displays for the
	pszDotFileExtension type. For TXT, the system displays "Text File". You
	can customize what the user see's with pszFileType. Returns VTRUE on
	success, VFALSE on failure.*/
	static VBOOL	OpenCommand(	VSTRING_CONST	pszDotFileExtension,
									VSTRING_CONST	pszFileType,
									HINSTANCE		hAltModuleHandle = NULL)
	{
		/* These must be known!*/
		VASSERT(VSTRLEN_CHECK(pszDotFileExtension))
		VASSERT(VSTRLEN_CHECK(pszFileType))

		/* Must start with period.*/
		VASSERT(*pszDotFileExtension == '.')

		VBOOL bSuccess = VFALSE;

		VRegistry reg;

		if ( reg.CreateKey(pszDotFileExtension, HKEY_CLASSES_ROOT) )
		{
			reg.WriteString((VSTRING_CONST)NULL, pszFileType);
			reg.Close();

			/* Set the file type so Explorer can display this instead
			of just "xxx file".*/
			if ( reg.CreateKey(pszFileType, HKEY_CLASSES_ROOT) )
			{
				reg.WriteString((VSTRING_CONST)NULL, pszFileType);

				/* Create the default icon key.*/
				VRegistry regDefaultIcon;

				if ( regDefaultIcon.CreateKey(	VTEXT("DefaultIcon"),
												reg.GetKey()) )
				{
					/* Get module path and append ,0 to it.*/
					VString s;

					if (	s.GetModulePath(VFALSE, VFALSE, hAltModuleHandle) &&
							s.Append(VTEXT(",0")) )
					{
						regDefaultIcon.WriteString((VSTRING_CONST)NULL, s);
						regDefaultIcon.Close();
					}
				}

				/* Create the command key.*/
				VRegistry regCommand;

				if (	regCommand.CreateKey(
							VSHELLREGISTRAR_STRING_SHELL_OPEN_COMMAND,
							reg.GetKey()) )
				{
					reg.Close();

					/* Get module path. Filename must be in quotes for
					long filenames to work.*/
					VString s(VTEXT("\""));

					if (	s.GetModulePathAppend(	VFALSE,
													VFALSE,
													hAltModuleHandle) &&
							s.Append(VTEXT("\" \"%1\"")) )
					{
						/* Write this key.*/
						regCommand.WriteString((VSTRING_CONST)NULL, s);

						/* Success!*/
						bSuccess = VTRUE;
					}
				}
			}
		}

		return bSuccess;
	}