|
Spot the keyword enum . This is an enumerated type. IDL follows the C syntax - enum s live in a separate namespace from the standard types, so you must use enum foo rather than just foo when using them. To work around this, virtually every enum you'll ever see is put in a typedef declaration to create a type name in the global type namespace. A Microsoft extension to C allows the name of the enum itself to be omitted if you do the typedef in the same declaration as the enum itself, and again this has carried over to IDL.
The [uuid] and [version] attributes are attached to the enum declaration, not the typedef itself. Enumerated types must have GUIDs the same as everything else. You can modify an enumeration without changing the GUID as long as you only add new values; you cannot delete existing ones or renumber them.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi mike,
i got it... i guess this is what i understood of this before i put up a post... but then why does the compiler give me an error saying that i need to add a type specifier before the datatype? can you suggest any changes in the idl file...
thanks
nikhil
|
|
|
|
|
|
Hi,
I am developing the COM addin for outlook 2000 with Windows XP OS.
I am facing the problems while adding the picture on the button of the toolbar. as I have added the picture on outlook 2003 sucessfully but the API put_Picture i have used in OL2003 is not working with OL2000..
Is there any way to do same??
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Try using
tempButton->Style=Office::msoButtonIconAndCaption;
tempButton->Caption="Hello";
tempButton->FaceId=67;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks man,
I have the idea about it... but this work only for the faceid's provided by Outlook itself..
I want to add custom face to the button using the picture and mask i created.
Thanks for instant reply.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi use this one:
void SetBitmap(CComQIPtr<office::_commandbarbutton>tempButton,const int& imageId)
{
CComQIPtr < Office::_CommandBarButton> spButton(tempButton);
ATLASSERT(spButton);
bool transparence;
HBITMAP hBmp =(HBITMAP)::LoadImage(_Module.GetResourceInstance(),
MAKEINTRESOURCE(imageId),IMAGE_BITMAP,0,0,NULL);
// put bitmap into Clipboard
::OpenClipboard(NULL);
::EmptyClipboard();
::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
::CloseClipboard();
::DeleteObject(hBmp);
// set style before setting bitmap
spButton->PutStyle(Office::msoButtonIconAndCaption);
HRESULT hr = spButton->PasteFace();
spButton->PutVisible(VARIANT_TRUE);
}
jhala ki sang aplyakade sagle ahe
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Thanks you yaar.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hello everybody,
I have registered some ActiveX controls on my machine (bought a SDK from a customer which works fine in their HTML web-test-page).
I have created a Visual Studio C++ new ActiveX server like this :
File / New / New ATLCOM AppWizard
Insert / New ATL object / Single object / Single threading model
Now I have my own ActiveX Server, everything's great, compiling and all.
===> BUT in this/my ActiveX I would like to add "the" ActiveX from my customer sold me (name IQViewX class)
I open :
Project / Add to project / Components and controls / Registered ActiveX Controls
but I don't see anything !
Whereas in the "OLE-COM object Viewer" I can see the QViewX class !
How can I add everything I need into my project ?
Thanks alot,
ptiJean
|
|
|
|
|
Hi,
As far as i Know the ActiveX control that you have bought from your customer is a liscensed ActiveX control, means that you can't use this control in your applications.
Only those persons who have .lic file of this control can use the control in their applications.
since you might not have .lic file so you can only see this control in your customer's built application and you can't built an application, making use of the control.
I guess this answers you
Muhammad Azam
|
|
|
|
|
Hello,
I'm trying to use a Dll file in form of COM.
The dll file is of a commercial application and doesn't have the .tlb file.
I tried to use #import directive in order to use 'smart pointers'.
the compiler throws many errors regarding incorrect syntax in .tlh and .tli files....
Alough it reads in MSDN that #import directive can take .dll files...
has anybody got an idea?
|
|
|
|
|
|
#import can take .DLL if it follows COM and has a TLB within its Resource.
On MSDN, check for the attributes to be used along with #import
S o h a i l K a d i w a l a
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Thanks guys!
The MSDN doesn't note that, nor Dr. Gui....
anyway I don't have any documentation regarding the DLL, so I decided to leave it for now, till I get some information about it...
|
|
|
|
|
Hi,
I wrote a class that is using A COM object. I'm also using the COM interface method which is sending the data to COM object and work with them. The problem is that I run the loop which sends the data all the time. To avoid crushing application Form(I think that this infinite loop blocks message loop) i run the loop in thread. But then I get exception "Unable to cast COM object of type 'System.__ComObject' to interface type..." Can you give me any advice what can I do whith it?
|
|
|
|
|
You need a marshaller for your COM object - the COM runtime needs to be able to take the parameters for your call and move them to another thread, call the object, then move the return values back to the calling thread.
Firstly, check what sort of object it is. In the registry, under the object's CLSID key, under InprocServer32, you'll see a ThreadingModel value. If this value isn't present at all, the object is single-threaded - calls to it will always run on the first thread in your application, regardless of the thread on which you create the object. If it's 'Apartment', calls to the object will always run on the thread that created it. If it's 'Free', calls to the object will run on the same thread as the caller. If it's 'Both', the behaviour depends on the creating thread: if the creating thread is in a Single Threaded Apartment [STA], it behaves like 'Apartment', but if it's in the Multi-Threaded Apartment [MTA], it behaves like 'Free'.
You can control which apartment each thread lives in. By default in .NET all threads are in the MTA, unless the [STAThread] attribute is used on the thread's start method to force it into the STA. This is done by the WinForms project types on the Main function to make the initial thread an STA thread, for compatibility with ActiveX controls, which must be either not marked or marked 'Apartment'.
IIRC, you still need a marshaller with 'Free' model classes if the creating thread is an STA thread. This marshaller ensures that any events that the class raises (or any other callbacks it makes) come back to the creating thread.
Ideally you probably want to avoid marshalling. If you only want to access the object from a worker thread, create it as needed. Don't create it on the UI thread and keep it around. In fact, if you do create it on the UI thread and it's an Apartment model class, the calls will get marshalled back to the UI thread anyway and still block the UI.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thank you for help.
I'm still working on it.
Now I use [MTAThread] before main and everything works fine.
|
|
|
|
|
Hi,
Ok, this question may sound strange to you all, but here goes. I have an In Proc COM Server with ConnectionPoints implemented, created using ATL. Now, this COM Server must display a Window. Since the Window has a message loop of its own, I am creating the Window in a different thread. The Window has been created using WTL 7.1. There should be communication between the main COM thread and the window thread such that the COM Server can call the Window's functions and the Window should be able to call the COM Server in case of events so that the parent application can be notified through Connections points.
Can someone guide me as to how to achieve the above scenario which I have explained? The communication between the threads is killing me.
I haven't tried running the DLL in a Separate Process using DLL Surrogates because frankly, I haven't looked at them and more importantly, I do not have the time.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
|
|
|
|
|
OK, why can't your window run as a modeless window on the caller's thread? Why do you need your own message loop? Can you not use the caller's message loop, or is your caller a worker thread in the calling application?
If you really must run your window on a separate thread, I'd use window messages to send commands from the COM object to the window using SendMessage or PostMessage (depending on whether the COM object needs a reply before returning - generally I'd go with PostMessage). The other direction is more tricky - you really have to get COM to do the marshalling for you. What you'd need to do is get hold of the interface pointers registered with the connection point and marshal them across to the window's thread, then use the unmarshalled pointers to actually fire the events from the window. The simplest way is probably to use the Global Interface Table - see Creating the Global Interface Table[^] in MSDN. You'll need to modify the auto-generated FireXxx functions.
If for some reason you want to do the marshalling yourself, see the CoMarshalInterThreadInterfaceInStream and CoGetInterfaceAndReleaseStream APIs.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thank You for your answer.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
|
|
|
|
|
Hi, I have a COM object written in C++ that contains a method that must modify a variable passed to it via ASP. In my C++ come method, I delcare the variable as type VARIANT*. This ideas works ok in C# and VB but fails in ASP. Is there a special way that you have to set up a variable in ASP to pass it to a COM object method for modification. In VB you must pass it by ref, but I am not sure what happens in ASP. The ASP error suggests that there is a type mismatch on the variable I am passing to my COM Object method. This is a bit confusing.. Can anyone help me sort this out?
I really appreciate it.
Thanks
Dave
|
|
|
|
|
Hi,
I am new to ATL and COM, i am learning the ATL COM and doing
doing some example programs using the articles give in codeproject.
When i was executing the Example program, just i kept the
breakpoint at DllMain function, to know when it is getting
called. When i registered using regsvr32, this is not being hit
and even when i added in the reference of the VB client or when using the
property of the DLL, it is not being called.
It will be helpful to know whenit will get called or link or artcile
link will be useful.
thanks in advance for the Help
Kumar
Kumar
|
|
|
|
|
You have to run an executable in the debugger for a breakpoint to be hit (unless it's a hardcoded breakpoint, an __asm int 3 in the code). If you're making a DLL then it is loaded into the "host" process: either the process instantiating the COM object or, when it's being registered, regsvr32 . If you want to debug the DLL registration process you have to debug regsvr32 . The project settings/debug section can help you here.
Steve
|
|
|
|
|
Hi Steve,
Thanks a lot. It works.. It did not strike me before...
-Gilly
|
|
|
|
|
Hello friends,
in web page www.adwords.com there is IFrame.
i want to get controls/elements of this IFrame.
How can i do that.
i written code::::
here g_lpHTMLDocument2 is IHTMLDocument2 pointer .
It contains valid document pointer.
IHTMLFramesCollection2Ptr pFrameColl;
hr = g_lpHTMLDocument2->get_frames(&pFrameColl);
if(SUCCEEDED(hr))
{
IDispatch *pDisp = NULL;
long lFrames = 0;
pFrameColl->get_length(&lFrames);
for ( long i = 0; i < lFrames ; i++ )
{
VARIANT varIndex, varDispatch;
VariantInit(&varIndex);
VariantInit(&varDispatch);
varIndex.vt = VT_I4;
varIndex.lVal = i;
if(SUCCEEDED(pFrameColl->item(&varIndex, &varDispatch)))
{
if(varDispatch.vt == VT_DISPATCH)
{
CComPtr <ihtmlwindow2> pHTMLWnd2;
if(SUCCEEDED(hr = varDispatch.pdispVal->QueryInterface(IID_IHTMLWindow2,(LPVOID*)&pHTMLWnd2)))
{
IHTMLDocument2Ptr pHTMLDoc2;
hr = pHTMLWnd2->get_document(&pHTMLDoc2);
//HERE I M GETTING NULL PONTER ,ERROR IS ACCESS DENIED
IHTMLElementCollection* pElementColl = NULL;
pHTMLDoc2->get_all(&pElementColl);
}
pHTMLDoc2 DOES NOT CONTAIN VALID ADDRESS.
Can someone help
Harry
|
|
|
|