|
Thank you, but it does not work.
YVS
|
|
|
|
|
When I use the function "accLocation" in an HTML page,
I get the points: top and left, that refer to the part of the page that I can see.
how can I get the points that refer to the beginning of the page?
For example:
I have a long html page (5000 points),
and I scrolled down.
We can see the points from 2500 to 3500.
I have an object that its top is 2700,
When I run the function "accLocation" I get the top 200.
How can I get the full measurement 2700?
Thank you
Chagit
|
|
|
|
|
I need to use IDispatch::Invoke() to call a function which I know by name. Therefore, I can use GetIDsOfNames() to find the DISPID of the function.
But what if I have overloaded functions, that is several functions with the same name, but different arguments? How can I get the DISPID of the right one?
I vote pro drink
|
|
|
|
|
You can't have methods with the same name.
|
|
|
|
|
Yeah, I've just found out that. Thanks for your reply.
I vote pro drink
|
|
|
|
|
How can i obtain the IUnknown interface pointer(LPUNKNOWN) for an ActiveX Control ?
Abdiel Jaramillo
Arango Software International
Panama, Rep. of Panama.
|
|
|
|
|
I have a simple ATL COM control and I need to supply a method that fills a BYTE buffer (passed by the caller) with some data that the control has read from a file. As this data may contain zeroes, I cannot use BSTR. I thought this would be easy - declare something like the following IDL:
[id(11), helpstring("method GetImage")] HRESULT GetImage([out] unsigned char* pData, [out, retval] BOOL* pVal);
Then access the buffer directly in the COM control:
STDMETHODIMP CKView2::GetImage(unsigned char* pData, BOOL* pVal)
{
// Access the buffer
memcpy(pData, m_pSource, ...)
// Done
*pVal = TRUE;
return S_OK;
}
Of course, this doesn't work.
The question is - is there a simply way to do this? Or do I need to look at the ghastly SAFEARRAY? Strings are allocated with AllocSysString - is there an equivalent way to allocate a generic buffer allowing you to easily copy some non-string data?
Any comments would be appreciated!
|
|
|
|
|
Yes you need to look at SAFEARRAY. It's not that bad to use a SafeArray.
I also found it's better to pass array as VARIANT.
Good luck and be patient!
- Greatest invention : "The Microchip!"
|
|
|
|
|
If you don't want to use an array, a quick and dirty way is the following:
[id(11), helpstring("method GetImage")] HRESULT GetImage(long pData, [out, retval] BOOL* pVal);
Here "pData" is the buffer address supplied by the client (casted to long). So the implementation will be like:
STDMETHODIMP CKView2::GetImage(long pData, BOOL* pVal)
{
// Access the buffer
memcpy((void*) pData, m_pSource, ...)
// Done
*pVal = TRUE;
return S_OK;
}
P.S. 1. This works only for "in-proc" controls.
P.S. 2. Since you data may contains NULL characters, you might want to add another parameter for buffer size or return data length.
|
|
|
|
|
<br />
ThisBytes([in] int nCount, [out] BYTE** ppBytes)<br />
{<br />
BYTE* pBytes = reinterpret_cast<BYTE*>(CoTaskMemAlloc(nCount * sizeof(BYTE));<br />
<br />
<br />
*ppBytes = pBytes;<br />
<br />
return S_OK;<br />
}<br />
Don't forget to call CoTaskMemFree
|
|
|
|
|
Hi,
I developed a COM app under VC++, which is called by a macro from WinWord.
The application have 6 Dll's, some works perfectly, and some which must show a dialog derived from CDialogImpl doesn't.
In machines that has or had the VC++ installed, my application works perfectly, no problems. But in machines that never had the VC++ installed, the problem occurs.
Everything is registered, installed as should be installed. So the problem is not with the application, and I think it could be with some Dll's from the system.
So if someone has a solution, please send me.
Thanks.
Otávio
otavio.romao@inatel.br
|
|
|
|
|
Make sure everything is built in release mode not debug.
|
|
|
|
|
|
How can i catch the events fired by an ActiveX control without using Class Wizard ?
I'm creating the controls at runtime that's why i can't use the ClassWizard to create the Event Sink Map.
Abdiel Jaramillo
Arango Software International
Panama, Rep. of Panama.
|
|
|
|
|
Very strange. My previous reply to this message seems to have disappeared.
Anyway, you can try using my XYDispDriver class to handle events. You need to implement a com object as your event handler (using either ATL or MFC). It only works for non-GUI controls (the com interface has to be derived from IDispatch).
Warning: Some ATL "experts" hate this method.
|
|
|
|
|
Hi, I recently wrote a COM control (GUI-less, not active-X) that I load into a webpage using the "OBJECT" tag. I have several HTML elements on the page that are updated periodically based on the state of the COM object (it does some complex calculations based on form variables on the page). Currently, I use a hacked solution of using the SetInterval/SetTimer methods in javascript and polling the state of the COM object. I was wondering if there's a better way to do this? I have lots of ideas but am wondering if there's a clear-cut good way to do this: Can I pass a pointer to the COM object and have it directly access elements on the webpage whenever it wants to change their state? Is it legal to pass IHTMLElement pointers directly from javascript to the COM object and then call methods on them from the control? What happens if the page is unloaded and the COM object tries to use the pointer? Is this a place where I could use event sinks? Thanks!
Mach5 Enterprises, LLC. http://www.mach5.com/
"Web Intelligence for the New Economy"
|
|
|
|
|
Ugh,
I'll try to answer something - generally you can pass pointer to your com object and allow him directly access webpage elements (or use 1x1 pixel visual AX and retrieve interfaces of IE directly without script). There should not be generally problems, because when you leave the page, your component will be destroyed (should be). Only beware of circular references - afaik the "page" holds reference to your object, so if you'll hold reference to page...
I'm not strong in IE scripting, but you can use events in some way,
you write
|
|
|
|
|
Hello,
I have some sort of problem in COM while passing the ADO recordset
object through variant to the client. In the server I can able to traverse
through the recordset . Once I got the variant at the client end, the variant
contains the NULL (VT_EMPTY) .
What is the problem? For your clarity I'm putting some excerption from my
coding.
At Server_End
HRESULT CServer::Function1(VARIANT *pvarRSObj, VARIANT *pvarRetVal)
{
_RecordsetPtr pRSObj = NULL;
try
{
pRSObj->CreateInstance(__uuidof(Recordset));
pRSObj->Open(varQueryString, (IDispatch*)m_conObj,
adOpenKeyset, adLockBatchOptimistic, adCmdText);
pvarRSObj->vt = VT_DISPATCH;
pvarRSObj->pdispVal = (IDispatch*)pRSObj;
}
catch(_com_error &e)
{
ERRBOX(e.ErrorMessage());
return e.Error();
}
catch(...)
{
ERRBOX("Unknown Exception");
return E_FAIL;
}
return S_OK;
}
At Client_End
InvokeServer()
{
IServer *pServer;
//instantiation of server
pServer->Function1(&varRSObj, &varResponse);
CHECKVARIANTTYPE(&varRSObj); //It'll check the variant type
// this is showing me that variant contains VT_EMPTY.
if(varRSObj.vt == VT_DISPATCH)
{
//necessary action
}
}
Timely reply appreciated.
Regards,
Ramesh
|
|
|
|
|
Hi,
You can return a Recordset as an IDispatch pointer like this:
STDMETHODIMP CMyClass::GetAllRecords(BSTR bstrSearchKey, IDispatch **output)
{
....
....
*output = (IDispatch*) pRecordset.Detach(); //Return recordset as IDispatch
}
Regards,
ShadiK
Shadi Al-Kahwaji
|
|
|
|
|
I am hosting IWebBrowser2 in my application. The problem is that "cut & copy" of the default context menu were not working. Whenever I tried to copy ,"Acces is denied" alert box comes up. So I implemented my own context menu using "ShowContextMenu" of IDocHostUIHandlerDispatch interface. I used IOleCommandTarget for delete, and implemented copy and cut on my own. However, my code does not work on IE 5.0. What should I do?. Are the IOleCommandTarget's Exec method or IWebBrowser's ExecWB method not availabe on 1E 5.0 .
These functions do not work on Win98 also. Is there any other way of doing these in win98?Please help. I am in urgent need.
|
|
|
|
|
uyiyuiyuncvnvbmnvbmnvbmsdgsdgfsdf!!!!!!!!!!!!
|
|
|
|
|
when i try to return an integer Locally, everything goe's smooth.
but when i try it remotely i get the next number:-858993460
whatever the input is.
Plese Help!
|
|
|
|
|
Ok, did you look at the conversion? -858993460 is 0xCCCCCCCC which is usually what you find in uninitialized memory when running in debug mode.
Are you initializing the variable that you're returning? Just a guess.
J
|
|
|
|
|
Hi all,
When outputting a VARIANT from a COM interface member (as an [out] parameter, not [in, out]), should I call ::VariantClear() or ::VariantInit() on the output parameter before assigning to it? Or is this redundant/incorrect?
e.g.:
STDMETHODIMP MyFunc (/*[out]*/ VARIANT* pVal)
{
VariantInit (pVal); // ok?
pVal->vt = ....
...
}
cheers
NB
|
|
|
|
|
See sample app of COM Variant and Safearrays at
http://www.sellsbrothers.com/tools/CComSafeArray.zip
(from chris sells site)
|
|
|
|