[commit] r2098 - trunk/GME/Gme
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Nov 2 11:49:45 CDT 2012
Author: ksmyth
Date: Fri Nov 2 11:49:44 2012
New Revision: 2098
Log:
Use ReferenceSwitcher on drag-n-drop to reconnect refports based on name and kind
Added:
trunk/GME/Gme/CSGUIInterop.cpp
Added: trunk/GME/Gme/CSGUIInterop.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/GME/Gme/CSGUIInterop.cpp Fri Nov 2 11:49:44 2012 (r2098)
@@ -0,0 +1,32 @@
+#include "StdAfx.h"
+
+#include <direct.h>
+
+#import "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.tlb" no_implementation
+#import "CSGUI.tlb" no_implementation
+
+#import "CSGUI.tlb" implementation_only
+
+#pragma comment(linker, "\"/manifestdependency:type='win32' processorArchitecture='msil' name='CSGUI' version='1.0.0.0' language='*'\"")
+
+static HRESULT IsolationAwareCoCreateInstance_(const IID& clsid, const IID& iid, void** out)
+{
+ ULONG_PTR cookie;
+ BOOL succ = IsolationAwareActivateActCtx(0, &cookie);
+ ASSERT(succ);
+ HRESULT hr = CoCreateInstance(clsid, 0, CLSCTX_ALL, iid, (void**)out);
+ succ = IsolationAwareDeactivateActCtx(0, cookie);
+ ASSERT(succ);
+ return hr;
+}
+
+void MoveReferenceWithRefportConnectionsAndWriteToConsole(IMgaFCO* target, IMgaReference* ref)
+{
+ using namespace CSGUI;
+ _ReferenceSwitcherPtr switcher;
+ // n.b. RS is the coclass, _RS is the interface
+ HRESULT hr = IsolationAwareCoCreateInstance_(__uuidof(ReferenceSwitcher), __uuidof(_ReferenceSwitcherPtr), (void**) &switcher);
+ if (FAILED(hr))
+ throw hresult_exception(E_MGA_REFPORTS_USED);
+ switcher->SwitchReference(target, ref);
+}
\ No newline at end of file
More information about the gme-commit
mailing list