XPlode 1.0x Plugin Development Questions, Answers?
#1
Posted 20 February 2004 - 04:09 PM
#2
Posted 20 February 2004 - 04:30 PM
I wonder how many are going to be posting in this thread besides me?
Well anyway, the only code I'm interested in was the execute one. If my ideas work, then i'll post the code back with the mods, but if not....I think I'll keep teh feeble ideas to myselft.
Also, in regards to the XML, are all the attributes saved, or are they just thrown out as invalid arguments. If they are thrown out, might i suggest rather keepings the arguments, but have them no use till they are needed.
Hopefully when i get home, VS will be done installing (darn multiple CDs)....
Also, don't worry about cleanign up code all that much, I'll just ignore what i don't understand
#3
Posted 20 February 2004 - 05:23 PM
CString ExecuteProgram(CString program, CString arguments, bool hide, bool nowait)
{
// Check to see we got valid inputs
int nShow = SW_SHOW;
if(program.CompareNoCase(_T("")) == 0)
return _T("Invalid XML syntax - missing \'program\' attribute");
if(hide)
nShow = SW_HIDE;
// Construct the logging text
CString logtext;
logtext.Format(_T("Running: \'%s %s\'"), program, arguments);
if(nShow == SW_HIDE)
logtext += _T(" (hidden)");
WriteLog(logtext);
// error string
CString error = _T("");
// set up the command to execute the program
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS|SEE_MASK_FLAG_NO_UI;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = program;
ShExecInfo.lpParameters = arguments;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = nShow;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
// wait until the program is finished
if(!nowait)
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
// get the error string if appropriate
if(ShExecInfo.hInstApp < (HINSTANCE)32)
{
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_FNF)
error = _T("File not found.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_PNF)
error = _T("Path not found.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_ACCESSDENIED)
error = _T("Access denied.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_OOM)
error = _T("Out of memory.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_DLLNOTFOUND)
error = _T("Dynamic-link library not found.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_SHARE)
error = _T("Cannot share an open file.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_ASSOCINCOMPLETE)
error = _T("File association information not complete.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_DDETIMEOUT)
error = _T("DDE operation timed out.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_DDEFAIL)
error = _T("DDE operation failed.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_DDEBUSY)
error = _T("DDE operation is busy.");
if(ShExecInfo.hInstApp == (HINSTANCE)SE_ERR_NOASSOC)
error = _T("File association not available.");
}
// return the possible error
return error;
}
Have fun mutilating it
#4
Posted 20 February 2004 - 05:56 PM
and how are the attributes in the XML saved?
#5
Posted 20 February 2004 - 06:51 PM
If you read the comments in the cpp file, it tells you how to access them.
If an attribute doesn't exist, the string returned will be empty.
So say you want to get an attribute of 'folder', you'd call:
bool RunCommand(...)
{
if(cmd_id == FOLDER_COMMAND)
{
CString folder = attributes[L"folder"];
if ( folder.Compare(L"") == 0 )
{
// we didn't get a folder
WriteLog(...);
return false;
}
// do something
return true;
}
return false;
}
For that execute function, I send it attributes[L"program"], attributes[L"arguments"], and whether it should be hidden, or not wait. As you can see from the functino declaration.
EDIT:
// This function is the workhorse - it performs the commands
bool _cdecl RunCommand(DWORD cmd_id, KeyedMap& attributes, CString &internaldata)
{
/*
* To change the display for the current item, call
DISPLAY(_T("Text to display"), percentage);
* To add a line to the log file, call
WriteLog(_T("Text to log"));
* To retrieve a string from the configuration table, call GetString:
CString out;
GetString(_T("the_string"), out);
*/
// If you want an attribute by the name of 'stinky'
// the value is acquired by calling:
// CString value = attributes[_T("stinky")];
if(cmd_id == EXECUTE_COMMAND)
{
// display the text in the "display" attribute in the XML
Display(attributes[_T("display")], -1);
// run the program
CString error = ExecuteProgram(
attributes[_T("program")],
attributes[_T("arguments")],
(attributes[_T("hide")].CompareNoCase(_T("true")) == 0),
(attributes[_T("nowait")].CompareNoCase(_T("true")) == 0)
);
// log errors or success
if(error.GetLength())
WriteLog(_T("Error: ") + error);
else
WriteLog(_T("Execution succeeded"));
return true;
}
return false;
}
The execute command.
#6
Posted 20 February 2004 - 06:51 PM
#7
Posted 20 February 2004 - 07:04 PM
#8
Posted 20 February 2004 - 07:34 PM
Is it C++ or C#?
#9
Posted 20 February 2004 - 08:07 PM
in the SDK, one of the files (the one for the project) says it I think
EDIT::
Quote
ProjectType="Visual C++"
I tried opening the vcproj file, but my VS says it can't open 7.1 files, only 7.0. How to fix this....
#10
Posted 20 February 2004 - 08:30 PM
It has nothing to do with the .NET framework.
If you're asking what version of VS, it's VS.NET 2003.
@Alanoll:
Change the 7.1 to 7.0 in the vcproj file.
There's no easy way to call other plugins, and there's no way to call anything in XPlode, apart from the callbacks I've put in. If you've got suggestions on what kinda things you want to do with XPlode, I might be able to implement them, within reason and current code structure permitting.
The way to call other plugins would be to load the other plugin manually from yours, then call the functions. You can see the types and whatnot because your plugin function definitions would be exactly the same.
Then you'd reconstruct the arguments, and send them across to the loaded plugin.
I'd say it's a whole lot of screwing around to do something, so you might be wise writing your own functions.
What were you planning to do anyways?
#11
Posted 20 February 2004 - 08:49 PM
but its always good to know if i get a sudden insperation over the weekend
Is there anyway to change what is displayed in XPlode (the box that comes up) from within a plugin or just write to logs?
#12
Posted 20 February 2004 - 08:54 PM
I made it only allow the plugin to change what's shown for the current item being executed, purposely. XPlode doesn't handle that line at all, apat from clearing it when the next thing is executed.
There's no real reason I want to let plugins control the whole setup. To much screwing around from item to item.
(There may be one way soon, but I'm not telling, because it could lead to abuse
#14
Posted 20 February 2004 - 09:09 PM
thanks X, atleast the link still worked
EDIT:: Just saw Wraith post above about the display function....good gooood
#15
Posted 20 February 2004 - 09:15 PM
#16
Posted 20 February 2004 - 09:21 PM
#18
Posted 20 February 2004 - 09:53 PM
It'll probably be StdAfx.h, change it to XPlodePluginBase.h, or whatever ur plug's called.
#19
Posted 20 February 2004 - 09:54 PM
#20
Posted 20 February 2004 - 11:04 PM
Wraith, on Feb 20 2004, 10:30 PM, said:
It has nothing to do with the .NET framework.
If you're asking what version of VS, it's VS.NET 2003.
You answered part of my question. Which VS.NET you were using and what language is the plugin SDK done with. The SDK does not have docs that specify development requirements or if a particular language (C++, Java, C#, VB) should be used. I noticed the plugins seem to be EXE files renamed to XPD. Could I use a C++ compiler to create a plugin besides VS (e.g. Dev C++) ?
I thought the .NET part meant it supported the .NET extensions
Maybe you meant to say that Xplode does NOT use the .NET framework.



Help


Back to top









