BCB日常使用小集錦

如有疑問,請聯繫 [email protected]

以下爲我的日常筆記,整理出來,供大家分享。


1、BCB 編輯快捷鍵

左/右移 塊代碼

選中 塊代碼
1 CTRL+ SHIFT+ I 是整片往右移,
2 CTRL+ SHIFT+ U 是整片文字往左移

2、得到執行程序的當前路徑

ExtractFileDir(Application->ExeName);


3、循環中響應其它操作

在循環內加入Application->ProcessMessage()這一句。

4、向外部提供dll函數標準windows格式

extern "C" __declspec(dllexport) __stdcall __int32 Fun(__int32 n32_i);

5、從外部dll輸入函數標準windows格式

extern "C" __declspec(dllimport) __stdcall __int32 Fun(__int32 n32_i);

6、對DLL的調試

RUN/PARAMETERS 中填上調用該DLL的 *.exe。

7、使用*.chm幫助文件

ShellExecute(NULL,NULL,幫助文件的路徑,NULL,NULL,SW_SHOWNORMAL);


8、PB_C數據類型轉換表

PB_C數據類型轉換表 MICROSOFT PB(16Bit) PB(32Bit)
Bool Boolean Boolean
Byte, Char Char Char
Char* Ref string Ref String
Colorref Uint Ulong
Double Double Double
Dword Uint Ulong
Float N/A N/A
Handle Uint Ulong
Hdc Uint Ulong
Hfile Uint Ulong
Hinstance Uint Ulong
Hwnd Uint Ulong
Int Int Int
Long Long Long
Lparam Uint Ulong
Lpbyte Ref Int Ref Long
Lpcwstr Ref Blob Ref Blob (Unicode use ToUnicode())
Lpcvoid Ref String Ref String
Lpdword Ref Uint Ref Ulong
Lpfiletime Ref Time Ref Time
Lpint Ref Int Ref Long
Lpstr,Lpcstr Ref String Ref String
Lpvoid Ref Structstruct_inst Ref Struct struct_inst
Lpword Ref Int Ref Ulong
Mcierror Long Long
Pbyte Ref Int[#] Ref Long[#]
Short Int Int
Structure Ref Struct struct_inst Ref Struct Struct_inst
Uint Uint Uint
Void** SUBROUTINE SUBROUTINE
Word Int Long
Wparam Uint Ulong






9、使用CB內存漏洞工具

選中Progect/Option->CodeGuard

支持環境CG32.LIB/CG32.DLL

10、MFC基本運行庫目錄
mfc42.dll
MFC42D.DLL
MFCD42D.DLL
MFCN42D.DLL
MFCO42D.DLL
MSVCP60.DLL
MSVCP60D.DLL
MSVCRTD.DLL
NTDLL.DLL


11、數據庫連接測試(ADO)

建一文件,TestDataBase.udl,內容空。
雙擊,按照提示操作。


12、編譯器設置

Project|Options

Compiler(編譯)
"Full debug"(完全調試模式)
"Code optimization"(代碼優化)

"debugging"(調試)
"Debug information"(調試信息)
"Line number information"(行數信息)
"Disable inline expansions"(禁用內聯擴展)

"Pascal"標籤

"Optimization"優化
"debugging"(調試)

"Linker"(鏈接)
"Create debug information"(生成調試信息)
"Don’t generate state files"(不要生成狀態文件)
"Use dynamic RTL"(使用動態RTL)

"Directories/Conditionals"(路徑/條件)

"Packages"(程序包)
"Build with runtime packages"(帶運行時程序包編譯)


Tools|Debugger Options
Integrated debugging"(集成調試器)

Project|Build All(徹底的編譯)



13、設置RTL

C builder 有幾種運行時庫,多線程靜態鏈接庫,單線程靜態鏈接庫 以及動態的,含有

VCL的,下面介紹多線程靜態鏈接庫,單線程靜態鏈接庫 是沒有VCL的,VCL中自動 包含多線程。

Use RTL multi-threaded static library 使用多線程靜態鏈接庫

到*.bpr 中,按下面的修改即可。
<CFLAG1 value="-tWD -tWM -Od -H=$(BCB)libvcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>

Use RTL single-threaded static library 使用單線程靜態鏈接庫

到*.bpr 中,按下面的修改即可。

<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32.lib"/>

14、CODEGUARD調試器

庫文件CG32.LIB/CG32.DLL
一、編譯 (Project/Option-> CodeGuard)
二、運行(Tools/CodeGuard Configuration)
文件爲*.CGI
日誌文件中,文件名爲 *.CGI。用 View/Debug Window/CodeGuard Log察看或者記事本。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章