|
WHat is the exact difference between Win32 DLL and ATL DLL,
u can paste the gooooogled ans..or whatsoever..I have been asked this question at two places..
|
|
|
|
|
Win32Dll or ATL dll, both are dlls and same w.r.t the windows OS, The only difference lies how they are used..
To be short.. ATL dlls or COM dlls export certain apis like
DllMain
DllRegister
DllUnregister
DllCanunloadnow
etc
This apis helps to create a COM object from the dll.
P.R.A.K.A.S.H
|
|
|
|
|
Hi all,
I'm trying to make an activeX control that can be embedded in an HTML page to upload (multiple) files. (similar to JUpload -www.jupload.biz-, but then not a Java applet, similar to XUpload -www.aspupload.com-, but then without an ASP server component).
The language of the COM object is not important.
I've been searching the web for some starters but found little.
Does anybody have some interesting links for me? Ideally, some sample open source code.
TIA,
Corno
|
|
|
|
|
Hi All,
I have a VB ocx which contains 3 objects/classes. I imported them into VC6 with no problems.
In the code I need to tell the objects about each other. It goes something like this...
CMyObject1 myOb1;
CMyObject2 myOb2;
CMyObject3 myOb3;
myOb1.SetRefOb2(myOb2.m_lpDispatch);
myOb1.SetRefOb3(myOb3.m_lpDispatch);
When I run this I get a VB message box saying the object is no longer set! Also I get an OLE error in my debug output saying there is a NULL lpDispatch.
I attempted this...
HRESULT hr = CoInitialize(NULL);
CLSID clsid;
hr = CLSIDFromProgID(L"clsid.myOb2", &clsid);
myOb2.CreateDispatch(clsid);
qb.SetRefDiagramPane(&myOb2.m_lpDispatch);
CoUninitialize();
This seems to work ok but my application seriously crashes when it quits if I do this.
Any ideas how I am supposed to call these SetRef(LPDISPATCH *) functions?
Thanks,
Chris
|
|
|
|
|
i am developing an activeX control which displays a print preview.The print preview style depends on user input.The styles are controlled by print preview template files which reside on the web server.
i am using the following code:
CComPtr<iolecontainer> spContainer;
CComPtr<iserviceprovider> spSP;
CComPtr<iwebbrowser2> spWB;
CComPtr<idispatch> spDisp;
CComPtr<ihtmldocument2> spDoc;
CComPtr<iolecommandtarget> spCT;
CComVariant vPTPath = "res://BrochureMachine.dll/PT.htm";
m_spClientSite->GetContainer(&spContainer);
spContainer->QueryInterface(IID_IServiceProvider, (void**)&spSP);
spSP->QueryService(SID_SWebBrowserApp, IID_IWebBrowser, (void**)&spWB);
spWB->get_Document(&spDisp);
spDisp->QueryInterface(IID_IHTMLDocument2, (void**)&spDoc);
spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&spCT);
spCT->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, NULL, &vPTPath, NULL);
return S_OK;
this compiles fine but when i execute it i get a blank print teplate file.But when the file url is used everthing goes fine.
Waiting for your valuable help
regards
jithus
|
|
|
|
|
m_spClientSite cau u tell me how to define this"m_spClientSite"?
3ks,best regards!
|
|
|
|
|
I have a VC++ COM Component that has an interface with OUT Values as Safearray of long as well as safearray of double.
I need to pass these to the C# which interprets it as a Ssytem.Array. I am running into issues with the same.
Could I pls request for a sample application that has a VC++ returning arrays of long as well as double and the C# being able to access the details..
Thanx
Sheela
|
|
|
|
|
Hi!
I call CreateDispatch on COleDispatchDriver and it's very slow. I think that's because i call a .Net COM object. Is it true? Can i make it faster somehow?
dzsigit
|
|
|
|
|
When you load a .NET control, the CLR has to be loaded and the managed AppDomain created. There is some overhead that you can't avoid. Other than that - optimize your code in the .NET control's initialization methods.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I know this is possible, but can't for the life of me figure it out... How the heck do you get a list of the events, properties and methods implimented in an object, especially you didn't design it and may not have any documentation on how it works?
I don't see any obvious way to do this, but I know some programs do, especially the compilers themselves, when dealing with a COM object not listed in its own list of known objects.
|
|
|
|
|
Since you are dealing with COM, and not .NET, you will only be able to discover a limited amount of information about your mystery COM object. Assuming that you have no source code, you will have to deal with some form of a type library. Chances are that the type library is stored as a resource in the same binary (i.e., dll) as the mystery object. Only OLE Automation compatible things can be be described in a type library, so if the interfaces use custom interfaces or user defined data types, you are left a little more in the dark.
Do you know the names of all of the objects and interfaces that this COM server serves up?
Have you registered it?
Whether you have VS6 or VS.NET, there exists a tool called OLEVIEW.EXE whcih can decipher the contents of the registry and type library information on a registered COM Server. Just Start OLE View, and expand the "All Objects" category. You ought to be able to find your object in there.
If you don't know the names of things that are served up by your mystery object, you can search the registry for the filename to discover CLSIDs and ProgIDs that you can use to search Ole View.
Good Luck, but you are likely to be disappointed by the limited amount of information that you will find.
|
|
|
|
|
Hmm.. What I am trying to do is build my own version of a form designer. Do to some of the information I need to output for the form, due to its own interfaces, I need to export a form description that that contains more than a basic list of buttons and stuff. This pretty much makes any existing form designer worthless, even if I could legally include and execute it from inside my own project. While I could limit the user to known objects for which I already have the code to handle its events, set its properties or call its methods, what I really need is something that will let me do this in a true dynamic manner, so the user can opt to use controls unknown to me. I know this will only work with OLE Automation, but that is exactly the class of controls I am attempting to use.
As for OLEVIEW.EXE, this was coded in C++, so I know the there has to be some bloody way to duplicate what it does. I am not sure of either the practicality or legality of including that with my own project and I suspect it doesn't employ COM, so using it as an intermediary to select an object and read in the information I need wouldn't work anyway. I would prefer something invisible to the use, like the Components... menu in VB, where all you do is add a reference to the object and the designer handles the task of figuring out what properties, functions and events it needs to deal with when the user reloads the form file.
Basically, the project is intended to be a user definable window accessed through COM, into which they can load a form layout with their controls. The form is called from a script using the createobject method in someone elses client. To make matter more fun, do to the same stupid lack of documentation on how IE, form designers, OLEVIEW or anything else handles true dynamic object creation, where the interface *can't* be known before hand, it doesn't support a method to use such objects itself.
Nor can my using the IE core WebBrowser control do me any good. While it does provide a way to instance such controls, it does so as HTML imbedded controls that are only really accessably to its *own* scripts. I need to redirect those effects to the clients internal callbacks for it to work, since one nasty side effect of createobject is that you can't use events from the control to drive the script. I think there may be a way to drive such events from the client by linking the instance to an internal list and having it use a user defined name and the event name to redirect a call to the script (the designer of the client already does this for a few special callback where the user specifies the name to call), but this still doesn't actually solve my problem.
All in all, MS' concept of only documenting stuff they *think* we need to know about doesn't make me terribly happy... Especially when half the time the stuff they do document is scattered, confusing and incomplete.
Believe me, I am already "disappointed in the limited amount of information", from just trying to find the code to change the AmbientUserMode property. I spent 4-5 days on hunting that down before I found even a 'hint' about its use. But the general incomprehensible lack of documentation does explain why they give you an example in VB of using vbcontrolextender to capture unknown events, but somehow fail to give you a clue about how to find out what the damn things you are traping actually are... :p I wonder, are such events like small fish and animals that get caught in fishing nets? They aren't anything you can identify, so you can look at them if you like, but all you can really do with them is throw them back? lol
Seems the REFIID for a interface contains a long, two shorts and a 8 character string, so no joy there.. I had hoped it was something more useful like a simple index into the interface. So there went that idea... Sigh...
Anyway.. Thanks for trying to help.
|
|
|
|
|
Hmm.. A bit incomplete, since it doesn't provide me with any idea how to use any of the stuff retrieved, but:
http://www.geocities.com/cool_ranju/tlibs.html
I knew there had to be a way... lol Seems it helps when you look for the right search terms.
Just need to figure out which if any of these things the library lists are events and which are properties, as well as how to load and use the DLLs. Since I am actually coding the main program in VB and using C++ to impliment the stuff MS didn't think I needed to have as a DLL, this should be really fun...
And yeah, I could code it all in C++, but I figure the odds of my screwing up the code in a few classes in a DLL is a lot less than my odds of mesing up and entire program, I am an absolute newbie at C++.
|
|
|
|
|
Hello.
I've got a problem. I use automation in my custom COM object(which is created using JavaScript on a page) to open MS Project from a secured zone on a web site. Assuming user has logged on, using FileOpen method of Application object leads to another prompt for user to log in.
Here's the code snippet off my COM:
......................
CComDispatchDriver app;
app.CoCreateInstance(L"MSProject.Application);
CComVariant arg1 = FileName; //URL of the MS Project file passed from
//JavaScript to my COM; BSTR
CComVariant arg2 = VARIANT_TRUE; // Read-only mode.
app.Invoke2(L"FileOpen", &arg1, &arg2);
.......................................
That worked fine except for the need to login for the second time upon my COM trying to open file. After second authorization COM proceeded with its job.
First solution was to use URLDounloadToFile() function to download the file to the temporary local directory and then give it to the FileOpen. That worked perfectly, no need to authorize again, BUT
it's considered as a potential SECURITY HOLE.
So the second solution is to try to use URLOpenBlokingStream to actually open the stream of my URL and then somehow give it to the MS Project.
But I don't have an idea how to give IStream to the MS Project to open it.
Any suggestions would be highly appreciated
|
|
|
|
|
Hello everyone.
I want to hook file operation to move, copy, delete, or rename a file.
I found ICopyHook interface, But it was only possible hooking folder operation.
Isn't there any good method?
with regards,
kona
|
|
|
|
|
"the vaue of ESP was not properly saved across a function call" got this error Dialog while compiling an empty MFC client, with a ATL control added to the UI. the ATL control is empty too, no implementations at all.
help?
|
|
|
|
|
Recompile the component and the client this should work, mostly it is due to incorrect parameter passing from the client.
Still Alive!!!
Thank you God.
|
|
|
|
|
thank you for the suggestion but it din't work. is there a bug in VC++ with regards to importing a ATL Control into MFC client? i have no methods in the ATL control yet hence there can't paraemeter passing involved cept for those that are carried out in the background..
|
|
|
|
|
The error you describe typically occurs when there is a calling convention clash between caller and callee. For instance, class member functions are typically _thiscall, while other C++ functions are __stdcall, and C functions are _cdecl.
Some routines, particularly callbacks should be __stdcall, but occasionally, you'll see something like qsort, which requires that the ordering function you give it be __cdecl.
Are you overriding the default calling convention of any of your functions?
The other alternative, of course, is that you're overwriting the stack (in a subtle way, generally). If you know the function call, you can put a breakpoint on entry, then display the call stack, and step through the function until you see the call stack get hosed...
Steve S
|
|
|
|
|
apparently the problem is with the compiling computer. it works fine in other computers. i tried installing MS SDK, VC++ SP5, clearing up the registry... and nothing works.. haha.. will be installing a new copy of VC++ today.. thanks for all the help guys. BUnch of great ppl we have here!!!
|
|
|
|
|
Hi all,
I want to find an utility that do something like that:
Takes TLB (or whatever) and generates C++ wrapper classes for use these COM interfaces/objects. With ATL it could looking like:
IDL:
interface ITest
{
HRESULT GetName([out,retval] BSTR *bstrName);
HRESULT DoSmth([in] BSTR str);
}
C++ (ATL) Wrapper:
class CTest : public CComPtr<ITest>
{
public:
CString getName()
{
CComBSTR bstr;
HRESULT hr = p->GetName(&bstr);
if (FAILED(hr))
throw hr;
return CString(bstr);
}
HRESULT doSmth(LPCTSTR str)
{
return p->DoSmth(CComBSTR(str));
}
}
Such wrappers allows to program COM in C++ much easier, almost like in VB, at the same time preserving all C++ power.
Does anyone knows something similar ?
Thanks in advance,
vips
|
|
|
|
|
The #import directive already does this for you automatically.
|
|
|
|
|
Thank you for fast reply.
I'll try to discover the #import behavoir in C++.
|
|
|
|
|
you can also use MIDL <file.idl> /h file.h
to get an IDL file you can use oleview
|
|
|
|
|
Hi Guys,
Can somebody tell me whether COM objects are stateless or stateful ?
AS far as i understand, State of an object is defined by the data member it contains and COM objects can have data members.
BIG_MG
|
|
|
|
|