通用的關於對話方塊

2021-08-26 16:18:56 字數 1253 閱讀 2468

每當完成乙個軟體作品的時候,我們需要乙個about對話方塊!

為了省去這樣的重複工作,我們有必要製作乙個通用的關於對話方塊!

根據他們的共性,可以分兩部分:

一、單位資訊

二、程式資訊

程式資訊:主要為此程式對計算機硬體需求、計算機軟體需求和程式版本。

為了美觀,可以在對話方塊左上方,放乙個logo!

整體的窗體布局圖,如下圖,所示:

在程式實現部分,需要填寫開啟**和主程式版本號。

開啟**需要使用win32函式shellexecute;

他的原型為:

hinstance shellexecute(

__in_opthwnd hwnd,

__in_optlpctstr lpoperation,

__inlpctstr lpfile,

__in_optlpctstr lpparameters,

__in_optlpctstr lpdirectory,

__inint nshowcmd

);

**如下:

shellexecute(handle, nil, pchar(label10.caption), nil, nil, sw_shownormal);

讀取程式版本號,需要使用如下函式:

1. getfileversioninfo

函式原型:

bool winapi getfileversioninfo(

__inlpctstr lptstrfilename,

__reserveddword dwhandle,

__indword dwlen,

__outlpvoid lpdata

);

2. verqueryvalue

函式原型:

bool winapi verqueryvalue(

__inlpcvoid pblock,

__inlpctstr lpsubblock,

__outlpvoid *lplpbuffer,

__outpuint pulen

);

3. getmodulefilename

dword winapi getmodulefilename(

__in_opthmodule hmodule,

__outlptstr lpfilename,

__indword nsize

);

具體**u_about.pas

關於對話方塊

1.1 一般new的時候在初始化的時候,而進行銷毀的時候是在程式退出的時候。1.2 就如windows中的,在init函式進行new操作然後在onclose函式中進行delete操作。1.3 注意 在沒有不得已的時候不要在標頭檔案中包含其他標頭檔案,這是非常之高危險的事情,盡量的使用前置宣告。1.4...

API通用對話方塊

include include include include include 7 5.h openfilename ofn 定義乙個openfilename結構 hinstance hinst lresult callback wndproc hwnd,uint,wparam,lparam int...

使用通用對話方塊

5.7 使用通用對話方塊 在windows系統中提供了一些通用對話方塊如 檔案選擇對話方塊 如圖,顏色選擇對話方塊 如圖,字型選擇對話方塊 如圖。在mfc中使用cfiledialog,ccolordialog,cfontdialog來表示。一般來講你不需要派生新的類,因為基類已經提供了常用的功能。而...