[GUID ("CB5BDC81-93C1-11CF-8F20-00805F2CD064"), interfacetype (cominterfacetype. interfaceisiunknown)]
Public interface IObjectSafety
{
// Methods
Void getinterfaccesafyoptions (
System. int32 riid,
Out system. int32 pdwsupportedoptions,
Out system. int32 pdwenabledoptions );
Void setinterfacesafetyoptions (
System. int32 riid,
System. int32 dwoptionssetmask,
System. int32 dwenabledoptions );
}
[Comimport, GUID ("00000118-0000-0000-c000-000000000046"), interfacetype (cominterfacetype. interfaceisiunknown)]
Public interface ioleclientsite
{
Void saveobject ();
Void getmoniker (uint dwassign, uint dwwhichmoniker, object ppmk );
Void getcontainer (Out iolecontainer ppcontainer );
Void showobject ();
Void onshowwindow (bool fshow );
Void requestnewobjectlayout ();
}
[comimport, GUID ("0000011b-0000-0000-c000-000000000046"), interfacetypeattribute (cominterfacetype. interfaceisiunknown)]
Public interface iolecontainer
{< br> void enumobjects ([IN, financialas (unmanagedtype. u4)] int grfflags,
[out, financialas (unmanagedtype. lparray)] object [] ppenum);
void parsedisplayname ([IN, financialas (unmanagedtype. interface)] object PBC,
[IN, financialas (unmanagedtype. BSTR)] string pszdisplayname,
[out, financialas (unmanagedtype. lparray)] int [] pcheaten,
[out, financialas (unmanagedtype. lparray)] object [] ppmkout);
void lockcontainer ([IN, financialas (unmanagedtype. i4)] int flock);
}
[Comvisible (true)]
[Progid ("workflowdesigntimecontrol")]
[Classinterface (classinterfacetype. autodual)]
[GUID ("8d838c92-9eff-4f34-b685-76897809f382")]
Public partial class workflowdesigntimecontrol: usercontrol, IObjectSafety
{
Public workflowdesigntimecontrol ()
{
Initializecomponent ();
}
Public void showmessage (string MSG)
{< br> If (MSG! = NULL)
{< br> MessageBox. show (MSG);
}< br> calljavascript ("PPP. test ('"+ MSG +"') ");
}
private void calljavascript (string code)
{< br> type typeioleobject = This. getType (). getinterface ("ioleobject", true);
Object oleclientsite = typeioleobject. invokemember ("getclientsite",
bindingflags. instance | bindingflags. invokemethod | bindingflags. public,
null,
This,
null);
Ioleclientsite oleclientsite2 = oleclientsite as ioleclientsite;
Iolecontainer pobj;
Oleclientsite2.getcontainer (Out pobj );
// Obtain the script set of the page
Ihtmldocument2 pdoc2 = (ihtmldocument2) pobj;
Ihtmlwindow2 win2 = (ihtmlwindow2) pdoc2.parentwindow;
Win2.execscript (Code, "JavaScript ");
// Object script = pdoc2.script;
// try
// {
// script. getType (). invokemember (functionname,
// bindingflags. instance | bindingflags. invokemethod | bindingflags. public,
// null,
// script,
// ARGs );
// }< br> // catch {}< BR >}
# Region IObjectSafety Member
Public void getinterfaccesafyoptions (int32 riid, out int32 pdwsupportedoptions, out int32 pdwenabledoptions)
{
// Todo: Add webcamcontrol. getinterfaccesafyoptions to implement
Pdwsupportedoptions = 1;
Pdwenabledoptions = 2;
}
Public void setinterfacesafetyoptions (int32 riid, int32 dwoptionssetmask, int32 dwenabledoptions)
{
// Todo: Add webcamcontrol. setinterfacesafetyoptions implementation
}
# Endregion
[Comregisterfunction ()]
Public static void registerclass (string key)
{
Stringbuilder sb = new stringbuilder (key );
SB. Replace (@ "hkey_classes_root \","");
Registrykey K = registry. classesroot. opensubkey (sb. tostring (), true );
Registrykey CTRL = K. createsubkey ("control ");
CTRL. Close ();
Registrykey inprocserver32 = K. opensubkey ("inprocserver32", true );
Inprocserver32.setvalue ("codebase", assembly. getexecutingassembly (). codebase );
Inprocserver32.close ();
K. Close ();
}
[Comunregisterfunction ()]
Public static void unregisterclass (string key)
{
Stringbuilder sb = new stringbuilder (key );
SB. Replace (@ "hkey_classes_root \","");
Registrykey K = registry. classesroot. opensubkey (sb. tostring (), true );
K. deletesubkey ("control", false );
Registrykey inprocserver32 = K. opensubkey ("inprocserver32", true );
K. deletesubkey ("codebase", false );
K. Close ();
}
}
[Assembly: allowpartiallytrustedcallers ()]
[Assembly: comvisible (true)]
Regasm Aclass. dll/TLB/codebase