|
Sorry I doesn't have source code of the dll.
|
|
|
|
|
What happens when the reference count of an object reaches 0 is a decision for the objects implementers to make. Lets assume the COM object is written in C++. Most objects will delete themselves when the reference count reaches zero. This is not mandatory however; A singleton will not delete itself when the reference count reaches 0, for example. In general it's an implementation detail which you shouldn't be concerned about. As a client you just follow the rules:
- Call AddRef when you copy an interface pointer.
- Call Release when an interface pointer goes out of scope.
- Don't use an interface pointer after you've called Release on it.
Steve
|
|
|
|
|
|
Can anyone tell me how do I add a .Net FCL Control to my C# project.
The problem that I am getting is that I have made a control in C# by selecting the project type as "Windows Control Library", In this project I am using just a Listbox and I have not made this project as a Component.
Then I make another C# project and on its toolbar I select "Choose Item" by right clicking my mouse button. On that I see a window which shows a list of .Net Framework Class Library Components and COM components, but since my project is not a Component I don't see my control in that list.
After that I tried adding the dll of my control in the references folder of my Client project, I was able to add that dll as a reference but the problem is that since my control is a visible control, I would like to see the Listbox which this control contains, whenever I use the control in my project.
I want my Control to appear on the tolbox of my client project, I was unable to do that?I was able to implement a class as a component, and use it as a control in my client, this worked perfectly fine and I saw my Class control on the toolbox of my C# client after I selected Choose
Item on the toolbox.
Please let me know what should I do regarding this issue?
|
|
|
|
|
|
Can anyone tell me how to create a Visible .Net Control and add it to a C# form?
|
|
|
|
|
Hi
Im dyeing here!!!!!!
I have writen a COM addin for word and excel in .net.
Everything was fine until the customer started installing my addin in their systems.
Eventually i understood that the problem is that im not the only fish in the sea.
Other addins, such as Acrobat Maker and others, prevent my addin to load.
I went to MSDN in search for answers, and, as usual i returned with more questions.
PLEASE !!! SOMEONE !!! i realy a good (working and understandeable - not like http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_comshim.asp ) tutorial to guide me in the horrable jurney of applying a shim to my Office Addin.
10x
Alex
|
|
|
|
|
Hi
iam trying to create a derived class of Win32_Process class using the following code .
but when iam trying to access that derived class in my query iam gettting error . can u please help me regarding this and tell me where iam doing wrong
IWbemClassObject *pNewDerivedClass = 0;
IWbemClassObject *pExampleClass = 0;
IWbemContext *pCtx = 0;
IWbemCallResult *pResult = 0;
BSTR PathToClass = SysAllocString(L"Win32_Process");
//The pSv variable is of type IWbemServices *
HRESULT hRes = pSvc->GetObject(PathToClass, 0, pCtx,
&pExampleClass, &pResult);
SysFreeString(PathToClass);
if (hRes != 0)
return;
pExampleClass->SpawnDerivedClass(0, &pNewDerivedClass);
pExampleClass->Release();
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = SysAllocString(L"Win32_DerivedProcess");
BSTR Class = SysAllocString(L"__CLASS");
pNewDerivedClass->Put(Class, 0, &v, 0);
SysFreeString(Class);
VariantClear(&v);
BSTR OtherProp = SysAllocString(L"OtherInfo2");
pNewDerivedClass->Put(OtherProp, 0, NULL, CIM_STRING);
SysFreeString(OtherProp);
hRes = pSvc->PutClass(pNewDerivedClass, 0, pCtx, &pResult);
pNewDerivedClass->Release();
Query to access Derived class
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_DerivedProcess"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
Thanks in Advance
abhi
|
|
|
|
|
Hi,
Does anyone know if it's possible to host an activeX control in a GUI-less console application, the control in question has no GUI itself (much like the WinInet activex control) and provides serial communication services (in the same way the WinInet provides socket services)
Thanks.
Phil Harding. myBlog [^] | mySite [^]
|
|
|
|
|
My bets are on that you'd have to have a message loop somewhere. Perhaps it would be easiest to just kick off a separate thread, which creates a modeless dialog window containing the ActiveX control. Depending on the control, you may have to marshal the interface pointer, in order to use in the main thread.
I think such a solution would have the least impact on your existing console code. You should also add ATL support to your code, which can manage the message loops and COM/ActiveX stuff for you. Regarding how to do that, create an ATL exe-server, and take a look at the module initialization. You may have to tweak it a little, since the wizard generated code assumes that you start in WinMain().
|
|
|
|
|
I want to add a my own shortcut item to the outlook shortcuts with VC,but I don't how to do this ,someone can help me! Thanks in advance!
|
|
|
|
|
I have created teh addin for Outlook 2003 and this is the sample code for . It may contain code which is not required
CComPtr<outlook::_application>olApp;
CComPtr<outlook::_explorer> spExplorer;
CComPtr<outlook::panes> panes;
IDispatch *scBarItem;
scBarItem=NULL;
//assign with application handle
olApp=m_Application;
olApp->ActiveExplorer(&spExplorer);
spExplorer->get_Panes(&panes);
panes->Item(CComVariant("OutlookBar"),&scBarItem);
if (scBarItem==NULL)
return S_OK;
CComQIPtr<outlook::_outlookbarpane>olBarPane(scBarItem);
CComQIPtr<outlook::outlookbarstorage>olbar;
CComPtr<outlook::_outlookbargroups>groups,groups1,groups2;
CComPtr<outlook::outlookbargroup>group,Item,todaysWorkBtn,othergroup;
CComPtr<outlook::_outlookbarshortcuts>shortcuts;
CComPtr<outlook::outlookbarshortcut>shortcut;
CComPtr<outlook::mapifolder>MFolder;
// CComPtr<outlook::_namespace>session;
olBarPane->put_Visible(true);
BSTR grName,todayName, otherName; //long count;
olBarPane->get_Contents(&olbar);
wchar_t Name[]=L"Test";
grName=SysAllocString(Name);
olbar->get_Groups(&groups);
//group=NULL;
long n;
groups->get_Count(&n);
BSTR temp1;
HRESULT hr123;
//for(int m=1;m<=n;m++){
hr123=groups->Item(CComVariant(1),&group);
if(hr123 == S_OK && group)
hr123= group->get_Name(&temp1);
//}
HRESULT hr=groups->Item(CComVariant(L"Test"),&group);
if(group==NULL)
{
CComQIPtr<outlook::_namespace> mysession;
CComPtr<outlook::mapifolder> InboxFolder;
BSTR sName;
CComPtr<outlook::_folders> Folders;
CComPtr<outlook::_folders> spFolders;
CComPtr<outlook::mapifolderptr> spNewFolder;
groups->Add( grName,CComVariant(1),&group);
group->get_Shortcuts(&shortcuts);
m_Application->ActiveExplorer(&m_Explorer);
m_Explorer->get_Session(&mysession);
mysession->GetDefaultFolder(olFolderInbox,&InboxFolder);
sName=_com_util::ConvertStringToBSTR("Inbox");
shortcuts->Add(CComVariant(InboxFolder),sName,CComVariant(1),&shortcut);
}
Cheers
"Peace of mind through Technology"
|
|
|
|
|
can anyone tell me how do I resolve this error? I get this error when I include FileName_i.c file in my managed C++ client. The complete error is:
cl : Command line error D8045 : cannot compile C file '..\Trial\Trial_i.c' with the /clr option
I also tried switching off the /clr option and used "No Common Language Runtime Support" option, but on that there comes a huge list of errors because I am writing managed code (i.e. Forms etc.), can anyone tell me how do I build my Client which includes the above filename.
|
|
|
|
|
I think you cannot compile the XXXX_i.c file.
I am not sure about Managed C++, but in native code, it must not be compiled that way. It can be #include d, or the pre-compiled header for it, turned off.
this is this.
|
|
|
|
|
can spmebody pls advice me how to fire IHTMLSelectElement onchange event in mfc .. i tried IHTMLWindow2 execscript......... but this does not work since the javascript function uses this pointer
|
|
|
|
|
hello,I wrote a property named get_Popvalue(long *nValue),
STDMETHODIMP CATC:get_Popvalue(long *nValue)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
*pVal = m_dSendBytes;
TRACE1("m_dSendBytes:%d\n",m_dSendBytes);
//m_dSendBytes is not changed here??
return S_OK;
}
and m_dSendBytes is a public variable the defined in the class CATC.
m_dSendBytes will be changed in another function CATC:NotifyData()
void CATC:NotifyData(long nSize)
{
m_dSendBytes += nSize;
//m_dSendBytes can be changed here
}
but m_dSendBytes can not get correctly by com invoked.
Can you tell me why? Thanks
|
|
|
|
|
Can anyone tell me is it possible to make a C# project as a Client to a COM component. If yes, then how to do that. To be precise, I have made a Client in managed C++ which is using a COM component. In managed C++ Client I call CoInitialize(NULL); which works, but I don't think we can write CoInitialize(NULL); in a C# file.
Please Suggest!
|
|
|
|
|
Hello rahultaing,
In your C# project, perform the following :
1. Make a reference to the Type Library File or to the Executable File (DLL or Exe) of your COM component.
1.1 Go to the "References" section of the "Solution Explorer".
1.2 Right click "References" and select "Add Reference".
2. The "Add Reference" dialog box should appear.
2.1 Select the "COM" tab.
2.2 Click on the "Browse..." button.
2.3 A typical file section dialog box should appear.
2.4 Navigate to your component's TLB or DLL or EXE file and select it.
3. An Interop Assembly will be created dynamically for your COM Component.
3.1 The Object Browser of your Visual C# IDE should now contain an entry for your COM component's Interop Assembly. Look out for this.
3.2 The types contained in the Interop Assembly are important for you to use in your source codes. They will usually be scoped by a namespace that has the form "XXXLib".
3.3 Among the types will be a name for your component's class.
3.4 In your C# code, declare this class as per normal using "new".
3.5 Use your class object normally, calling on its properties and methods.
4. What we have just done is something known as COM interop.
4.1 There is no need to call CoInitialize() nor CoUninitialize(). These are called on your behalf by the .NET framework.
4.2 There is also no need to AddRef() or Release() your COM components. The objects are garbaged collected.
Best Regards,
Bio.
|
|
|
|
|
Hi,
Is one of the Windows services in charge of instantiating COM objects, or is it more integrated into the OS than that?
When an out-of-process server is started, does the system start it with a call to CreateProcess?
Thank you,
Rich
|
|
|
|
|
The COM subsystem in the OS is responsible for loading/running COM servers as necessary. The server itself hands out an IClassFactory interface, and that IClassFactory implementation actually creates COM objects.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Can anyone tell me the possible cause of this linker error? I am making a Communicator Component, in the Communicator.h file I write #include "Sockets.h", the Sockets.h file is in the correct folder and contains a class SocketSystem, So now when I declare an object of SocketSystem in my Communicator.h file which is a component that I am trying to make, the above linker error occurs.
Please help!!!
Note: My Sockets.h is a normal C++ header file which contains different Classes and is not included in the project but is present in the same folder.
|
|
|
|
|
Did you make sure to include the necessary .LIB files in your project's "Additional Dependencies" property?
|
|
|
|
|
LNK2001 error means that your code is referencing functions that the linker
cannot find.
You have to tell it where to find those functions.
Most likely, the functions appear in some DLL that is not part of your
program.
What are the names of the functions that it can't find?
Post some of the exact error messages it is giving you.
Rich
|
|
|
|
|
Communicator.obj : error LNK2001: unresolved external symbol "public: __thiscall SocketSystem::SocketSystem(void)" (??0SocketSystem@@QAE@XZ)
Communicator.obj : error LNK2001: unresolved external symbol "public: __thiscall SocketSystem::~SocketSystem(void)" (??1SocketSystem@@QAE@XZ)
Debug\Trial.dll : fatal error LNK1120: 2 unresolved externals
These are the error messages which I get when I declare an object of SocketSystem Class which is present in my "Sockets.h"
|
|
|
|
|
OK, I understand that the SocketSystem class is declared in "Sockets.h", but where is the class defined? Where are the actual functions located?
Do you have the source for the SocketSystem class, or do you only have the compiled version?
|
|
|
|