Click here to Skip to main content
15,910,872 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralLoading a Dialog Resource from a different DLL Pin
PhilGoh29-Apr-08 2:30
PhilGoh29-Apr-08 2:30 
AnswerRe: Loading a Dialog Resource from a different DLL Pin
prasad_som30-Apr-08 4:16
prasad_som30-Apr-08 4:16 
QuestionHandle VC++ ATL COM Event in Java Script ?? [modified] Pin
garammasala28-Apr-08 2:46
garammasala28-Apr-08 2:46 
GeneralRe: Handle VC++ ATL COM Event in Java Script ?? Pin
Stephen Hewitt28-Apr-08 15:57
Stephen Hewitt28-Apr-08 15:57 
GeneralRe: Handle VC++ ATL COM Event in Java Script ?? Pin
garammasala28-Apr-08 17:42
garammasala28-Apr-08 17:42 
GeneralRe: Handle VC++ ATL COM Event in Java Script ?? Pin
Stephen Hewitt28-Apr-08 17:46
Stephen Hewitt28-Apr-08 17:46 
GeneralRe: Handle VC++ ATL COM Event in Java Script ?? Pin
garammasala28-Apr-08 20:43
garammasala28-Apr-08 20:43 
GeneralRe: Handle VC++ ATL COM Event in Java Script ?? Pin
Stephen Hewitt29-Apr-08 20:07
Stephen Hewitt29-Apr-08 20:07 
Firstly, I’ll assume you’re embedding a COM object in a HTML page (you haven’t explicitly stated this). Here’s what my page looks like:
<html>
 
<head>
<title>CallMe</title>
</head>
 
<body>
<object id="my_obj" classid="clsid:7815559F-240E-406E-A0F0-974B7272C65F">
</object>
<script type="text/javascript" for="my_obj" event="Hello">
window.alert("Hello!");
</script>
<input type="button" value="Call into COM object" onclick="my_obj.CallMe();" />
</body>
 
</html>


Note that I used MSVC6, but other versions will have equivalent functionality.

You’ll have to use connection points to implement an outgoing interface. Here’s the IDL of my project:
// HostMe.idl : IDL source for HostMe.dll
//
 
// This file will be processed by the MIDL tool to
// produce the type library (HostMe.tlb) and marshalling code.
 
import "oaidl.idl";
import "ocidl.idl";
	[
		object,
		uuid(4E413D85-21DC-48FC-AD65-B8635B74CBFF),
		dual,
		helpstring("IHostMeObj Interface"),
		pointer_default(unique)
	]
	interface IHostMeObj : IDispatch
	{
		[id(1), helpstring("method CallMe")] HRESULT CallMe();
	};
 
[
	uuid(9598F3A4-B8DE-4BA8-9AE1-90903ED9EF38),
	version(1.0),
	helpstring("HostMe 1.0 Type Library")
]
library HOSTMELib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");
 
	[
		uuid(5C211D24-97D2-4AA1-AB93-EE605DC97614),
		helpstring("_IHostMeObjEvents Interface")
	]
	dispinterface _IHostMeObjEvents
	{
		properties:
		methods:
		[id(1), helpstring("method Hello")] void Hello();
	};
 
	[
		uuid(7815559F-240E-406E-A0F0-974B7272C65F),
		helpstring("HostMeObj Class")
	]
	coclass HostMeObj
	{
		[default] interface IHostMeObj;
		[default, source] dispinterface _IHostMeObjEvents;
	};
};


It’s also important to implement the IProvideClassInfo and IProvideClassInfo2 interfaces or the callbacks will not work.

The following articles (on the Wayback Machine, as the originals seem to have been deleted) may help:
http://web.archive.org/web/20060915111734/http://msdn.microsoft.com/archive/en-us/dnarguion/html/drgui082399.asp[^]
http://web.archive.org/web/20060921072123/http://msdn.microsoft.com/archive/en-us/dnarguion/html/drgui102599.asp[^]

Steve

QuestionRe: Handle VC++ ATL COM Event in Java Script ?? Pin
garammasala5-May-08 21:07
garammasala5-May-08 21:07 
AnswerRe: Handle VC++ ATL COM Event in Java Script ?? Pin
Stephen Hewitt6-May-08 16:25
Stephen Hewitt6-May-08 16:25 
AnswerRe: Handle VC++ ATL COM Event in Java Script ?? [modified] Pin
garammasala6-May-08 17:38
garammasala6-May-08 17:38 
Generalperformant deserialization from a buffer to a std::Vector‏ Pin
manustone24-Apr-08 3:45
manustone24-Apr-08 3:45 
GeneralRe: performant deserialization from a buffer to a std::Vector‏ Pin
Stuart Dootson28-Apr-08 1:22
professionalStuart Dootson28-Apr-08 1:22 
GeneralRe: performant deserialization from a buffer to a std::Vector‏ Pin
manustone28-Apr-08 5:31
manustone28-Apr-08 5:31 
GeneralA quick question on themes... Pin
Gene OK24-Apr-08 3:01
Gene OK24-Apr-08 3:01 
AnswerRe: A quick question on themes... Pin
Gene OK24-Apr-08 4:54
Gene OK24-Apr-08 4:54 
GeneralUsing VB.NET dll in VC++ Pin
ritz123424-Apr-08 0:17
ritz123424-Apr-08 0:17 
GeneralRe: Using VB.NET dll in VC++ Pin
Jörgen Sigvardsson1-May-08 0:16
Jörgen Sigvardsson1-May-08 0:16 
Questionhow to create a docable or vertical toolbar based on WTL CToolBarCtrl Pin
shwlin21-Apr-08 15:23
shwlin21-Apr-08 15:23 
AnswerRe: how to create a docable or vertical toolbar based on WTL CToolBarCtrl Pin
shwlin24-Apr-08 15:01
shwlin24-Apr-08 15:01 
GeneralRe: how to create a docable or vertical toolbar based on WTL CToolBarCtrl Pin
Charles Spirz27-Apr-08 11:51
Charles Spirz27-Apr-08 11:51 
GeneralRe: how to create a docable or vertical toolbar based on WTL CToolBarCtrl [modified] Pin
shwlin4-May-08 20:51
shwlin4-May-08 20:51 
AnswerRe: how to create a docable or vertical toolbar based on WTL CToolBarCtrl Pin
shwlin18-May-08 15:54
shwlin18-May-08 15:54 
GeneralRe: how to create a docable or vertical toolbar based on WTL CToolBarCtrl Pin
rajas6-May-09 6:04
rajas6-May-09 6:04 
GeneralFast search of a vector of strings Pin
bruccutler15-Apr-08 12:40
bruccutler15-Apr-08 12:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.