2012/07/30

ProcessInfo 1.5 is released with Win64 support

想取得程序的Handle等其它資訊還蠻好用的

ProcessInfo 1.5 is released with Win64 support

Posted on September 12th, 2011 Ali Keshavarz 5 comments
ProcessInfo 1.5 is released. The changes in this release are:
  • Added support for Win64 and Delphi XE2.
  • Added TProcessItem.CloseProcess method to close a process normally (not forcefully).
  • Added TProcessItem.CurrentProcess property. This property always refers to the current process in the list of running processes.
  • Added PrivateWorkingSetSize property to TProcessItem.MemoryInfo.
  • Added global  ProcessInformation function. This function returns a global instance of TProcessInfo. The instance will be freed when the application is terminating.
  • Fixed a few minor bugs.
To download ProcessInfo 1.5, please go to ProcessInfo page.


2012/07/25

SQL Server月份相減跨年度的計算方法

SET @YY='2012'
SET @MM='03'
SET @MM=@MM - 5

  IF @MM <= 0
  BEGIN
      SET @YY=@YY - 1
      SET @MM=@MM + 12
  END

雖然好像有更好的作法,但找到之前還是將就點吧

2012/07/23

Open dbExpress 安裝

http://sourceforge.net/projects/open-dbexpress/files/dbxoodbc%202012%20-%20dbx%20ODBC%20driver/dbxoodbc_3_2012_0716dev.7z/download

一、首先是先安裝bpl到RAD Studio裡面
dbxoodbc\lib\{%DelphiVersion%}\dbxoodbc*.bpl
以XE2來看的話,就會是在「dbxoodbc\lib\delphi-2012(16)XE2\win32」(32bit)目錄裡面

二、接下來再把dbxoodbc\lib\dbxoodbc_driver\(%Platform%)\release目錄裡的相關檔案複製到系統路徑
以Win32系統為例,就是把「dbxoodbc\lib\dbxoodbc_driver\win32\release」複製到Delphi安裝目錄裡的bin資料夾下,也就是「{%DELPHI}\Bin」

三、接下來是要註冊 dbxconnections.ini 及 dbxdrivers.ini
說真的,這兩個檔案不是放在特定資料夾中,常常會找不到它們
以我的XE2為例,它們是放置在「c:\users\public\documents\RAD Studio\dbExpress\9.0」目錄中,如果你的電腦沒有的話,可以在底下的機碼中尋找「[HKEY_CURRENT_USER\Software\Embarcadero\BDS\9.0\DBExpress」

台灣大多數的人都是用SQL Server,所以我們就以它的設定為範本:
===dbxconnections.ini===
;--------------------------------------------------------------------------------------------------
[dbxoodbc_SS_DirectMode]
DriverName=DbxSQLServer
GetDriverFunc=getSQLDriverODBCW
VendorLib=sqlsrv32.dll;sqlncli10.dll;sqlncli.dll;odbc32.dll
Trusted_Connection=No
User_Name=name
Password=secret
BlobSize=-1
RowsetSize=20
OpenOdbc TransIsolation=ReadCommited
Trim Char=True
Database=?
ConnectionString=coCatPrefix=DATABASE;SERVER=?
MetaDataPackageLoader=TDBXOpenODBCMetaDataCommandFactoryMSSQL
DriverPackageLoader=TDBXDynalinkDriverLoaderOpenOdbc
;--------------------------------------------------------------------------------------------------
===dbxdrivers.ini===
[Installed Drivers]
DbxSQLServer=1
;--------------------------------------------------------------------------------------------------
[DbxSQLServer]
LibraryName=dbxoodbc.dll
ProductName=DbxOpenODBC
DriverUnit=Dbx34Drv
MetaDataPackageLoader=TDBXOpenODBCMetaDataCommandFactoryMSSQL
DriverPackageLoader=TDBXDynalinkDriverLoaderOpenOdbc
DbxSQLServer TransIsolation=ReadCommited
GetDriverFunc=getSQLDriverODBCW
VendorLib=sqlsrv32.dll;sqlncli10.dll;sqlncli.dll;odbc32.dll
DATABASE=(Database Name)
Trusted_Connection=YES
User_Name=
Password=
ConnectionString=coCatPrefix=DATABASE;Server=(Server Name)

[DbxSQLServer TransIsolation]
DirtyRead=0
ReadCommited=1
RepeatableRead=2
;--------------------------------------------------------------------------------------------------
四、接下來我們要在bpr裡面,增加一個uses模組項目:
uses DbxXXDrv, ...

五、開啟XE2並建立一個新專案,再drop一個TSQLConnection到裡面,設定
ConnectionName = dbxoodbc_SS_DirectMode
LoginPrompt = False
接下來要注意的是
Params裡面的項目
============
DriverName=DbxSQLServer
GetDriverFunc=getSQLDriverODBCW
VendorLib=sqlsrv32.dll;sqlncli10.dll;sqlncli.dll;odbc32.dll
Trusted_Connection=No
User_Name=name
Password=secret
BlobSize=-1
RowsetSize=20
OpenOdbc TransIsolation=ReadCommited
Trim Char=True
Database=?
ConnectionString=coCatPrefix=DATABASE;SERVER=?
MetaDataPackageLoader=TDBXOpenODBCMetaDataCommandFactoryMSSQL
DriverPackageLoader=TDBXDynalinkDriverLoaderOpenOdbc
=============

Web page design tool in Delphi

Delphi 在2009 版開始把 WebSnap 廢棄後,自此就再也沒有自帶「網頁設計工具」。 有的話也只剩下自帶的 IntraWeb Evolution 版本。 以及 3rd party 的 UniGui 等類似 IntraWeb 的 Web Application ...