Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AmitGG

@AmitGG
About
Posts
6
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to delete a COM object - My Other Code
    A AmitGG

    Please help me . :mad: :confused: :~ :(( :(( :(( :(( :((

    COM com csharp c++ sysadmin performance

  • COM Component...
    A AmitGG

    Hi I would add something. In my work I am using a DLL (Which has been built in C#) and I am using it in VC++ by using COM. Below is how I am doing it in my case. If client uses VC++, it has to create a Type library (TLB) file from the DLL. In microsoft visual studio (.NET) 2003 there is a tool , Regasm.Exe .. Use Regasm.exe tool to create TLB file .. Actually it registers the DLL in the system registry as well as creates a TLB file. Now use this TLB in #import command. #import "MyComponentDLL.tlb" A set of Type Library Header files will be generated by the VC++ compiler. Now Put the TLB file in your working folder and put the DLL in the folder where your solution EXE will be created. and Start then building the code. -- modified at 4:51 Wednesday 1st March, 2006

    COM com c++ announcement

  • How to delete a COM object
    A AmitGG

    hi, Thanks Again. Your mail is helpful but I am very new to COM so find it a bit difficult to understand. You have written some server side code also. Here I want to know "Do we need to override the Addref() and Release() functions of IUnknown interfaces or there is no need to do it" Actually I have just got the DLL by building the C# code. I have not written the coding of Addref, QueryInterface and Release functions. Is that wrong ? I have posted an other message on the board which contains both codes (client side and server side). Can you please see that message and help me in sorting the problem out. I logged that message because for the problem of the present message I cannot provide server side code. Please see that message also and let me know your comments. Your mail is very very helpful to me and it may take me out of the misery I am going through for so long. I can just say Thank You Very Very Much, dear. Best Regards, -- modified at 6:39 Tuesday 28th February, 2006

    COM com testing csharp c++ beta-testing

  • How to delete a COM object - My Other Code
    A AmitGG

    I have a C# (managed code) DLL and I am accessing this DLL's functions from C++ (unmanaged code) using COM. I create a COM object with CoCreateInstance function. Then I do work on this object. After that I call Release() function on this object. But after calling Release() function the object is not destroyed automatically. After calling Release function I called some more functions on this object and all those calls were successful. I also checked the return value of Release function call which is ZERO which shows the reference count of the object is ZERO and it should automatically destroy the object as soon as the reference count becomes ZERO. But in my case the object is not destroyed. Actually in my project work I have to create and destroy the COM object many times (1000-2000). So in each iteration the memory size is increasing and after some iteration it becomes more than 1 GB and fills all the page file space and the program hangs. Could Anybody suggest me how to delete the COM object. I have also given below the server side code which is in C#. The client side code which I am using is following : #import "ServerSideCode.tlb" named_guids high_method_prefix("") #include #include using namespace ServerSideCode; class Test { public: IEnterDetails *pPER1; IEnterDetails *pPER; IEnterAge *pAge; public: void Func1(); }; void Test::Func1() { pPER1 = NULL; HRESULT hr = CoInitialize(NULL); hr=CoCreateInstance(__uuidof(Manager), NULL, CLSCTX_INPROC_SERVER, __uuidof(IEnterDetails), reinterpret_cast(&pPER1)); pPER1->Print(); long a = pPER1->Release(); a = pPER1->Release(); a = pPER1->Release(); a = pPER1->Release(); // pPER1 = NULL; pPER1->EnterName(); pPER1->Print(); pPER1->QueryInterface(__uuidof(IEnterAge), reinterpret_cast(&pAge)); pAge->EnterAge(); pAge->Print(); a = pPER1->Release(); CoUninitialize(); } void main() { Test tt; tt.Func1(); } The C# code which was used to build the DLL (ServerSideCode.dll) is the following using System; namespace ServerSideCode { public interface IEnterDetails { void EnterName(); void EnterDesignation(); void EnterIncome1(); void EnterIncome2(); void Add(); void Print(); } public interface IEnterAge { void EnterAge(); void Print(); int Age {get; set;} } public class Person : IEnterDetails { private string Name = "DefaultName", Des = "DefaultDesignation"; private int i

    COM com csharp c++ sysadmin performance

  • How to delete a COM object
    A AmitGG

    hi mbue, Thank you very much for responding. You are right that I should never delete a interface pointer (delete m_pAnalCntrlv7;). I am not doing it. You say that there is a possibility that database server adds a refcount to my COM object. Yes, there may be a possibility. I have got another very simple code and I have not to use any database in that. But I am still getting the same problem in that code also. I am goofed up trying it. Can you (or anybody else) suggest me any other reasons why it is happening to me? Many heartiest Thanks in Advance :( Amit -- modified at 5:21 Tuesday 28th February, 2006

    COM com testing csharp c++ beta-testing

  • How to delete a COM object
    A AmitGG

    I have a C# (managed code) DLL and I am accessing this DLL's functions from C++ (unmanaged code) using COM. I create a COM object with CoCreateInstance function. Then I do work on this object. After that I call Release() function on this object. But after calling Release() function the object is not destroyed automatically. After calling Release function I called some more functions on this object and all those calls were successful. I called CoCreateInstance only once and there is only one reference of this object in my code. I also checked the return value of Release function call which is ZERO which shows the reference count of the object is ZERO and it should automatically destroy the object as soon as the reference count becomes ZERO. But in my case the object is not destroyed. Actually in my project work I have to create and destroy the COM object many times (1000-2000). So in each iteration the memory size is increasing and after some iteration it becomes more than 1 GB and fills all the page file space and the program hangs. Could Anybody suggest me how to delete the COM object. The code I am using is following : #include #include #include #include #import "mscorlib.tlb" raw_interfaces_only #import "Flowmaster.Automation.Gui.tlb" no_namespace named_guids #import "Flowmaster.Automation.Analysis.tlb" no_namespace named_guids class CFDlinkDoc { IFM2_AnalysisControl* m_pAnalCntrlv7; BSTR sDataSource; BSTR sDataBase; BSTR sProject; BSTR sUserName; BSTR sPassword; BSTR Project; BSTR NetworkName; BSTR Description; BSTR Owner; int ResultID; public: CFDlinkDoc(); void func1(); }; CFDlinkDoc::CFDlinkDoc() { m_pAnalCntrlv7 = NULL; sDataSource = L"pcpune26"; sDataBase = L"FM100206"; sProject = L"Flowmaster"; sUserName = L"Admin"; sPassword = L""; Project = L"Flowmaster"; NetworkName = L"AmitG"; Description = L"Hi, COM testing From C++"; Owner = L"AG"; } void CFDlinkDoc::func1() { HRESULT hr = CoInitialize(NULL); hr = CoCreateInstance(__uuidof(FM2_AnalysisControl) ,NULL, CLSCTX_INPROC_SERVER, __uuidof(IFM2_AnalysisControl), reinterpret_cast(&m_pAnalCntrlv7)); long lP= m_pAnalCntrlv7->DatabaseLogin(sDataSource, sDataBase, sProject, sUserName, sPassword); m_pAnalCntrlv7->PutProjectName(Project); m_pAnalCntrlv7->PutNetworkName(NetworkName); m_pAnalCntrlv7->PutDescription(Description); m_pAnalCntrlv7->PutOwnername(Owner); m_pAnalCntrlv7->PutAnalysisType(_T

    COM com testing csharp c++ beta-testing
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups