顯示具有 函式庫 標籤的文章。 顯示所有文章
顯示具有 函式庫 標籤的文章。 顯示所有文章

2010年12月31日 星期五

使用VISACom函式庫

  1. 註冊 GlobMgr.dll D:\Program Files\Agilent\VEE Pro 7.0>regsvr32.exe "c:\VXIPNP\VisaCom\GlobMgr.dll"
  2. 在visual stdio 2005的參考COM標籤頁中,參考 "VISA COM 3.0 Type Library"
  3. 參考 C:\VXIPNP\VisaCom\BasFrmIO.dll

如果出現錯誤訊息COMException was caught 80040154,解決辦法為

使用Regsvr32 工具(Regsvr32.exe)去註冊與註銷OLE控制項,好比DLL或ActiveX控制項是可以自我註銷的。要解決這個問題需要對Windows,Microsoft Internet Explorer, 或者其它程式進行錯誤排除的動作。

2010年3月15日 星期一

Log函式庫 - NLog

下載 NLog-VERSION-setup.exe並安裝。
開啟一個專案並選擇"Add New Item..."選項去加入NLog設定檔。
加入一個空白的NLog設定檔。在NLog設定檔的屬性中,將屬性""Copy to Output Directory"的值改為"Copy always"。
在專案中加入一個名為"Program.cs"的檔案,內容如下:

using System; 
using System.Collections.Generic; 
using System.Text; 
using NLog; 

namespace NLogExample 
{ 
    class Program 
    { 
        private static Logger logger = LogManager.GetCurrentClassLogger(); 
        
        static void Main(string[] args) 
        { 
            logger.Debug("Hello World!"); 
        } 
    } 
}

NLog.config
<br /><nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" <br />      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <br />  <targets> <br />    <target name="console" xsi:type="ColoredConsole" <br />            layout="${date:format=HH\:mm\:ss}|${level}|${stacktrace}|${message}"/> <br />    <target name="file" xsi:type="File" fileName="${basedir}/file.txt" <br />            layout="${stacktrace} ${message}"/> <br />  </targets> <br />  <rules> <br />    <logger name="*" minlevel="Trace" writeTo="console,file"/> <br />  </rules> <br /></nlog> <br />

參考Log等級
Trace - Very detailed log messages, potentially of a high frequency and volume
Debug -Less detailed and/or less frequent debugging messages
Info - Informational messages
Warn - Warnings which don't appear to the user of the application
Error - Error messages
Fatal - Fatal error messages. After a fatal error the application usually terminates.
Reference
Open source logging tools in C#
NLog-Advanced .NET Logging

參考網址