SuperBug

博客园 首页 联系 订阅 管理

2012年6月20日

摘要: 前面写的系列还没有发布,没有数字证书,还不算真正能部署在服务器上的ActiveX控件,想要部署成真正的ActiveX控件,请继续往下看。选择安装与部署选择主输出项目选择注册的类型点击生成生成后debug文件夹中有该文件修改install。inf信息下面是dos下的命令 阅读全文
posted @ 2012-06-20 18:40 SuperBug 阅读(430) 评论(0) 推荐(0) 编辑

2012年6月14日

摘要: using System;using System.Collections.Generic;using System.Text;using System.Threading;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { Thread newThread = new Thread(test); newThread.Start("para input"); newThread =... 阅读全文
posted @ 2012-06-14 17:31 SuperBug 阅读(214) 评论(0) 推荐(0) 编辑

摘要: using System;using System.Threading;class Test{ static void Main() { // To start a thread using a static thread procedure, use the // class name and method name when you create the ThreadStart // delegate. Beginning in version 2.0 of the .NET Framework, // it is no... 阅读全文
posted @ 2012-06-14 16:40 SuperBug 阅读(281) 评论(0) 推荐(0) 编辑

2012年6月13日

摘要: 1.添加安全接口2.安全接口源代码namespace WindowsControlLibrary1{ [ComImport, GuidAttribute("CB5BDC81-93C1-11CF-8F20-00805F2CD064")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] public interface IObjectSafety { [PreserveSig] int GetInterfaceSafetyOptions(ref Guid riid, ... 阅读全文
posted @ 2012-06-13 18:43 SuperBug 阅读(878) 评论(0) 推荐(0) 编辑

摘要: 步骤1:新建工程第二步:勾选Make assembly com-visible第三步:勾选Register for com interop第四步:定义接口,注意接口的属性需要为public。(右键工程,添加一个接口Item即可)using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;namespace WindowsControlLibrary1{ [ComVisible(true)] [Guid("C2918110-A1C4-4188-. 阅读全文
posted @ 2012-06-13 01:18 SuperBug 阅读(1599) 评论(0) 推荐(0) 编辑

2012年6月11日

摘要: 1.char* 转换成 LPCTSTRchar ch[1024] = "wo shi ni baba";int num = MultiByteToWideChar(0,0,ch,-1,NULL,0);wchar_t *wide = new wchar_t[num];MultiByteToWideChar(0,0,ch,-1,wide,num);解析:num 获得长字节所需的空间MultiByteToWideChar()表示将s中的字符传递到ps指向的内存中。-1表示传输至s中的'\0'处,num表示传递的字节个数。2.LPCTSTR 转换成 char *wc 阅读全文
posted @ 2012-06-11 11:33 SuperBug 阅读(23689) 评论(1) 推荐(3) 编辑

2012年6月9日

摘要: 第一步:如上图,点击确定,输入名称后点击完成第二步:如图,其中_Dtest是接口,可以添加属性和接口函数。_DtestEvents是事件接口。右键点击_Dtest可以添加属性和方法。右键点击CtestCtrl可以添加事件。添加后的属性和接口在控件外调用使用在是_Dtest中显示的。而控件内部的实现代码在CtestCtrl中。注:属性和方法相当于接口,而接口必须是有通用的标准,否则就不能跨平台使用。例如C++中有char *表示字符串,C#中是string表示字符串,为了双方能够通过接口交流所以接口中在字符串类型为BSTR. 阅读全文
posted @ 2012-06-09 21:38 SuperBug 阅读(199) 评论(0) 推荐(0) 编辑