Architecting VC++ 6.0 Applications - Resources Available

Sorry for the last post, wrong keystrokes prematurely sent message.

In short, I have an ATL out-of-process COM server that sits between a VB 
client and another ATL server.  I fires events/receives method calls to/from 
the VB client AND makes method calls/sinks events to/from the other ATL 
server.  Internally it seems to have one 'main' CDialog' application 
(thread?).  It uses the PostMessage (e.g. theApp.m_pMainWnd->m_hWnd inside 
COM method calls received from VB client) extensively and MANY timers and the 
'OnTimer' method inside the main dialog class.  I'm just curious if this is 
the most efficient means to structure the application, that is not explicitly 
creating other threads.  Sometimes when an 'operation' that has been 
inititated via a SetTimer call needs to be terminated, it seems all other 
timers must be 'killed' which seems like a lot to keep up with.

I'm curious if anybody knows of a book that addresses this topic.  Most VC++ 
books I've seen don't specifically address how to put applications (other 
than GUI apps) together.  

I am also curious about threading.  I know the app has a main thread 
associated with the ATL object/CDialog class (right?), but I thought I had 
heard in the past that threads are created 'dynamically' when a COM method is 
called on one of the interfaces.  Is this true?  That is can both the main 
application thread and a thread resulting from a COM call be active at the 
same time?  It seems as if they are different threads in that I can't call 
methods on the main dialog class directly.

Thanks for any help.

phil
0
pdxphil (4)
1/11/2005 1:19:06 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
573 Views

Similar Articles

[PageSpeed] 52

pdxphil wrote:
> Sorry for the last post, wrong keystrokes prematurely sent message.
>
> In short, I have an ATL out-of-process COM server that sits between a
VB
> client and another ATL server.  I fires events/receives method calls
to/from
> the VB client AND makes method calls/sinks events to/from the other
ATL
> server.  Internally it seems to have one 'main' CDialog' application
> (thread?).  It uses the PostMessage (e.g. theApp.m_pMainWnd->m_hWnd
inside
> COM method calls received from VB client) extensively and MANY timers
and the
> 'OnTimer' method inside the main dialog class.  I'm just curious if
this is
> the most efficient means to structure the application, that is not
explicitly
> creating other threads.  Sometimes when an 'operation' that has been
> inititated via a SetTimer call needs to be terminated, it seems all
other
> timers must be 'killed' which seems like a lot to keep up with.
>
> I'm curious if anybody knows of a book that addresses this topic.
Most VC++
> books I've seen don't specifically address how to put applications
(other
> than GUI apps) together.
>
> I am also curious about threading.  I know the app has a main thread
> associated with the ATL object/CDialog class (right?), but I thought
I had
> heard in the past that threads are created 'dynamically' when a COM
method is
> called on one of the interfaces.  Is this true?  That is can both the
main
> application thread and a thread resulting from a COM call be active
at the
> same time?  It seems as if they are different threads in that I can't
call
> methods on the main dialog class directly.
>
> Thanks for any help.
>
> phil

I am also curious about threading.  I know the app has a main thread
> associated with the ATL object/CDialog class (right?), but I thought
I had
> heard in the past that threads are created 'dynamically' when a COM
method is
> called on one of the interfaces.  Is this true?

You seem very coinfused.

The app has a main thread. COM objects reside in servers. If and only
if your COM object is free threaded (CComMultiThreaded model) and you
have initialised your main thread as Multithreaded -
CoInitializeEx(NULL,COINIT_MULTITHREADED) will COM methods cause RPC
threads to be dynamically spawned in your server. If your object is
CComSingleThreadedModel and you just CoInitialize(NULL) then COM
requests will be queued on your main thread.

A client accessing a free threaded COM object in a out-of-proc (.exe)
server causes a RPC thread to be spawned in the server process (to
service the request). No additional threads are spawned in the client
process AFAIK.

Examine the folowing article

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/aptnthrd_8po3.asp

Also look for 'Processes, threads and Apartments' on MSDN.

My guess is that the COM object residing in your COM server between the
VB client and the other server is CComSingleThreaded model in which
case it is using the main thread's message pump as it should and must
do.

I can only guess as to what the timers are doing they don't SOUND as
though they need to be there. A COM call from your client into the
server will block until it is serviced or throws a server exception
etc. The point is it will block up until the point that it returns with
a HRESULT even if that HRESULT is E_SERVER_THREW_AN_EXCEPTION (world
has blown up). Asynchronous interfaces (look up IDL,asynch etc.) are
advanced and were brought out later. It doesn't SOUND as if you are
using them.

0
rquirk1 (133)
1/11/2005 2:19:37 PM
Reply:

Similar Artilces:

Beep deadlocks application
A call to Beep( 400, 50) seems to deadlock my application. (app not responding, 0% CPU load) This happens only if Sound Sentry, Flash active caption bar is activated in the control panel. I'm using XP, SP 2. Anyone else noticed this? ...

Displaying MS Excel Chart control in ASP.NET Application
Hi, We are working on an ASP.NET (VB.NET) application. In one of th screens of our application, we need to show a graph and for this we ar using MS Excel Graph control. We have the graph prepared in Excel. Th application would feed in certain values into certain cells of th excel file and the graph would be drawn by the graph control based o these cells. We need some help on how exactly to display the excel graph contro directly on the screen of ASP.NET application. Thanks for the help oursm -- oursmp ...

CRM 4.0 External Connector
Can anyone point me to CRM 4.0 External Connector installation guide? Cheers, Mandy. "Mandy" <Mandy@discussions.microsoft.com> wrote in message news:BF297AE0-9446-46CB-91FA-CFF19A65F1DF@microsoft.com... > Can anyone point me to CRM 4.0 External Connector installation guide? The external connector is a license so nothing you need to install. -- Robert MacLean http://www.sadev.co.za thanks for update. would you know if there's any specs on how it integrates with crm? "Robert MacLean" wrote: > "Mandy" <Mandy@discussions.microsoft.com&g...

Integrating Great Plains 8.0 and CRM 1.2 and Windows Small Busines
Integrating Great Plains 8.0 and CRM 1.2 I run a Windows Small Business Server 2003 Premium box along with a Windows Server 2003 Standard box used for my Great Plains 8.0 and SQL 2000. I’m considering introducing CRM 1.2 Professional into the mix. From a hardware stand point I know I’m fine all around. I’ve been researching how I should configure CRM and am a bit confused. The info I’ve found in KB887153 states “When you install Microsoft Business Solutions CRM Integrations for Great Plains 7.0, 7.5, or 8.0, Microsoft BizTalk Server is also installed. However, BizTalk Server 2000 and B...

Exchange 2003 SP1 to get DST patch & Exchange 2000 patch is available to anyone for $4,000
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C746B0.CFF31030 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable http://blogs.technet.com/hied_west_blog/archive/2007/02/01/dst-2007-updat= e-outlook-time-zone-data-update-tool-released-february-1-2007.aspx In the "New Highlights" section: "Exchange Server 2003 SP1 will now be = supported for an updated version of the Exchange CDO patch to be = released shortly." and "DST Hotfixes for products in Extended Support can now be purchased for = ...

Too many different cell formats #6
I am running into the error message: Too many different cell formats Is there a solution to lowering the number of formats I am using? Just trying to change them to make some consistent gives me the same error message. I tried running the search on the forums on my topic but they have been disabled for a Microsoft upgrade. Thanks! One idea - Rob Bovey's excellent Utilities add-in will list all the formats in use in your workbook, allowing you to manually delete what isn't being used. http://www.appspro.com/Utilities/ExcelUtilities.htm You can also see the source code for ...

Purchase Order 2.0.0127
Am I the only one having issues with the upgrade? 1) I create a purchase order 2) I click on add item 3) I type in the supplier ILC, and nothing comes up (ONLY on some items)! 4) I click on all items, and find the item, and add it! 5) When I click on OK the item is added to the purchase order, along with the supplier ILC! OR When I click on all items, even though the item may be in the database, I can't find it to add to the PO, unless I close out the PO and re-open it??? This started happening only since I upgraded the the 2.0.0127! -- Thank You Vince :) -- Thank You Vince :) Yes...

RMS 2.0 matrix dimensions are annoying, but help is available
For reasons I don't understand, MS saw fit in RMS 2.0 to use dimensions data for matrix components that is far less accessible to users than Sub Descriptions are. For instance, I can't edit assign a dimension value to an existing item I have added to a matrix. I can't see a reason for using Dimensions with limitations like this as using Sub Descs. to describe matrix "dimensions" worked fine previously. Does anyone know why MS did this? It's annoying! Digital Retail Solutions (DRS) has a product called Power Ops (Build 2.2.0003). It's help file mentions (se...

Upgrade GP 9.0 SP2 to GP 10.0 Advice
Hi, We are planning our upgrade of GP9.0 SP2 to GP10.0. We are running SQL 2000 and would like to also upgrade to SQL 2005. I am using the following url (and read some threads on this forum): https://mbs.microsoft.com/customersource/support/knowledgebase/hottopics/hot_topic_updatingmicrosoftdynamicsgp10.htm?printpage=false (page: Updating to Microsoft Dynamics GP 10.0) The chart Microsoft provides says I can go from 9.00.0281 (which is SP2) to 10.0 or any patch install. What does "any patch install" mean? Does this mean I can't go directly to 10.0 Feature Pack 1? Would i...

CRM 3.0
Folks Any way that we can assign leads / opportunities / other entities to teams rather than individuals? All the best Hany Hi Hany, Team ownership is not supported in CRM 3.0. Could you describe your scenario, and maybe we could provide some alternatives? Thanks -- Jay Grewal Microsoft Dynamics CRM This posting is provided "AS IS" with no warranties and confers no rights. "Electronic Workplace" <info@electronicworkplace.LoseThisBit.com> wrote in message news:O0cfzAT$FHA.140@TK2MSFTNGP12.phx.gbl... > Folks > > Any way that we can assign leads /...

IE 6/ActiveX assert in CTLNOWND.CPP line 305
Hello, I have a problem with an ActiveX inside a web page. A random ASSERT in CTLNOWND.CPP line 305 occours during a GetDC first call. It's seems wnd handle is still NULL (it begin valid immediatly after). If I retard calling putting a button in html page it work. CDC* COleControl::GetDC(LPCRECT lprcRect, DWORD dwFlags) { ASSERT((m_hWnd != NULL) || (m_bInPlaceSiteWndless && m_bInPlaceActive)); ..... This problem occours random (more times on faster machines and in release mode) and just on "init" time on my control. Probably my control does this operation in ...

Toolbars Created in Excel 2002 not available in 2003
I have not been able to get a toolbar created in Excell 2002 to be visible in Excel 2003. I have copied the excel10.xlb file to the appropriate location. I have attemped to follow Help instructions (IE> open .xlb file). I have even attempted to simply rename the Excel10.xlb file to Excel11.xlb. In any scenario, it does not appear upon opening Excel, nor is it listed as an option to activate(make it visible) from the list of toolbars. I appreciate any suggestions. ----VBA Fun Open excel 2003. Tools|customize|and create a new toolbar close excel windows start button|search look ...

AutoFilter #6
Thanks for the help. I am using Excel XP. I have a list of items that come from an Oracle Database. They are vehicle numbers that begin with a 0. (028,034,039,056, etc) I have an autofilter and want to filter out numbers >= 028 and <= 039. I always get an empty set returned to me. I assume this is because these are text items rather than numbers. Is there a way to accomplish this filter with text? Hmmm, not really sure if this is what you mean but have you tried puting a ' infront of the number, it denotes it as text. (It is under the " key) >-----Original Messag...

Advanced Security #6
I am setting up security access for new users using Advanced Security. I am using the by Menu view as my primary navigation tool. However, there are a number of objects within the by Menu view that I am not allowed to change. They appear with a "?" next to the description. Some of them I can locate by navigating through the by Dictionary view. However, there are several that I cannot locate (example: Tools --> Utilities --> Project --> Service Utilities --> Create Routine Master). Is there a guide that crossreferences objects between the menu and dictionary ...

Team Resources Error
All, I have created some team resources as follows: 1. Created a team lookup table with team names ( Team AA, Team BB...) 2. Edited the "team name" field to use this lookup table. 3. In MS Project, created a generic team resource for each team, assigned it to the team and set the "team assignment pool" to "yes" for these tam resources. 4. Added members of the team to the teams. 5. Saved the ERP. 6. Created a project schedule and assigned the team resource to tasks. 7. Published the project schdule. When I have one of the team members go to "...

SOP NonInventory Unit Cost 6 Decimal Places
Is there any simple way to increase the currency decimal places to greater than the current highest value of 5? Thanx Scott, I don't believe there is any easy or even moderately difficult way to do this, as the field types used to store amounts in GP only go up to 5 decimal places. -- Victoria Yudin Dynamics GP MVP Flexible Solutions - home of GP Reports http://www.flex-solutions.com/gpreports.html blog: http://www.victoriayudin.com "Scott Rutledge" <sersoar@hotmail.com> wrote in message news:E102B81B-8555-400E-843C-240C58794294@microsoft.com... > Is there any...

MS CRM 3.0 - Availability of User for Assignment
Hello All, I am having this unusal requirement. I am having 3 Businsss Units with its User base. I have set Roles for all the Users from All the BU such that they can view/read Users from their own Business Units. So whenever User assigns the record they can assign it to any User withing their BU. However I have requirement where a specific User can be assinged to the record by Users in any BU. This user can be in any BU (it can have its own BU also). So special Incidents can be assigned to this Special User by Users in any BU. How to achieve this by Roles configuration? I tried all...

Column Width #6
I completed a workbook (multiple sheets). Then did a save As with a different name for the French copy I had to make. I have now tiled them horizontally to validate the numbers are the same and in the English copy, Column A is at a width of 24, and column A in the French copy is closer to 36 to make it the same width. The columns have to be identical when printed and I have no idea how it is that the column widths are now so different and I cannot just drag the column to match the size of English one - the French started as the English file....what happened?? Very confused, Deborah ...

Error when tracking in CRM 3.0
I have a user who is having a problem whenever they are attempting to track an email in CRM using the outlook client. When they open up and email the Track in CRM buttons at the top appear to be greyed out and can not be used. If you are in the main screen of outlook the Track in CRM button is available and you can select it but it will return an error. The error message comes up as an error occurred promoting this item to Microsoft CRM. I have several other users who are configured the same way and have no problem tracking emails whatsoever. Check in tool, rules and see if you have ...

BPA: MSGINA.SYS update available (but not publically it seems)
I've just run the BPA Give me a message about MSGINA.SYS being out of date Clicking on "find out more" gets me to default exchange support page I had a look at MSKB 905865 It appears that one has to contact Microsoft Product Support Services to obtain the hotfix Is the fix still in beta? regards Roger "roga" <{news2005}REMOVE_THIS_UPPERCASE_2_REPLY@roga.co.uk> wrote: [ snip ] >I had a look at MSKB 905865 > >It appears that one has to contact Microsoft Product Support Services to >obtain the hotfix > >Is the fix still in beta? ...

Help with resource calendars
Greetings, I am in need of some assistance regarding resource calendars and deleted users. I have some orphaned calendar belonging to deleted users. Is there a tool or process that I could use to automagicly delete or remove these entries? Thanks David not really...basically, everyone who was invited to those meetings will need to just delete them... -- Susan Conkey [MVP] "David White" <dwhitetopgun@hotmail.com> wrote in message news:eGSehcziHHA.4496@TK2MSFTNGP05.phx.gbl... > Greetings, > > I am in need of some assistance regarding resource calendars and...

Dates in Excel #6
In natural history, including museum records, it is commonplace to use a date with lower case letters for the month, e.g. 19.x.2004 = 19th October 2004 or 01.iii.1999 = 1st March 1999. It would help users if this format were added as a standard and could be converted. For what it is worth... If you add dates as text by preceeding the entry with a ' , for example, '19/11/2004 and then apply the following formula =LEFT(A8,2)&"."&LOWER((ROMAN(MONTH(A8)))&"."&RIGHT(A8,4)) you will get 19.xi.2004 as the output. Does this help? Possibly I could m...

VC++ 6, MFC, Manifests and XP Styles
Hello every body, after reading this two laughable articles.... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp .... I decided to try it. I am using Windows XP Service pack 4, VC++ 6.0, I then created with AppWizard a standard SDI Application named TestXP, in the InitInstance I call InitCommonControls(). I link (Project/Settings/Link/Project Options) with ComCtl32.lib. I compile. I add to the Debug folder (where my TestXP.exe file is) the following manifest(Test...

Why isn't "New Comment" available on my worksheet?
I want to add a new comment to a cell in my worksheet, but the "new comment" command is inactive. The only thing that's active is "Show all comments". What's wrong. I've added comments in other worksheets. ...

CRM 3.0
Hello... I have problem with synchronization MS CR 3.0 server and Outlook client after assign opportunity to new owner. In CRM server everything looks good - it's mean that if I assigned opportunity to new owner, every records (opportunity, tasks, contacts with relationship to opportunity) has new owner. It's good, but... When old owner and new owner of opportunity synchronized theirs Outlook clients and they are looking for a tasks from opportunity in theirs outlook - calendars, they found a problem - old owner has still tasks in his outlook-calendar and new owner didn't f...