The Final Sky
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.

The Final Sky

Exam 4rum
 
Trang ChínhTrang Chính  Latest imagesLatest images  Tìm kiếmTìm kiếm  Đăng kýĐăng ký  Đăng Nhập  

 

 Breakpoint và Win API Details

Go down 
Tác giảThông điệp
Admin
Admin
Admin


Tổng số bài gửi : 34
Join date : 03/07/2010

Breakpoint và Win API Details Empty
Bài gửiTiêu đề: Breakpoint và Win API Details   Breakpoint và Win API Details EmptyFri Jul 09, 2010 6:48 pm

EnableMenuItem
Hàm EnableMenuItem có nhiệm vụ enable, disable, hay gray 1 item nào đó trong menu

Code:

BOOL EnableMenuItem(

HMENU hMenu,_________________// handle of menu

UINT uIDEnableItem,____________// menu item to enable, disable, or gray

UINT uEnable__________________// menu item flags

);

Returns
Giá trị trả về sẽ chỉ rõ trạng thái trước đó của menu item (đó là MF_DISABLED, MF_ENABLED hay MF_GRAYED). Nếu menu item không tồn tại, giá trị trả về sẽ là 0xFFFFFFFF

EnableWindow
Hàm EnableWindow có nhiệm vụ enable hoặc disable chuột và bàn phím input vào specified window hoặc control. Khi input bị disable, window không thể nhận input như click chuột và gõ phím. Khi input enable, window nhận tất cả input

Code:

BOOL EnableWindow(

HWND hWnd,________________// handle of window

BOOL bEnable_______________// flag for enabling or disabling input

);

Returns
Nếu window đã bị disable, giá trị trả về là TRUE, ngược lại giá trị trả về là FALSE. Để biết thông tin về lỗi, chúng ta dùng lệnh GetLastError.

03.2 Dialog Boxes
===========
CreateDialogIndirectParamA / CreateDialogIndirectParamW
Hàm CreateDialogIndirectParamA có nhiệm vụ tạo ra modeless dialog box từ dialog box template trong memory. Trước khi display dialog box, function sẽ pass program-defined value vào dialog box procedure giống như thông số Iparam của WM_INITDIALOG message. Chương trình có thể sử dụng giá trị này để initialize (chạy) dialog box controls

Code:

HWND CreateDialogIndirectParam(

HINSTANCE hInstance,______________// handle of application instance

LPCDLGTEMPLATE lpTemplate, ________// address of dialog box template

HWND hWndParent,________________// handle of owner window

DLGPROC lpDialogFunc,_____________// address of dialog box procedure

LPARAM lParamInit_________________// initialization value

);

Returns
Nếu function succeed (tạm dịch là hoàn thành), giá trị trả về là handle của dialog box. Còn nếu function fail (không hoàn thành), giá trị trả về là NULL, giá trị là 0xFFFFFFFF

CreateDialogParamA / CreateDialogParamW
Hàm CreateDialogParamA có nhiệm vụ tạo ra modeless dialog box từ dialog box template resource. Trước khi display dialog box, function sẽ pass program-defined value vào dialog box procedure giống như thông số Iparam của WM_INITDIALOG message. Chương trình có thể sử dụng giá trị này để initialize dialog box controls

Code:

HWND CreateDialogParam(

HINSTANCE hInstance,____________// handle of application instance

LPCTSTR lpTemplateName, _________// identifies dialog box template

HWND hWndParent,_____________ // handle of owner window

DLGPROC lpDialogFunc,___________// address of dialog box procedure

LPARAM dwInitParam ____________// initialization value

);

Returns
Nếu window bị disable, giá trị trả về là TRUE, ngược lại giá trị trả về là FALSE. Để biết thông tin về lỗi, chúng ta dùng lệnh GetLastError

DialogBox
Hàm DialogBox có nhiệm vụ tạo ra modal dialog box từ dialog box template resource. DialogBox không return control cho đến khi specified callback function kết thúc modal dialog box bằng cách gọi EndDialog

Code:

int DialogBox(

HANDLE hInstance,__________________ // handle of application instance

LPCTSTR lpTemplate,_________________// identifies dialog box template

HWND hWndParent,_________________// handle of owner window

DLGPROC lpDialogFunc ______________// address of dialog box procedure

);

Returns
Nếu function hoàn thành, giá trị trả về là thông số nResult trong lệnh call EndDialog được dùng để kết thúc dialog box. Nếu function không hoàn thành, giá trị trả về là -1

DialogBoxIndirect
Hàm DialogBoxIndirect có nhiệm vụ tạo ra modal dialog box từ dialog box template trong memory.

Code:

int DialogBoxIndirect(

HANDLE hInstance,___________________// handle of application instance

LPDLGTEMPLATE lpTemplate,____________// identifies dialog box template

HWND hWndParent,__________________// handle of owner window

DLGPROC lpDialogFunc _______________// address of dialog box procedure

);

Returns
Giá trị trả về là giá trị của thông số nResult trong lệnh EndDialog được dùng để kết thúc dialog box. Giá trị trả về là -1 nếu function không tạo được dialog box

DialogBoxParam / DialogBoxParamA / DialogBoxParamW
Hàm DialogBoxParam có nhiệm vụ tạo ra modal box từ dialog box template resource. Trước khi display dialog box, function sẽ pass program-defined value vào dialog box procedure giống như thông số Iparam của WM_INITDIALOG message. Chương trình có thể sử dụng giá trị này để initialize dialog box controls

Code:

int DialogBoxParam(

HINSTANCE hInstance,___________// handle of application instance

LPCTSTR lpTemplateName, ________// identifies dialog box template

HWND hWndParent,______________// handle of owner window

DLGPROC lpDialogFunc,___________// address of dialog box procedure

LPARAM dwInitParam ____________// initialization value

);

Returns
Nếu function hoàn thành, giá trị trả về là thông số nResult trong lệnh call EndDialog được dùng để kết thúc dialog box. Nếu function không hoàn thành, giá trị trả về là -1

EndDialog
Hàm này có nhiệm vụ destroy modal dialog box, “ra lệnh” cho system kết thúc bất kỳ processing liên quan đến dialog box

Code:

BOOL EndDialog(

HWND hDlg,_______________// handle of dialog box

int nResult _______________// value to return

);

Returns
Nếu function hoàn thành, giá trị trả về là TRUE. Nếu function không hoàn thành, giá trị trả về là FALSE

MessageBeep
Hàm MessageBeep có nhiệm vụ phát waveform sound. Waveform sound cho mỗi loại âm thanh được nhận biết bằng lối vào trong sound section (khay âm thanh) của registry

Code:

BOOL MessageBeep(

UINT uType______________// sound type

);

Returns
Nếu function hoàn thành, giá trị trả về là TRUE. Nếu function không hoàn thành, giá trị trả về là FALSE. Để biết thông tin về lỗi, chúng ta dùng lệnh GetLastError

MessageBoxA / MessageBoxW
Hàm này có nhiệm vụ tạo ra, display, và operate(làm cho hoạt động) message box. Message box gồm có program-defined message và title cộng thêm 1 vài sự kết hợp của predefined icon và push button

Code:

int MessageBox(

HWND hWnd,_______________// handle of owner window

LPCTSTR lpText,______________// address of text in message box

LPCTSTR lpCaption,____________// address of title of message box

UINT uType__________________// style of message box

);

Returns
Giá trị trả về là 0 nếu không có đủ memory để tạo message box. Nếu function hoàn thành, giá trị trả về là một trong những giá trị đã returned bởi dialog box :
IDABORT, IDCANCEL, IDIGNORE, IDNO, IDOK, IDRETRY, IDYES
Nếu message box có nút Cancel, giá trị trả về là IDCANCEL nếu nhấn phím Esc hoặc chọn Cancel button. Nếu message box không có nút Cancel, nút Esc sẽ không có tác dụng

MessageBoxExA / MessageBoxExW
Hàm này có nhiệm vụ tạo ra, display, và operate(làm hoạt động) message box. Message box gồm có program-defined message và title cộng thêm 1 vài sự kết hợp của predefined icon và push button. Thông số wLanguageId set language resource được dùng để predefined push button

Code:

int MessageBoxEx(

HWND hWnd,________________// handle of owner window

LPCTSTR lpText, _____________// address of text in message box

LPCTSTR lpCaption,___________// address of title of message box

UINT uType,_________________// style of message box

WORD wLanguageId___________// language identifier

);

Returns
Nếu function hoàn thành, giá trị trả về là giá trị menu-item khác 0 đã returned bởi dialog box

MessageBoxIndirect / MessageBoxIndirectA / MessageBoxIndirectW
Hàm MessageBoxIndirect có nhiệm vụ tạo ra, display, và làm hoạt động message box. Message box gồm có program-defined message text và title, icons, và 1 vài sự kết hợp của predifined push button

Code:

BOOL API MessageBoxIndirect(

LPMSGBOXPARAMS lpMsgBoxParams____// address of structure for msg box parameters

);

03.3 Drive Type Checks
==============
CreateFileA / CreateFileW
Hàm CreateFile có nhiệm vụ tạo ra, mở, hoặc truncate file, pipe(đường dẫn), communication resource, disk device hoặc console. Nó return handle mà có thể được dùng để access (truy cập) object (đối tượng). Nó cũng có thể mở và return handle to directory

Code:

HANDLE CreateFile(

LPCTSTR lpFileName,_________________________// address of name of the file

DWORD dwDesiredAccess,_____________________// access (read-write) mode

DWORD dwShareMode,_______________________// share mode

LPSECURITY_ATTRIBUTES lpSecurityAttributes,_____// address of security descriptor

DWORD dwCreationDistribution,________________// how to create

DWORD dwFlagsAndAttributes,_________________// file attributes

HANDLE hTemplateFile _______________________// handle of file with attributes to copy

);

Returns
Nếu function hoàn thành, giá trị trả về là open handle của specified file. Nếu specified file không tồn tại trước khi function gọi và dwCreationDistribution là CREATE_ALWAYS hoặc OPEN_ALWAYS, lệnh gọi GetLastError trở về ERROR_ALREADY_EXISTS (ngay cả khi function đã hoàn thành). Còn nếu file tồn tại trước khi gọi, GetLastError trả về 0
Nếu function không hoàn thành , giá trị trả về là INVALID_HANDLE_VALUE. Để có thông tin về lỗi, chúng ta dùng lệnh GetLastError

GetDiskFreeSpaceA / GetDiskFreeSpaceW
Hàm GetDiskFreeSpace có nhiệm vụ tìm thông tin về specified disk, kể cả dung lượng trống trên đĩa

Code:

BOOL GetDiskFreeSpace(

LPCTSTR lpRootPathName,_____________// address of root path

LPDWORD lpSectorsPerCluster,_________// address of sectors per cluster

LPDWORD lpBytesPerSector,___________// address of bytes per sector

LPDWORD lpNumberOfFreeClusters,___// address of number of free clusters

LPDWORD lpTotalNumberOfClusters___// address of total number of clusters

);

Returns
Nếu function hoàn thành, giá trị trả về là TRUE. Nếu function không hoàn thành, giá trị trả về là FALSE. Để có thông tin về lỗi, chúng ta dùng lệnh GetLastError

GetDriveTypeA / GetDriveTypeW
Hàm này có nhiệm vụ xác định xem có disk drive là removable, fixed, CD-ROM, RAM disk, hoặc network drive không

Code:

UINT GetDriveType(

LPCTSTR lpRootPathName_________________// address of root path

);

Returns
0 Drive không thể xác định được
1 Drive không thể xác định được
2 Root Directory không tồn tại
3 Fixed Drive (hardware)
4 Remote Drive (network)
5 CD-ROM Drive
6 RAM-Disk ( chỉ với GetDriveTypeA )

GetFullPathNameA / GetFullPathNameW
Hàm GetFullPathName có nhiệm vụ tìm đường dẫn đầy đủ và tên của specified file

Code:

DWORD GetFullPathName(

LPCTSTR lpFileName, ____________// address of name of file to find path for

DWORD nBufferLength,__________// size, in characters, of path buffer

LPTSTR lpBuffer,________________// address of path buffer

LPTSTR *lpFilePart _____________// address of filename in path

);

Returns
Nếu function được hoàn thành, giá trị trả về là độ dài (chỉ tính kí tự chữ) của chuỗi được copy vào IpBuffer, không bao gồm kí tự terminating null. Nếu IpBuffer buffer qua nhỏ, giá trị trả về là độ lớn mà buffer(cũng chỉ tính kí tự chữ) cần có để hold path. Nếu function không hoàn thành , giá trị trả về là 0. Để có thông tin về lỗi, chúng ta dùng lệnh GetLastError

GetLogicalDrives
Hàm này có nhiệm vụ return bitmask mô tả disk drive hiện đang available

Code:

DWORD GetLogicalDrives(VOID);

Returns
Nếu function hoàn thành , giá trị trả về là bitmask mô tả disk drive hiện đang available. Vị trí bit 0 là đĩa A, vị trí bit 1 là đĩa B, vị trí bit 2 là đĩa C, và cứ như thế… Nếu function không hoàn thành , giá trị trả về là 0

GetLogicalDriveStringsA / GetLogicalDriveStringsW
Hàm này có nhiệm vụ làm đầy buffer với những string chỉ rõ những drives hợp lý trong hệ thống

Code:

DWORD GetLogicalDriveStrings(

DWORD nBufferLength,__________// size of buffer

LPTSTR lpBuffer________________// address of buffer for drive strings

);

Returns
Nếu function hoàn thành, giá trị trả về là chiều dài (chỉ tính kí tự chữ) của chuỗi được copy vào buffer, không bao gồm kí tự terminating null. Các bác nên nhớ 1 kí tự ANSI-ASCII null sử dụng 1 byte, trong khi 1 kí tự Unicode null lại sử dụng 2 byte
Nếu buffer không đủ lớn, giá trị trả về sẽ lớn hơn nBufferLength. Nó là độ lớn mà buffer cần có để hold drive string. Nếu function không hoàn thành , giá trị trả về là 0. Để có thông tin về lỗi, chúng ta dùng lệnh GetLastError

GetVolumeInformationA / GetVolumeInformationW
Hàm GetVolumeInformation có nhiệm vụ return thông tin về file system và volume mà root directory định rõ

Code:

BOOL GetVolumeInformation(

LPCTSTR lpRootPathName,_______________// address of root directory of the file system

LPTSTR lpVolumeNameBuffer,_____________// address of name of the volume

DWORD nVolumeNameSize,______________// length of lpVolumeNameBuffer

LPDWORD lpVolumeSerialNumber, _________// address of volume serial number

LPDWORD lpMaximumComponentLength,___// address of system's maximum filename length

LPDWORD lpFileSystemFlags,____________// address of file system flags

LPTSTR lpFileSystemNameBuffer,_________// address of name of file system

DWORD nFileSystemNameSize __________// length of lpFileSystemNameBuffer

);

Returns
Nếu tất cả thông tin yêu cầu được tìm thấy, giá trị trả về là TRUE, ngược lại giá trị trả về là FALSE. Để có thông tin về lỗi, chúng ta dùng lệnh GetLastError
Về Đầu Trang Go down
https://skyfinal.forumvi.net
 
Breakpoint và Win API Details
Về Đầu Trang 
Trang 1 trong tổng số 1 trang

Permissions in this forum:Bạn không có quyền trả lời bài viết
The Final Sky :: Book-
Chuyển đến