Want COM Server - Only 1 instance of a coClass

Hi all from Spain,

I usually create a coClass that is instantiated many times, every time
you call "coCreateInstance" the  aplication class and the coClass
constructors are called, so a new object is being created.

I wander if it's posible to create a "singleton" COM Object, so that
the object is not created every time y call for the interface...the
reason is that I need an object that maintain in memory some data only
1 time (because the amount of memory needed).

do you know if that could be done?

regards,
 Alberto.

0
apf14378 (2)
9/15/2006 12:25:41 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
777 Views

Similar Articles

[PageSpeed] 21

IrvingWashington wrote:
> Hi all from Spain,
> 
> I usually create a coClass that is instantiated many times, every time
> you call "coCreateInstance" the  aplication class and the coClass
> constructors are called, so a new object is being created.
> 
> I wander if it's posible to create a "singleton" COM Object, so that
> the object is not created every time y call for the interface...the
> reason is that I need an object that maintain in memory some data only
> 1 time (because the amount of memory needed).
> 
> do you know if that could be done?
> 
> regards,
>  Alberto.
> 

You can register an interface in GIT then all clients can get the same 
instance.
IGlobalInterfaceTable::RegisterInterfaceInGlobal
0
9/15/2006 12:43:57 PM
>
> I usually create a coClass that is instantiated many times, every time
> you call "coCreateInstance" the  aplication class and the coClass
> constructors are called, so a new object is being created.
>
> I wander if it's posible to create a "singleton" COM Object, so that
> the object is not created every time y call for the interface...the
> reason is that I need an object that maintain in memory some data only
> 1 time (because the amount of memory needed).
>
> do you know if that could be done?
>

I think ATL has some attributes like this builtin in its framework. I
would post this in a ATL ng if you are using ATL. MFC is not very
robust in writing COM servers. Its relatively easier to write a
automation server with MFC.

---
Ajay

0
ajaykalra (6842)
9/15/2006 1:07:31 PM
Thank you very much for the info, I will try the GIT solution next
monday :-)

ATL is very good and I'm used to write activex controls with it, but I
need MFC's now for compatibility with existing code, but thanks for the
tip ;-)

regards,

0
apf14378 (2)
9/16/2006 12:38:14 PM
Reply:

Similar Artilces:

Unable to delete last Exch5.5 server after migration
I've migrated everything to a new Exch2003 server and am attempting to now retire and remove the 5.5 server following KB article 822450. The 5.5 server is shutdown. When I open the 5.5 admin program on the 2003 server, connect to the 2003 server as per the article, then attempt to delete the 5.5 server, it first checks to make sure the 5.5 server is inaccessible, which it is. It asks the usual "are you sure?" questions, then fails with the following error: The object cannot be found in the directory. This may be because replication has not completed. Microsoft Exchange Directory ...

System manager not showing remote server IP alias
Hi everyone! I have this problem... I manage 3 Exchange 2003 SP2 servers from one System Manager (on a test lab). I can manage the 3 servers OK, but recently I added an IP to one of the servers, and I am unable to see the new IP in SM for that server. My config is the following: Server01: Windows 2003 sp1 + Exchange 2003 Sp2 + System Manager (I manage all from here) Server02: Windows 2003 sp1 + Exchange 2003 Sp2 Server03: Windows 2003 sp1 + Exchange 2003 Sp2 [IP 192.168.1.2 / alias 192.168.1.20) I added an IP to server03 but I cant see it from System Manager on Server01 (I try to bind an S...

.Net Web App (client) / Web Service XML (server) HTTP Post
I think I have confused myself with reading all the articles on XML so I am hoping someone can point me in the direction for each piece of the project I am trying to develop. 1st Step - I need to have a Web app that will create an XML stream and send it to a Web Services on our Web server 2nd Step - Need to create a Web Service that will accept the XML Stream - then "process" it, then send an XML Stream back 3rd Step - We the same app that was created in step 1, I need to be able to read the new XML stream coming from the Web Service in Step 2. If someone could point me to the c...

E-Mails Bouncing from Server
E-mails that are sent to one of my users bounce intermittently, however, they bounce with the name of another user, i.e., an e-mail sent to johndoe@mail.com bounces back with a reply, i.e.: Your message did not reach some or all of the intended recipients. Subject: Technology Update Sent: 6/1/2005 3:07 PM The following recipient(s) could not be reached: Jane N. Doe on 6/1/2005 3:07 PM The e-mail account does not exist at the organization this message was sent to. Check the e-mail address, or contact the recipient directly to find out the correct address. <mail.mail.com #5.1...

EMAIL PROCESSORS WANTED #2
HELLO, I REPRESENT AN EMAIL PROCESSING COMPANY THAT IS LOOKING FOR EMAIL PROCESSORS IMMEDIATELY, TO SUSTAIN EXPLOSIVE GROWTH. EARN $1000 AND MORE MONTHLY ON A PART-TIME BASIS. NO EXPERIENCE NECESSARY ALL ONLINE TRAINING IS PROVIDED. SEND AN EMAIL TO shanearnold@emailaccount.com WITH "EMAIL PROCESSOR" IN THE SUBJECT LINE. WE WANT SERIOUS INQUIRIES FROM PEOPLE WHO WANT TO MAKE SERIOUS MONEY! REGARDS, SHANE ...

Issue with OnInitalUpdate() and Windows 2003 Server
Hi. I’m moving some executables form an old Windows NT Server platform to a Windows 2003 Server. So far the 6 MFC/SDI/CFormView apps I’ve moved and re-compiled under Visual C++ 6.0 on and XP Professional machine have worked without a hitch except one. When I run the problem app on my XP Professional machine it works fine, but when I run it on the Windows 2003 server a dialog pops up: “An unsupported operation was attempted.”. I’ve traced it down to MyApp::OnInitialUpdate(), and specifically the first line of code: CFormView::OnInitialUpdate(). All of my other CFormView apps have the sam...

1.2 to 3.0 Upgrade with new Server
Can we put 3.0 on a new box (upgrading the data from the SQL box) directly w/o upgrading the old box to CRM 3.0 first? A little confused about what you are trying to do. It sounds like you want to install the code on a new server, but have it "use an existing" 1.2 database and upgrade it in the process. My first thought is that this will not work. It might, but I don't think it will. If this is what you are trying, then you could do the following: - install v1.2 on the new server and "use the existing" databases - Instal v3 on the new server as a upgrade. However...

Issues with demoting exchange server? #4
Hi, It seems that the previous administrator was not succesful in fully promoting a sever to a DC. We are supposed to have two DCs (CC7=First DC, CC5=DC with Exchange server). There have been continuous replication problems from cc5 to cc7. AD doesnt consider cc5 as a DC and cc7 is the only DC in Domain Controllers group of AD. Manual replication between two DCs results in 'no endpoints' error. AD is unavailable several times on both DCs. Object created on a DC is not replicated within two (!) days on second DC. Clearely cc5 can not communicate with cc7 the way it is supposed to. T...

CRM (4.0) <-> Microsoft Project Server 2007
Hallo Is there a method, where one of the both systems grab the Usermanagement of the other? Or is it possible to synchronise both system with an OU from the AD? Thanks for any input. best regards.. Bernd ...

All cell contents within a range of cells turns white if Sheet1!A1 = 1
If the return of Sheet1!A1 = 1, I need all fill, font and line colors to turn white from A1:E10. If the value of Sheet1!A1 changes to 0, all colors must return to normal. Does anyone have any thoughts on this? Thanks for any suggestions. Michael If your range to format is on Sheet1............. Conditional Formatting Select A1:E10 Format>CF>Formula is: =$A$1=1 Format to suit If range to format is on a sheet other than Sheet1 Select Sheet1!A1 and give it a name..............insert>name>define On other sheet select range A1:E10 and Format>CF Form...

Migration Exchange Server 5.5 to 2003
I have completed the migration from NT4.0 Exchange Server 5.5 to Server and Exchange 2003. It appears that I missed a step in the migration process. I am not able to go to Native mode for Exchange server 2003 as I cannot remove the old server (Now in the bin with no chance of recovery). Does anybody know how to remove the old server? Hi, Have you decommissioned your ADC and SRS? -- Scott Schnoll Microsoft This posting is provided "AS IS" with no warranties, and confers no rights. Please do not send email directly to this alias. This alias is for newsgroup purposes only...

SQL Server replication
Hi, I have a client that has offices in CPT & JHB. They plan on doing transactions on a sql server in JHB on a Dynamics company e.g XYZ and then replicating this to the same company (XYZ) on a different server in CPT. The people in Capetown will never enter transactions to the XYZ company ion the CPT server, but purely need to see the data entered by the staff in JHB for month end reporting. I want to use sql replication to achieve. I assume the steps would be: 1) Create a local publication from the database in JHB (and scheudle it per week) 2) Create a local subscription from th...

VBA unter Office v. X
Hallo zusammen, ich versuche gerade ein VBA-projekt an MacOS X anzupassen, aber ich kann keine Dokumentation oder Beispiele f�r DECLARE unter MacOS X finden! Konkret m�chte ich die Rainbow Sentinel API auf diese Weise ansprechen, aber ich konnte bisher noch nicht einmal herausfinden, welche Libraries Word �berhaupt unterst�tzt, und wie die entry points zu deklarieren sind. Ich w�rde mich �ber jeden Tipp freuen. Viele Gr��e Sascha Leib -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Sascha Ren� Leib - KOPFteam GmbH - http://www.kopfteam.de/ "There is not, and will...

outlook cannot logon to my incoming POP3 mail server.
Hi, for the last 3 days i have had no incoming email from 3 email accounts, i can however send out emails. i have been in touch wiht my domain host and they have checked all my settings and say they are correct and said i must contact Outlook. i keep getting this message saying " unable to connect to incoming (POP3) email server. All help gratefully received "Help Needed Please" <Help Needed Please@discussions.microsoft.com> wrote in message news:1A66F62C-BD3B-454D-9DA2-5856F111879B@microsoft.com... > Hi, for the last 3 days i have had no incoming em...

I want buy Money 2008...
....but I want use my old file mny Money 2000 "ITALIANO". Money 2008 US can't convert file Money2000ITA but it can convert only US old version. Exist a converter "international"??? Thanx - Claudio P. Exporting to .qif file from Money 2000 and importing into Money 2008 should work. It did when I converted my Money 2005 French to Money2008 US. "Claudio P." <cldparisi@gmail.com> a �crit dans le message de news:aecde3b2-9f9a-4eaa-9346-9978d2ac05c0@p20g2000yqi.googlegroups.com... > ...but I want use my old file mny Money 2000 "ITALIANO". ...

"update ta set ta.ra=1 from tablename ta" how can pass in Access
is it can be pass in the Access? how to change? thanks! update ta set col = t.col from ta,(select id,max(col) col from tb group by id) t where ta.id = t.id UPDATE ta SET col = DMAX("col" , "tb", "id=" & id ) or (untested) UPDATE ta INNER JOIN tb ON ta.id=tb.id SET ta.col = tb.col WHERE tb.col = ( SELECT MAX(col) FROM tb AS c WHERE c.id = ta.id ) A Jet query implying an aggregate (elsewhere than in a sub-query in the WHERE clause) is NOT upd...

Merging 2 columns into 1 and converting to other cases?
Hi there, A few questions: 1) how to convert a column [or row] of data into upper case? 2) how to merge two columns of names into 1 column where a space separates the two names 3) how to convert the names in a column to mixed case, that is, the first letter of a name is in upper case, the remainder lower-case? Hmm how to work with names like McCain or O'Hanlon, or Smith-Jones? Would a book like 'excel for dunmmies' help here, or please recommend your gav book. Thanks for the assist. I hope I can help others soon too! -- GottaRun ------------------------------------------...

SBS2008 + new Windows 2008 Terminal Server
Hi, Have an SBS 2008 domain currently running two Windows Server 2003 Terminal Servers. We're now planning on adding an additional Windows Server 2008 Terminal Server. Terminal Server Licensing role is already currently installed on the SBS 2008 box. What's the best thing to do regards TS Licensing on the new Windows Server 2008 TS box ? I need to keep the 2003 TS boxes online as well for a near future. Can I just use the TS Licensing role already on the SBS 2008 box or should I setup another TS Licensing server role on the Windows Server 2008 TS itself ? ...

Duplicates in 1 column
I have a spread sheet w/ over 1000 client names. I need a formula that will let me know if a client shows up more than once in the column. My brain is dead trying to think of the formula..Any help would be appreciated! I have a time schedule on this-so hopefully I can get help fast! Thanks in advance! -- Delaina ------------------------------------------------------------------------ Delaina's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24151 View this thread: http://www.excelforum.com/showthread.php?threadid=388694 Hi, If names appear in Col A then in A1...

Lookup based on two criteria in 1 row
Hi all, In looking thru the help, I didn't find anything that looked quite like my issue, though there were some similar. I have a table with 2 criteria in the same row, and I am attempting to essentially graph my answers on a separate sheet. Data: Group # Option # On/Off (8) 1 On (8) 2 Off (14) 1 On (14) 2 On Ideal results: " (8) (14) 1 On On 2 Off On My actual data is obviously a much larger table, and I need this to be something I can view all at once to print, etc. Normally, I would do a vlookup to get myself one set of data on this, and I could manually run a vlooku...

COM question
Hi all, I'm new to COM. My question is with a specific goal, but i guess this a general COM issue, so I hope some COM expert could help me. I developed a webbrowser based on the webbrowser activeX control. When I noticed that it doesn't respond to keys like tab,delete and others, i googled a bit and found that when adding the code below to the WinMain message handle loop it works. The important class is named BrowserWindow and it holds pointers to IWebBrowser2 interface and a CAxWindow object. My question: is it necessary to do in every round of the loop the queryInterface(), release(...

application.getopenfilename to open a file saved on a server
How do I set the current drive if I wish to us application.getopenfilename to open a file if the folder I wish to vie is on a server -- Message posted from http://www.ExcelForum.com ChDrive "C:\" -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "dovrox >" <<dovrox.1654sh@excelforum-nospam.com> wrote in message news:dovrox.1654sh@excelforum-nospam.com... > How do I set the current drive if I wish to use > application.getopenfilename to open a file if the folder I w...

I want to block sending email to an address
I have a co-worker named John Smith and a customer named John Smith. I keep sending emails to my co-worker instead of my customer. I want to block sending messages to co-worker John Smith. How do I do that? Change the way the name appears in your address book, or manually put in the email address? "Cynthia" <Cynthia@discussions.microsoft.com> wrote in message news:28AFE084-FC9A-46B2-98CA-D50150941C88@microsoft.com... :I have a co-worker named John Smith and a customer named John Smith. I keep : sending emails to my co-worker instead of my customer. I want ...

Clear server?
Is there an option to clear messages from the server as they come in/ If so, How do i do that or undo it/ Thanks. "JMS" <JMS@discussions.microsoft.com> wrote in message news:3CBC8C8E-D6AF-4E2E-9B3C-5A0CC0D4C197@microsoft.com... > Is there an option to clear messages from the server as they come in/ > If so, How do i do that or undo it/ > Thanks. Tools menu>accounts>select your account>properties button>advanced tab. -- Regards Steve. MS-MVP. MAIL. [DTS] UK. http://www.getsafeonline.org/ http://www.microsoft.com/uk/citizenship/safean...

How to suppress "Do you want to save" dialog when closing a workbook in a Macro?
Hello, Say I have this code in a macro: Application.ScreenUpdating = False Dim wbBook1 As Workbook Set wbBook1 = Workbooks.Open("C:\Book1.xls") wbBook1.Close If Book1.xls contains formulas, when this code executes, the dialog box comes up asking "Do you want to save the changes you made..." with the options Yes/No/Cancel. How can I make it so that dialog box doesn't come up? If a button has to be chosen, preferably it would be No, to save time when executing. Any help would be greatly appreciated. Thanks! -Mike wbBook1.Close SaveChanges:=False -- HTH Bob (the...