首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C# DLL regsvr32 登记找不到入口,这是为什么

2012-10-27 
C# DLL regsvr32 注册找不到入口,这是为什么?是不是什么地方要设置,请帮忙弄下好吗?C# codeusing Systemu

C# DLL regsvr32 注册找不到入口,这是为什么?
是不是什么地方要设置,请帮忙弄下好吗?

C# code
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.InteropServices;using System.IO;namespace ZBarcode{    public class RawPrintHelper    {        // Structure and API declarions:        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]        public class DOCINFOA        {            [MarshalAs(UnmanagedType.LPStr)]            public string pDocName;            [MarshalAs(UnmanagedType.LPStr)]            public string pOutputFile;            [MarshalAs(UnmanagedType.LPStr)]            public string pDataType;        }        [DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]        public static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);        [DllImport("winspool.Drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]        public static extern bool ClosePrinter(IntPtr hPrinter);        [DllImport("winspool.Drv", EntryPoint = "StartDocPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]        public static extern bool StartDocPrinter(IntPtr hPrinter, Int32 level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);        [DllImport("winspool.Drv", EntryPoint = "EndDocPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]        public static extern bool EndDocPrinter(IntPtr hPrinter);        [DllImport("winspool.Drv", EntryPoint = "StartPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]        public static extern bool StartPagePrinter(IntPtr hPrinter);        [DllImport("winspool.Drv", EntryPoint = "EndPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]        public static extern bool EndPagePrinter(IntPtr hPrinter);        [DllImport("winspool.Drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]        public static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, Int32 dwCount, out Int32 dwWritten);        // SendBytesToPrinter()        // When the function is given a printer name and an unmanaged array        // of bytes, the function sends those bytes to the print queue.        // Returns true on success, false on failure.        public static bool SendBytesToPrinter(string szPrinterName, IntPtr pBytes, Int32 dwCount){。。。}


[解决办法]
使用regasm将其向COM注册,JS下可调用该COM
http://msdn.microsoft.com/zh-cn/library/h627s4zy(v=vs.100).aspx

[解决办法]
C#写的dll其实是被称作类库(Class Library)的东西的。跟Windows组件不太一样的说……
[解决办法]
原来C#的dll还可以这样注册呢?学了一招
[解决办法]
VS 的C# 的DLL 是指令集啊,你只需装.NET 包啦, 不要那个注册的,你构建的环境支持不够。。
[解决办法]
托管dll不能注册,非托管的才可能行
[解决办法]
呃,最近也在研究这块,貌似托管代码和上面那中注册可以,但是用regsvr32 注册的话都是一些指定的dll,托管的直接在类库中引用就可以

热点排行