COM是如何实现STA的
Rather than using thread synchronization objects (mutexes, semaphores, and so forth) to control access to an object by several threads, the marshaling process for STAs translates the call into a WM_USER message and posts the result to a hidden top-level window associated with the apartment when it was created. Calls from several different threads are converted and sent to wait in the apartment's message queue until they are retrieved, dispatched, and executed on the apartment's thread. This process controls access to an apartment's objects by forcing incoming calls to pass through a sort of turnstile, thereby rendering the object's interface implementations thread-safe. An additional benefit of using the message queue is that inter-apartment COM calls are synchronized with window messages, which provides a means for objects that interact with users to synchronize incoming COM calls with the operation of the user interface (UI).
也就是说基于消息队列,串行化调用请求实现单线程模式。
COM是如何实现STA的的更多相关文章
- 选择目录,选择文件夹的COM组件问题。在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。 只有将调试器附加到该进程才会引发此异常。
异常: 在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式.请确保您的 Main 函数带有 STAThreadAttribute 标记. 只有将调试器附加到该进程才会引发此异常. ...
- 【转】使用SQL Tuning Advisor STA优化SQL
SQL优化器(SQL Tuning Advisor STA)是Oracle10g中推出的帮助DBA优化工具,它的特点是简单.智能,DBA值需要调用函数就可以给出一个性能很差的语句的优化结果.下面介绍一 ...
- 如何用 SQL Tuning Advisor (STA) 优化SQL语句
在Oracle10g之前,优化SQL是个比较费力的技术活,不停的分析执行计划,加hint,分析统计信息等等.在10g中,Oracle推出了自己的SQL优化辅助工具: SQL优化器(SQL Tuning ...
- [BZOJ1131][POI2008] Sta 树的深度
Description 给出一个N个点的树,找出一个点来,以这个点为根的树时,所有点的深度之和最大 Input 给出一个数字N,代表有N个点.N<=1000000 下面N-1条边. Output ...
- 在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式
在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式 转载自:http://blog.163.com/smhily_min/blog/static/75206226201092011 ...
- 关于 RTL8723BS 同时开启 STA/AP 模式
最近接到一个调试 wifi 驱动的任务,使用的是 rtl8723bs 芯片组.要求是让无线设备工作在 station 模式的时候同时开启一个 ap 热点.简单来讲就是连接其他 wifi 的同时发出一个 ...
- 【BZOJ-1131】Sta 树形DP
1131: [POI2008]Sta Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 1150 Solved: 378[Submit][Status] ...
- “不支持一个STA线程上针对多个句柄的WaitAll。”的解决方案
一.异常提示 不支持一个 STA 线程上针对多个句柄的 WaitAll. 出错界面如下图: 二.解决方法 先直接上解决方案吧.其实解决方法很简单如下面的代码直接把main函数的[STAThread]属 ...
- 在可以调用OLE之前,必须将当前线程设置为单线程单元(STA)模式,请确保您的Main函数带有STAThreadAttribute
导入导出功能,在调用ShowDialog时的错误,解决办法如下: WinForm窗体的入口点: /// <summary> /// 应用程序的主入口点. /// </summary& ...
- 不支持一个 STA 线程上针对多个句柄的 WaitAll
[csharp] view plaincopy using System; using System.Collections.Generic; using System.Windows.Forms; ...
随机推荐
- ssh 免密码登录,以及 本地和远端用户名不一致 问题
ssh 远程登录 ssh -l u1 u1@192.168.0.7 ssh u1@192.168.0.7 每次远程都要输入 用户名,密码 比较麻烦.所以比较好的是免密码登录 1.安装ssh服务器 su ...
- neo4j 学习-2
Neo4j 查询例句 MATCH (john {name: 'John'})-[:friend]->()-[:friend]->(fof) RETURN john.name, fof.na ...
- 面向对象三大特性一一继承(inheritance)和组合(Composition)
记住2句话(常识),像个正常人思考! 1.“ is-a ”关系 用 继承! 学生是人,学生继承人这个类, 2. “has-a ”关系 用 组合!电脑有显卡,那么我们就在计算机类中增加显卡属性来复用显 ...
- 'Microsoft.VisualStudio.Editor.Implementation.EditorPackage' package did not load correctly
Visual Studio 2012 Ultimate Removing "C:\Users\UserName\AppData\Local\Microsoft\VisualStudio\11 ...
- adb设置逍遥游
. adb设置模拟器属性imei.imsi.手机号.sim卡号2. adb设置充电模式3. 开启|关闭飞行模式4. 获取所有已安装程序apk路径和包名5. adb对指定设备执行指令6. 安装应用7. ...
- Mysql 多个字段查找重复数
delete FROM `test_table` WHERE id in (SELECT id,concat(user_id,user_id2) as __fFROM `test_table` whe ...
- t检验,T Test (Student’s T-Test)
1.什么是T test? t-test:比较数据的均值,告诉你这两者之间是否相同,并给出这种不同的显著性(即是否是因为偶然导致的不同) The t test (also called Student’ ...
- DDBS
distributed database system 分布式数据库系统
- 百度BAE的一些使用心得
休眠会释放单元资源停止收费,那就不用被百度收费了
- StringUtils学习
commons-lang3-3.5.jar