2008年9月10日 星期三

虛擬光碟軟體 for Vista

之前用的酒精 舊版的不能 for Vista了
新版的 也怪怪的 有時候還要我輸入註冊碼 所以乾脆不用

剛搜尋到 有個Tool (Daemom Tool) 可以在Vista run 虛擬光碟軟體

下載頁面在此

待會來移除 酒精 來安裝這套好了
特此紀錄一下

用Win32 API 得到 電腦名稱和登入使用者名稱

今天老闆請我找這個API

直覺就是在MSDN上鍵入 GetComputerName, 結果 竟然有這個API (會不會運氣太好了)
就研究一下 (MSDN 介紹在此)

這個 API 剛好就是我要的

Syntax

BOOL WINAPI GetComputerName(
__out LPTSTR lpBuffer,
__inout LPDWORD lpnSize
);

Parameters

lpBuffer [out]

A pointer to a buffer that receives the computer name or the cluster virtual server name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.

lpnSize [in, out]

On input, specifies the size of the buffer, in TCHARs. On output, the number of TCHARs copied to the destination buffer, not including the terminating null character.

If the buffer is too small, the function fails and GetLastError returns ERROR_BUFFER_OVERFLOW. The lpnSize parameter specifies the size of the buffer required, not including the terminating null character.

Return Value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

就這樣 滿足了老闆的要求

2008年9月9日 星期二

用WIN32 API 得到檔案最後修改時間

之前照著MSDN範例所寫的讀取檔案最後修改時間的function
被老闆發現時間怎麼會差四小時 後來仔細去看新版的MSDN 竟然多了一行

SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);

要先把UTC的時間轉換成本地的Local Time

我把function 內容貼在下方

SYSTEMTIME stUTC, stLocal;
FILETIME tmModifyTime;

GetFileTime(hFile, NULL, NULL, &tmModifyTime);
FileTimeToSystemTime(&tmModifyTime, &stUTC);

SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);

之後拿 stLocal 這個變數來用即可

紀錄一下 以免之後忘掉

2008年9月8日 星期一

晶片讀卡機終於可以在Vista中活起來了

因為最近NB燒掉了, 所以換了一台新的,結果是Vista的OS
搞了很久 軟體都裝好了 剩下這晶片讀卡機的驅動程式
我這台是很久以前辦自然人憑證送的 EzPU100, 看起來vista有內建驅動程式
但搞了很久還是在web ATM沒辦法偵測到這台讀卡機..也去官方找了vista驅動程式
正當失去信心之時
google "EzPU 100 晶片讀卡機 vista 不能用" ..
噹噹噹噹

終於找到解法 特此紀錄一下~
就是到 我的電腦上按下滑鼠右鍵管理 找到服務及應用程式/服務 裏頭
找到 智慧卡或是 smart card的這項 service
把它啟用就好啦~ 還有記得改成自動 以後重開機就不用再啟用一次
我記得XP不用這樣子搞壓~
Vista會不會為了注重security 搞得那麼難用壓!