summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:13:22 +0000
committerfcolin2007-02-01 13:13:22 +0000
commit7bf5378bec2ed162969b82f53b1cd6611842ef0a (patch)
tree5425704fa55064fc7d18bdda7e2dc5efb6c14c4c
parent8bb2578cce0bf473a91f33e661a17015758ca7f4 (diff)
downloadivy-cplusplus-7bf5378bec2ed162969b82f53b1cd6611842ef0a.zip
ivy-cplusplus-7bf5378bec2ed162969b82f53b1cd6611842ef0a.tar.gz
ivy-cplusplus-7bf5378bec2ed162969b82f53b1cd6611842ef0a.tar.bz2
ivy-cplusplus-7bf5378bec2ed162969b82f53b1cd6611842ef0a.tar.xz
Utilisateur : Fcolin Date : 3/10/02 Heure : 10:55 Créé Commentaire: (vss 1)
-rw-r--r--comIvy/Expression.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/comIvy/Expression.cpp b/comIvy/Expression.cpp
new file mode 100644
index 0000000..468a431
--- /dev/null
+++ b/comIvy/Expression.cpp
@@ -0,0 +1,65 @@
+// Expression.cpp : implémentation de CExpression
+
+#include "stdafx.h"
+#include "Bus.h"
+#include "Ivy.h"
+#include "IvyApplication.h"
+
+#include "Expression.h"
+
+
+char * ConvBSTR( BSTR str );
+BSTR ConvCSTR( const char *str );
+
+// CExpression
+
+
+STDMETHODIMP CExpression::Unbind(void)
+{
+ if ( !bus ) return E_FAIL;
+ if ( bus->bus )
+ bus->bus->UnbindMsg( id );
+ bus->Release();
+ return S_OK;
+}
+
+void CExpression::OnMessage(IvyApplication * app, int argc, const char ** argv)
+{
+ BSTR appname = ConvCSTR( app->GetName() );
+ SAFEARRAY *pArrayVal = NULL;
+ HRESULT hr = S_OK;
+
+ //Create the safe array for the arguments string.
+ pArrayVal = SafeArrayCreateVector( VT_VARIANT, 0, argc );
+
+ if (!(pArrayVal == NULL) )
+ {
+ // Set the values for each element of the array
+ for( long i = 0 ; i < argc && SUCCEEDED( hr );i++)
+ {
+ hr = SafeArrayPutElement(pArrayVal, &i, new CComVariant(ConvCSTR(argv[i])));
+ }
+
+ }
+ VARIANT args;
+ args.vt = VT_ARRAY | VT_VARIANT;
+ args.parray = pArrayVal;
+
+ Received( appname, args );
+
+ SafeArrayDestroy(pArrayVal);
+}
+// CExpression
+CExpression::CExpression()
+{
+ id = -1;
+ bus = 0;
+ ATLTRACE("CExpression created\n");
+}
+CExpression::~CExpression()
+{
+ Unbind();
+ id = -1;
+ bus = 0;
+ ATLTRACE("CExpression destroyed\n");
+}