易截截图软件、单文件、免安装、纯绿色、仅160KB

c#.net环境下添加tlb引用失败,怎么回事

发生这种问题主要是没有将typelib信息写到注册表,只要调用RegisterTypeLibServer函数则可添加相关信息,参考下面代码。
以下宏定义是我为了简化com控件开发定义的。
//-----------------------------------------------------------------
//EXPORTS
//
//DllGetClassObject       PRIVATE
//DllCanUnloadNow      PRIVATE
//DllRegisterServer        PRIVATE
//DllUnregisterServer     PRIVATE
//-----------------------------------------------------------------
#pragma once
#include <assert.h>
#include <tchar.h>
#include <strsafe.h>
#include <Shlwapi.h>
#include "streams.h"
#include <atlbase.h>
#pragma comment(lib,"winmm.lib")
//Node:If you reference baseclass library,runtime library must use mt or mtd mode,because usually we compile baseclass in mt/mtd mode.
#if defined(DEBUG) || defined(_DEBUG)
#pragma comment(lib,"strmbasd.lib")
#else
#pragma comment(lib,"strmbase.lib")
#endif
#define BEGIN_COM_DECLARE \
extern HMODULE g_hModule = NULL;\
CFactoryTemplate g_Templates[] = \
{
#define END_COM_DECLARE(clsid,version,libraryname) \
};\
const int CLSID_STRING_SIZE = 39 ;\
void CLSIDtoString(const CLSID& clsid, TCHAR* szCLSID, int length)\
{\
 assert(length >= CLSID_STRING_SIZE) ;\
 LPOLESTR wszCLSID = NULL ;\
 HRESULT hr = StringfromCLSID(clsid, &wszCLSID) ;\
 assert(SUCCEEDED(hr)) ;\
 lstrcpy(szCLSID,wszCLSID);\
 CoTaskMemFree(wszCLSID) ;\
}\
LONG DeleteKey(HKEY hKeyParent, const TCHAR* lpszKeyChild)\
{\
 HKEY hKeyChild ;\
 LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,KEY_ALL_ACCESS, &hKeyChild) ;\
 if (lRes != ERROR_SUCCESS)\
 {\
  return lRes ;\
 }\
 FILETIME time ;\
 TCHAR szBuffer[256] ;\
 DWORD dwSize = 256 ;\
 while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,NULL, NULL, &time) ==


相关文档:

C# Active控件,并触发javascript事件

创建一个Winform用户控件 UserControl1
 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace MyActiveT ......

C#使用SQLDMO实现对MSSQL数据库进行备份和恢复

public sealed class DbOper
{
     ///<summary>
     /// DbOper类的构造函数
     ///</summary>
     private DbOper()
     {
     }
     ......

C#中C/C++程序员注意问题

1、C/C++程序员请注意,不能在case语句不为空时“向下执行”。
2、值类型和引用类型之间的区别:C#的基本类型(int,char等)都是值类型,是在栈中创建的。而对象是引用类型,创建于堆中,需要使用关键字new。
3、在C#中通过实例访问静态方法或成员变量是不合法的,会生成编译器错误。但是我们可以通过声明他们 ......

C#调用DLL (strmagic)

  大家在实际工作学习C#的时候,可能会问:为什么我们要为一些已经存在的功能(比如Windows中的一些功能,C++中已经编写好的一些方法)要重新编写代码,C#有没有方法可以直接都用这些原本已经存在的功能呢?答案是肯定的,大家可以通过C#中的DllImport直接调用这些功能。
  DllImport所在的名字空间 using System.Runt ......

ArcEngine 图例C#源码:

private void MakeLegend(IActiveView activeView,IPageLayout pageLayout)
      {
          //定义图例UID对象
          UID uid = new UIDClass();
      &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号