Recent Comments

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

顯示具有 BCB 標籤的文章。 顯示所有文章
顯示具有 BCB 標籤的文章。 顯示所有文章

2014年1月21日 星期二

wwDBLookupCombo動態設定打開下拉選單時要顯示的內容

一般來說可以直接在屬性欄位中的selected中就可以設定要顯示的欄位內容
但因為在不同的資料表共用一個元件時,會因為不同的資料表欄位
而造成要動態去設定要顯示的內容,在切換時先clear,把之前的設定清除
然後用append或add去把後面的字串加入
lcn是欄位名稱
10是要顯示的欄位寬

以下的設定中有很多的\t \r \n這些,目前主要是直接看在屬性欄位設定好後所抓出的字串
wwDBLookupCombo->Selected->Clear();
wwDBLookupCombo->Selected->Append("lcn\t10\tlcn\t\t\r\n");
wwDBLookupCombo->Selected->Append("road_name\t40\troad_name\t\t\r\n");


實際測試最少要在欄位名稱和欄位寬的中間加入\t即可
wwDBLookupComboAddEquipmentLcn->Selected->Clear();
wwDBLookupComboAddEquipmentLcn->Selected->Append("lcn\t10\tlcn");
wwDBLookupComboAddEquipmentLcn->Selected->Append("road_name\t40\tnroad_name");




2014年1月16日 星期四

[BCB]找出同一層內的Component

找出同一層內的Component
於function可以再定義要找的Component type

this->test(this->GroupBox1);
======================================================
void TForm1::test(TWinControl* pObj)
{
    for (unsigned short int i=0 ; iControlCount ; i++)
    {
            if (String(pObj->Controls[i]->ClassName())==”TEdit”)
            {
                ((TEdit *)pObj->Controls[i])->Text = “get it”;
            }
            if (String(pObj->Controls[i]->ClassName())==”TLabel”)
            {
                ((TEdit *)pObj->Controls[i])->Text = “get it”;
            }
    }
}

2012年8月15日 星期三

找出重疊的元件


.cpp
//---------------------------------------------------------------------------

#include
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::___TEST(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
int I;
TPoint pt;
TStringList *L = new TStringList;
GetCursorPos(&pt);
pt = this->ScreenToClient(pt);
for (I=0; I if (!Controls[I]->ClassNameIs("TPaintBox")){
continue;
}
if (!PtInRect(Controls[I]->BoundsRect , pt)){
continue;
}
L->Add(Controls[I]->Name);
}
ListBox1->Items->Text = L->Text;
delete L;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::PaintBox1Paint(TObject *Sender)
{
TPaintBox  *tPbx =((TPaintBox *)Sender);
tPbx->Canvas->Rectangle(0,0,tPbx->Width,tPbx->Height);
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
for (int I=0; I if (!Controls[I]->ClassNameIs("TPaintBox")){
continue;
}
((TPaintBox*)Controls[I])->OnMouseDown = ___TEST;
}
}
//---------------------------------------------------------------------------

====================================================
.h
//---------------------------------------------------------------------------

#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include
#include
#include
#include
#include
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published: // IDE-managed Components
TPaintBox *PaintBox1;
TPaintBox *PaintBox2;
TPaintBox *PaintBox3;
TListBox *ListBox1;
TButton *Button1;
void __fastcall PaintBox1Paint(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);

private: // User declarations
void __fastcall ___TEST(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
public: // User declarations
__fastcall TForm2(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif

2012年8月6日 星期一

移動滑鼠執行事件


  SetCursorPos(30,30);
mouse_event(MOUSEEVENTF_LEFTDOWN,30,30,NULL,NULL);
mouse_event(MOUSEEVENTF_LEFTUP,30,30,NULL,NULL);
mouse_event(MOUSEEVENTF_LEFTDOWN,30,30,NULL,NULL);
mouse_event(MOUSEEVENTF_LEFTUP,30,30,NULL,NULL);

2008年3月10日 星期一

DWORD和dword到底有什麼不同?

DWORD:32bit的 unsigned long

這適合各種作業系統喔

我們開啟「登錄編輯器」或「登錄編輯程式」之後,若我們想增加一個DWORD值,我們可以在右側視窗按下滑鼠右鍵,選"新增"-->"DWORD值",再依自己需要新增DWORD值,這樣新增DWORD值的工作就算是結束了。

可是我們要自己寫一個DWORD值的登錄檔,我們卻必須這樣寫
"新增之DWORD值"=dword:00000001
或
"新增之DWORD值"=dword:1

但是,我們卻「不可以」這樣寫
"新增之DWORD值"=DWORD:00000001
或
"新增之DWORD值"=DWORD:1

這是因為Windows Registry只認識dword,卻不認識DWORD的緣故。
所以您若寫一個登錄檔如下
REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoRun"=DWORD:00000000
然後儲存檔案時以reg為副檔名,執行並增加登錄的話。外表看起來,「好像」是已經增加登錄了,可是實際上因為Windows Registry不認識DWORD,所以您的「增加登錄」動作還是「失敗」囉。

請注意:
寫一個dword值的登錄檔時,必須全部用小寫的dword,若其中一個英文字母不是小寫的話,您是無法順利「增加登錄」的。

希望這篇文章能夠讓您進一步認識Windows登錄檔喔。

2008年3月5日 星期三

BCB include 後加不加.h

把.h從header files 拿掉的不是 ANSI C, 而是 ANSI C++。ANSI C++引進 name space 的機制,將所有的全域宣告都放在 std 這個 name space 下;為了要向下相容 C 及非標準 C++ 的程式碼,所以保留了帶有 .h 的 header files。

====@一@=======================
#include
using namespace std;

std::vector test;

====@二@=======================
#include

vector test;