Hi,
I'm trying to write a custom action .dll using managed C++ in Microsoft Visual 2005.
Are there examples of this ?
All I'm after is stub to show the parameter passing mechanism.
Thanks,
Steve.
Hi,
I'm trying to write a custom action .dll using managed C++ in Microsoft Visual 2005.
Are there examples of this ?
All I'm after is stub to show the parameter passing mechanism.
Thanks,
Steve.
Hi Steve
I have to admit I don't think we have tried to write actions using Managed C++ before. This is my first attempt with Managed C++, I'm kinda shocked at how little the VS IDE does for you compared to the other languages it supports!
I got this to compile, but haven't tested it yet :
// CPPTest.h
#pragma once
using namespace System;
using namespace FB60CustomActionInterfaces;
namespace CPPTest {
public ref class Class1 : IFBCustomAction
{
// TODO: Add your methods for this class here.
public: virtual System::Void AbortAction(FB60CustomActionInterfaces::IFBCustomActionExecuteContext^ Context)
{
};
public: virtual System::Boolean OnExecute(FB60CustomActionInterfaces::IFBCustomActionExecuteContext^ Context)
{
return false;
};
public: virtual System::Boolean OnValidate(FB60CustomActionInterfaces::IFBCustomActionValidateContext^ Context)
{
return false;
};
public: virtual System::Boolean SupportsAbort()
{
return false;
};
};
}
I will try to test this later today if time permits (end of financial year stuff to deal with today).
Thanks Vincent.
I finally managed to get there in the end using "code by permutation", although I've now hit the next brickwall!!!
I'm trying to return a value from my managed C++ back to finalbuilder.
In my managed C++ i've used the line
context->SetVariable(context->Properties->PropertyAsString::get("ReturnString"), string1);
to set the property "ReturnString" to value of string1.
In ActionStudio, I've included a property "ReturnString" and a property page with a text box that uses
"bind to" ReturnString.
When calling this custom action, I insert a finalbuilder variable "%returnString%" into the above textBox,
but when I run the program, nothing gets returned.
Any sugguestions?
thanks, Steve
Hi Steve
Try splitting up the statement so we can see where it is going wrong :
System::String^ variablename = context->Properties->PropertyAsString::get("ReturnString");
context-SendLogMessage(variablename);
context->SetVariable(variablename, string1);
Then we can see if the variable name is ok.
Other than that, you can send you VC project and action package to support and I will take a look at it on monday and see if I can debug it and figure out what is going wrong.
Hi Vincent,
I tried that, and in Visual, it seems to have picked up the correct variable name from the property,
but when I pass that value through, it doesn't appear to be making it into finalbuilder
ie. a watch on the variable remains the same.
I've sent a copy of the Visual solution and action studio action to support.
Thanks,
Stephen.
Ok,
I think I've found the problem...
In action studio, I used a TextEdit box for the return value as opposed to a VariablesComboBox.
This seems to have fixed the problem and I can now pass the value through.
As an aside, am I able to do it using a TextEdit box ? From memory, I thought some of the native actions allowed you to specify variables directly into a TextEdit as opposed to the VariablesComboBox ?
Thanks for the help,
Steve.
Hi Steve
I haven’t looked at your project yet, but my guess would be that you are specifying the variable name in the textbox with % symbols, which you shouldn’t do when dealing with variable names rather than variable references.