|
There is a small technique to work around.
Dim o As Your.IntellisenseObject ' with loading of typelib infprmation => early binding
...
o.SomeProp = ...
...
Before making of EXE file, you may simply change the bold line with
Dim o As Object ' without loading of typelib => late binding
Or use the comment between these lines
Dim o As Your.IntellisenseObject
' Dim o As Object
and
' Dim o As Your.IntellisenseObject
Dim o As Object
With best wishes,
Vita
|
|
|
|
|
That won't actually work for what I want, as there won't actually be a .tlb file associated with the component.
But the idea is quite crafty
B.
|
|
|
|
|
Hi,
I just wanted to get peoples opinions on OO and COM, and how they approach developing components to be used in a distributed manner. Using COM for n-tier development typically involves some separation of action/abstraction logic and the data it works on, were pure OO involves keeping the action logic with the data. If you are designing a system that will use com+ components, do you consider OO or do you just think of it as passing around ADORecordsets/XML for example? Do objects even come into the picture?
Just interested on peoples experience.
Nick.
|
|
|
|
|
Can any one give some liks for learing COM.
I am a bigginer in for COM.
I have C++/VC++ Knowledge
Regards
Shirlie
|
|
|
|
|
|
I am currently trying to work with COM and make a container to hold a Word document. What is happening is that I create the frame window, then insert the Word document, and it does what it should, it brings up the doc, puts the Word toolbars and menus on the window, etc. But one thing it does that is strange is that it has several of the toolbar buttons disabled. The Open, New, and Save buttons are disabled. Also, the Print button is enabled but when I click on it, it doesn't do anything. Other buttons, such as the spell check work fine. Everything seems to work fine when using the menus. Does anyone know why these buttons are disabled? How to enable these buttons? Anything about this issue?
I looked through several articles, such as the Using MS Office in an MFC Application but that doesn't ever mention anything like this....
|
|
|
|
|
Have you checked the properties for the control. There might be property settings that will allow you to view the toolbars. If you are importing the Word DLL then look at the TLH file. There must be some property setting. I will look into it myself when I get the time and see if I can find something.
|
|
|
|
|
Hey everyone!
I'm working on an application that suppose to send a WAP configuration from a PC to a mobile via SMS, the mobile that i'm using to send the SMS is Nokia 6110. I'm using a specific SDK (SDK Nokia Connectivity) based on COM objects,I managed to send the SMS using the functions described in the SDK but i can't receive the SMS on the destination mobile.
If anyone has already used this SDK for sending SMS, plz reply to me
Bebe Harhour
|
|
|
|
|
Hi:
I know microsoft word support automation,I can use the fillow two method access word object:
#import .....
IApplicationPtr pApp;
(1)
// Start up existing word, if available
HRESULT hr = pApp.GetActiveObject(L"Word.Application");
(2)
// Start up fresh instance of word
HRESULT hr = pApp.CreateInstance("Word.Application", NULL,LSCTX_LOCAL_SERVER);
I wonder how to implement it in my application. I use Windows API RegisterActiveObject to register my application interface,but it can only use the first method to access my object.Can someone help me? Thanks!
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
For CreateInstance() to work, you need to register your class factory with a CoRegisterClassObject() call.
(RegisterActiveObject() is only for existing app instances).
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
|
|
|
|
|
Thanks very much!
BTW,if I want use build both method in my application,should I use both RegisterActiveObject and CoRegisterClassObject?
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
|
Thanks very much!!!
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Could someone post a link or explain the difference between Single Threaded Apartment and Multi Threaded Apartment? Is the use of one or the other determined by whether the application makes use of any multi threading? Does it make sense that calls to OleInit made on some threads use STA as the mode, but other calls on other threads use MTA.
Thanks for any insights.
Chris Meech
|
|
|
|
|
|
|
Thanks for the link. Jeff's work is always so good.
Chris
|
|
|
|
|
have a COM dll and I am using the libs from Office 2000. When the user hits a button, I open Word. When I open word, sometimes there is text that the user wants to edit so I put the text in a file, then put this filename in the CreateProcess function call so that Word will open this file. But I am having on irritating issue. Every time I do this with Office 2000, I keep getting the messagebox "Do you want to revert to the saved document" right when Word opens. I have tried several things and nothing seems to work so that this message box doesn't appear and Word just goes ahead and opens the file like I want it to. Does anyone have any idea how I can stop this messagebox, do you think there is something wrong with the way I am opening Word, or perhaps is there something wrong with the way I am saving the word document??????
|
|
|
|
|
Hy everybody, Please help me with an ideea. The problem is simple, but the solution...
In fact, i need to have only one permanent instance of an ATL COM+ object (or more but only persistent public data members), and 3 or more clients who must connect at this COM object to get and put data. The clients are C++ who connect with CreateInstance and ASP who use CreateObject.
The problem is at each new CreateInstance of a new client, in COM+ appear a new instance of my COM+ object, even i use DECLARE_CLASSFACTORY_SINGLETON.
Even if i use the both threading model, in any apartments, the public data look to be the same only to C++ clients, a new ASP instance will create a new object with new different public memebers !!!
Adrian Bacaianu
|
|
|
|
|
sounds like a security problem : every single instance per launching user and winstation : check out DCOMCNFG
|
|
|
|
|
It looks like you want a system-wide singleton (accross process boundaries). You would indeed get funny results with this approach:
- different processes (in your example: IIS and the C++-application) instanciating your component would get a singleton *per process*.
- any static data you maintain dies when your dll goes out of memory: this happens if all interfaces are released: DLLCanUnload is called on a regular basis, and when it returns true (default ATL-implementation: when all reference counts are zero), the dll is unloaded.
You can solve this problem by leaving the COM-singleton for what it is,
designing your component as a multiply instantiatable component
and using either static data in a persistent, out-of-process server (take a look at ATL-service) or simply persist your data in a database.
|
|
|
|
|
Hello,
I'm writing a browser helper object (BHO). It seems that I cannot do this :
<br />
IGlobalInterfaceTable *g_pGIT = NULL;<br />
<br />
void CALLBACK TimerProc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)<br />
{<br />
HRESULT hr;<br />
IDOMPeek* pIDOMPeek = NULL;<br />
hr = g_pGIT->GetInterfaceFromGlobal( <br />
dwUser, <br />
IID_IDOMPeek, <br />
(void**)&pIDOMPeek);<br />
<br />
I get hr == 0x800401f0
Why and how should i do it ?
Does I have to use ITimer, ITimerService, ... But i cannot find samples how to use that.
Thanks.
|
|
|
|
|
Oops, i forgot to call:
CoInitializeEx(0, COINIT_APARTMENTTHREADED);
Next time i'll read the docs more deeply.
|
|
|
|
|
Hi,
I have been trying to get a result here for a couple of days and am now loosing hair at a rate which I am unable to sustain any longer
I have been experimenting with the VC demo ATLDRAW which includes a ATL DCOM server an ATL DCOM client and an ATL DOM Client as an ActiveX control.
I am trying to reduce the required Authorization such that someone can use it who is not a member of the same domain, so long as they have a login name and password on the client which matches the server. (I have seen this done with Windows Media Services remote management).
All is fine with the normal Client as I can use -
<br />
CoInitializeSecurity(NULL, -1, NULL, NULL,RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IDENTIFY, NULL, EOAC_NONE, NULL);<br />
However in the ActiveX control you can not call CoInitializeSecurity as you are too late. I have tried using CoSetProxyBlanket on m_pDrawServ but it has no effect. I have found some stuff at -
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/1198/security/security1198.htm&nav=/msj/1198/newnav.htm[^]
Which says I need to call CoSetProxyBlanket on my interfaces but I don't see how to do it.
Has anyone ever managed to reduce the Authorization Level in a DCOM ATL ActiveX control and if so how.
Cheers
|
|
|
|
|
I am having some trouble with something that is probably very simple. I have a COM project (exe) and it does not use any ATL. It is fairly simple, a dialog box opens with 2 buttons, the first is to run MS Word. When pressed, word opens up and the user can enter some text. After a lot of research and trial-and-error, I was able to put a button on the Word toolbar. But I do not know how to know when the button has been pressed. This is my class:
/*----------------------------------------------------------------------------*/
const IID IID_IWordAppEventSink = __uuidof(Word::ApplicationEvents);
const IID IID_IWordDocEventSink = __uuidof(Word::DocumentEvents);
const IID IID_ISpecialSaveExit = __uuidof(Office::CommandBarButton);
/*----------------------------------------------------------------------------*/
class CWordEventSink : public CCmdTarget
{
DECLARE_DYNCREATE(CWordEventSink)
public:
CWordEventSink();
virtual ~CWordEventSink();
BOOL Advise(IUnknown* pSource, REFIID iid);
BOOL Unadvise(REFIID iid);
void SetLauncher(CTestDlg* pWordLauncher);
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWordEventSink)
public:
virtual void OnFinalRelease();
//}}AFX_VIRTUAL
protected:
// Generated message map functions
//{{AFX_MSG(CWordEventSink)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated OLE dispatch map functions
//{{AFX_DISPATCH(CWordEventSink)
afx_msg void OnAppStartup();
afx_msg void OnAppQuit();
afx_msg void OnAppDocumentChange();
afx_msg void OnDocNew();
afx_msg void OnDocOpen();
afx_msg void OnDocClose();
afx_msg void PSISaveAndExit();
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
private:
CConnectionAdvisor m_AppEventsAdvisor;
CConnectionAdvisor m_DocEventsAdvisor;
CConnectionAdvisor m_BarEventsAdvisor;
CTestDlg* m_pWordLauncher;
};
I kind of cheated by using an example article written by Christian Staffe called Automating and Eventing in Word. But it never mentioned what to do to capture when the button has been pressed. Does anyone have any thoughts or suggestions? Examples would be great to, I am still trying to learn all this COM stuff..........
|
|
|
|