|
That may be true, but it is not reflection in the proper sense. Microsoft does not offer reflection in Win32 dll libraries, so anything you rely on may change in the future. .NET reflection is an official part of the .NET architecture and will be supported by Microsoft. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Yeah that's true.
That's not exactly reflection underway.It's effort to make the result similar what reflection facilitates programmer. So I need to get same behavior which's being done in that (Executing function in Win32 DLL by clicking "Execute"). Can we load COM DLL or COM EXE dynamically(in case of DLL its LoadLibrary) and get its functions/methods (in DLL by GetProcAddress.
One way which I sought out is to iterate over vtable which'll contain addresses of COM interface's virtual methods. But that technique only applicable with virtual functions(as they only go in vtable) .
What about simple(non-virtual) methods of COM interfaces.
Where we can get addresses of those methods(non-virtual).
|
|
|
|
|
glitteringsound wrote: Where we can get addresses of those methods(non-virtual).
Sorry, no idea; also I don't believe COM was ever designed with that in mind. My only suggestion is to try it and see what results you get.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Any body else that can help in this regard?
I think we need to lookup .data or .code sections of COM EXE or COM DLL then to lookup exaxct addresses of plain COM interfaces methods.
|
|
|
|
|
You can use the same Informations, OLEViewer uses for his visual representation of objects and interfaces. Is that what you are looking for ?
|
|
|
|
|
I Got the idea.!!
As no any function(method) in interface which's implemented by COM object which's not virtual. All interface methods that implemented by COM component always pure virtaul, thus always go inside vtable. So we can easily traverse vtable and can get exact addresses of all of those. Now rest is calling those functions. It includes knowing about full signature and every thing it takes as parameter. This is the one which is still missing ..an idea.?
|
|
|
|
|
|
Done all!!
Only one thing is left.?
How to iterate (infact access) the vtable of COM coclass(that will implement the methods of its exposed interfaces).?
Only I need to access vtable where all addresses of exposed methods of its interfaces are stored.
|
|
|
|
|
Hi all,
I am getting the following error when i try to update the system registry using the following function in InitInstance():
UpdateRegistry(OAT_DOC_OBJECT_SERVER);
"Failed to update system registry.Please try using regedit"
How to resolve this issue. Could not give admin rights to the user.
Thanks,
|
|
|
|
|
Karthika85 wrote: Could not give admin rights to the user
Assuming you are saying you cannot give these registry update rights to the User, why not have an Administrator install it who would have the rights? This is normal practice as far as I know.
|
|
|
|
|
Hi I am working with Adobe InDesign CS3. I have a VB.NET project where I am providing Indesign file as InPut and generating PDF and EPS files as output. When I create object of InDesign.Application
Ex: Dim appObject = CreateObject("InDesign.Application")
It launches Adobe InDesign Application and then the Document. I tried to Hide the Document using
EX: appObject.Open(InputFile,false);
but How to hide the Application in the Beginning? I dont want the application to be launched, it should work in background and not visible to the User. Can any one please help. Rashmi.M.K
|
|
|
|
|
I have used UrlDownloadToFile for quite some time in firefox and it was working flawlessly. But in the past couple of months or so I am facing this issue in firefox.
I download zip files from web servers inside an ActiveX that runs in a browser. When I log in to a website and try to download the zip file through my ActiveX in firefox, it fails. This worked previously. I have the necessary cookies created on my machine but somehow firefox does not seem to use them anymore. This still works prefectly in IE which downloads the file without any issue.
If the web server does not require a login, the file downloads without any issue.
This function gets stuck during "Sending Request" phase as indicated by the status code in the Progress callback.
I suspect the issue is with some security update in windows XP which has updated urlmon.dll and wininet.dll. I think IE handles the new update but firefox has stopped working because of that. I may be wrong though. If anyone has faced a similar issue, please help me out.
Hasan Khan.
|
|
|
|
|
There are two interfaces IA and IB, but they reference each other in their method.
The problem is, if i declared IA before IB, IA would get a error because IB was unknown to it; if i declared IB before IA, IB would get the same error.
I know i can fix this problem by replacing the parameters from IAs and IBs to IUnkown. but i want to know if there is a resolution like C++'s classes pre-defining?
|
|
|
|
|
IDL has forward declaration of interface, just like C/C++ has forward declarations, viz:
import "oaidl.idl";
import "ocidl.idl";
[
uuid(D39DD965-FC96-4C0A-AA62-CA3F5F117685),
version(1.0),
helpstring("cccc 1.0 Type Library")
]
library ccccLib
{
interface ITest2;
[
object,
uuid(7CD26371-4A6B-4234-A024-6690A53CA450),
nonextensible,
helpstring("Itest Interface"),
pointer_default(unique)
]
interface Itest : IUnknown
{
HRESULT DoSomething([in] ITest2* c);
};
[
object,
uuid(72a5a7e2-0256-428f-8bb5-42d39096892d),
nonextensible,
helpstring("Itest Interface"),
pointer_default(unique)
]
interface ITest2 : IUnknown
{
HRESULT DoSomething([in]Itest* c);
};
importlib("stdole2.tlb");
[
uuid(F8AAE058-76E9-4F2C-995A-FB5B6565CED6),
helpstring("test Class")
]
coclass test
{
[default] interface Itest;
interface ITest2;
};
}; Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Thanks for your reply. I have tried this method but fail, because i always use the right idl files generated by atl project wizards, and i failed because i spelt 'Interface IB' other than 'interface IB'.(VS also highlights 'Interface' and 'interface'!).
Regards.
|
|
|
|
|
Hi,
Can I get any sample of how to write a COM component which should be accessible from JScript.
Actually , I am able to write a normal COM (InProc) component and able to invoke from other c++ client. But while trying the same from JScript , unable to invoke it.
I am getting error like automation server cannot create object etc.
Thx,
--Gopi
|
|
|
|
|
COM-component must be inherited from IDispatch
|
|
|
|
|
As mentioned by cariolihome only interface inherited from IDispatch can be access by scripting clients. Additionally, only the default interface marked in the IDL using the [default] attribute inside coclass can be accessed by scripting clients.
|
|
|
|
|
I have a class called CReportEditCtrl derived from CRichEditCtrl which allows me to programmatically insert an embedded object (OLE mini-server) into the document. This is based on code here:
A Rich Edit Control That Displays Bitmaps and Other OLE Objects[^]
Embedding is simple enough:
CComPtr<IRichEditOle> pIRichEditOle = GetIRichEditOle();
CLSID classId;
HRESULT hr = ::CLSIDFromProgID(L"EmbeddedLink.Document", &classId);
if (hr == S_OK)
{
// Get the OLE client site from the container
CComPtr<IOleClientSite> pIOleClientSite;
hr = pIRichEditOle->GetClientSite(&pIOleClientSite);
if (hr != S_OK)
{
return(false);
}
// Get storage from the container
CComPtr<IStorage> pIStorage;
hr = m_pIRichEditOleCallback->GetNewStorage(&pIStorage);
if (hr != S_OK)
{
return(false);
}
// Create an OLE object i.e. the embedded item
CComPtr<IOleObject> pIOleObject;
hr = ::OleCreate(
classId,
IID_IOleObject,
OLERENDER_DRAW,
NULL,
pIOleClientSite,
pIStorage,
(void**)&pIOleObject);
if (hr != S_OK)
{
return(false);
}
CDataObject *pDataObject = new CDataObject;
pDataObject->AddRef();
pDataObject->Populate(strText);
hr = pIOleObject->InitFromData(pDataObject, 0, 0);
pDataObject->Release();
if (hr != S_OK)
{
return(false);
}
REOBJECT reObject;
memset(&reObject, 0, sizeof(reObject));
reObject.cbStruct = sizeof(reObject);
reObject.cp = CharFromPos(point);
reObject.clsid = classId;
reObject.poleobj = pIOleObject;
reObject.polesite = pIOleClientSite;
reObject.pstg = pIStorage;
reObject.dvaspect = DVASPECT_CONTENT;
reObject.dwFlags = REO_INPLACEACTIVE|REO_DYNAMICSIZE;
hr = pIRichEditOle->InsertObject(&reObject);
m_arrayIOleObject.insert(m_arrayIOleObject.end(), pIOleObject.Detach());
}
When I stream out the RTF, it looks great, with embedded objects as expected. When I stream the RTF into a new object of the CReportEditCtrl class, the objects are displayed in the new control, but when I look at process explorer, the mini-server is not running. When I stream out the RTF, each embeddeded object has gone, and has been replaced by its metafile, allowing it to be drawn, but all knowledge of the object has gone. What it going on? It looks as if the CRichEditCtrl instance has not loaded the embedded obejcts when the RTF data was streamed in. I thought the CRichEditCtrl was supposed to handle loading RTF containing embedded objects?
Incidentally, I get the same result with only one CReportEditCtrl instance if I stream out the RTF, stream it back in, and then stream it out again. The embedded objects are lost.
Help appreciated.
|
|
|
|
|
Using the example program:
A Rich Edit Control That Displays Bitmaps and Other OLE Objects
I modified the code so that immediately after streaming data from the RTF file into the rich edit control, it streamed it out from the rich edit control into a second file. The output RTF file is not the same as the original. The embedded Windows Media File object is present in the output file. The other embedded objects are not present, and instead there is a metafile in place of each.
Anyone any idea why some objects streamed out into the RTF file are present only as metafiles?
[Added later]
Okay, I have solved the problem in this post, if not the main problem. The example code contains an RTF with 4 embedded objects including one GIF. Of the non GIF objects, only one corresponds to an OLE server that is registered on my PC. So it seems that if the rich edit control is fed objects for OLE servers which are not registered, it discard all but the metafile so they can be drawn, but nothing more.modified on Saturday, February 27, 2010 7:55 AM
|
|
|
|
|
Never mind. I found a far simpler solution was to represent a link as protected text, ensuring the user could not edit it, but could see the link as simple text. Unfortunately using OLE objects would have meant one application running per link, which is inefficient and, well not good.
|
|
|
|
|
Hi All.
I develope an addon based on MotleyFool; example. User must do login to that, for using its functionality. In IE 8 when adding new tab or opening new IE window, new login is need. This occures beacause new instance of this addon creates.
How I can share any instance between multiple tab or multiple IE win?
Excuse me for weakness of my language.
thanks a'lot.
|
|
|
|
|
use some global object or file mapping object (security issue set it to low) Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
You can use Mutex to check the instance of your addon. After the first time authentication save the status to authenticated in an INI file or in Registry. Check the mutex in each tab for get the status(Any instance is there) of your addon. If your addon is running then check the Authentication status. if authenticated from one of the tabs then login directly without user inputs.
I hope it will help you to over come the existing problem
Good Luck
|
|
|
|
|
How to manage global memory in com ??
|
|
|
|