Tải FREE tài liệu Lập Trình API PDF có tiếng Việt

Tải FREE tài liệu Lập Trình API PDF có tiếng Việt

Tải FREE tài liệu Lập Trình API PDF có tiếng Việt là một trong những đáng đọc và tham khảo. Hiện Tải FREE tài liệu Lập Trình API PDF có tiếng Việt đang được Tư Vấn Tuyển Sinh chia sẻ miễn phí dưới dạng file PDF.

=> Bạn chỉ cần nhấn vào nút “Tải tài liệu” ở phía bên dưới là đã có thể tải được về máy của mình rồi.

Lưu ý quan trọng

Bên dưới đây mình có spoil 1 phần nội dung trong tài liệu để bạn tham khảo trước về nội dung tài liệu / Sách. Để xem được full nội dung thì bạn hãy nhấn vào nút “Link tải PDF” ở trên để tải bản đầy đủ về nhé

Phần 1: Các hàm API liên quan đến cửa sổ

Để xem xét quan hệ của một cửa sổ (tạm gọi là cửa sổ khai báo) với các cửa sổ khác, ta nghiên cứu các mối quan hệ sau:


1. AnyPopup

Declare Function AnyPopup Lib "user32" Alias "AnyPopup" () As Long

Công dụng: Đưa ra chỉ số cửa sổ popup hiện đang tồn tại trên màn hình.
Trị trả về: Integer ~ True (khác zero) nếu có cửa sổ popup.


2. AdjustWindowRect

Declare Function AdjustWindowRect Lib "user32" Alias "AdjustWindowRect"
(lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long) As Long

3. AdjustWindowRectEx

Declare Function AdjustWindowRectEx Lib "user32" Alias "AdjustWindowRectEx"
(lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long

Công dụng: Điều chỉnh cửa sổ khi có vùng làm việc client (không tính thanh tiêu đề, đường viền và các phần thêm) được khai báo, khi biết kiểu cửa sổ.

Tham số:

  • lpRect: Hình chữ nhật chứa vùng làm việc client.
  • dwStyle: Kiểu cửa sổ.
  • bMenu: True nếu cửa sổ có trình đơn.
  • dwEsStyle: Kiểu cửa sổ mở rộng.

4. ArrangeIconicWindows

Declare Function ArrangeIconicWindows Lib "user32" Alias "ArrangeIconicWindows"
(ByVal hwnd As Long) As Long

Công dụng: Xếp các biểu tượng cửa sổ trong cửa sổ chứa (Parent).
Trị trả về: Chiều cao hàng biểu tượng. Zero nếu thất bại.
Tham số:

  • hWnd: Cán của cửa sổ chứa.

5. BeginDeferWindowPos

Declare Function BeginDeferWindowPos Lib "user32" Alias "BeginDeferWindowPos"
(ByVal nNumWindows As Long) As Long

Công dụng: Bắt đầu xây dựng danh sách vị trí các cửa sổ trong một cấu trúc bản đồ nội bộ.
Trị trả về: Cán của cấu trúc. Zero nếu thất bại.
Tham số:

  • nNumWindows: Số cửa sổ ban đầu để cấp phát.

6. DeferWindowPos

Declare Function DeferWindowPos Lib "user32" Alias "DeferWindowPos"
(ByVal hWinPosInfo As Long, ByVal hwnd As Long, ByVal hWndInsertAfter As Long,
ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long,
ByVal wFlags As Long) As Long

Công dụng: Định nghĩa vị trí cửa sổ mới và đưa vào bản đồ vị trí.
Trị trả về: Cán cập nhật mới. Zero nếu thất bại.

Tham số quan trọng:

  • hWinPosInfo: Cấu trúc vị trí.
  • hwnd: Cửa sổ cần định vị.
  • hWndInsertAfter: Một trong các hằng:
    • HWND_BOTTOM
    • HWND_TOP
    • HWND_TOPMOST
  • x, y: Tọa độ trong Parent.
  • cx, cy: Kích thước mới.
  • Flags:
    • SWP_DRAWFRAME
    • SWP_HIDEWINDOW
    • SWP_NOACTIVE
    • SWP_NOMOVE
    • SWP_NOREDRAW
    • SWP_NOSIZE
    • SWP_NOZORDER

7. SetWindowPos

Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos"
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long,
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Công dụng: Thiết đặt vị trí và trạng thái cửa sổ.
Tham số như ở DeferWindowPos.


8. EndDeferWindowPos

Declare Function EndDeferWindowPos Lib "user32" Alias "EndDeferWindowPos"
(ByVal hWinPosInfo As Long) As Long

Công dụng: Cập nhật vị trí tất cả cửa sổ trong bản đồ.


9. BringWindowToTop

Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop"
(ByVal hwnd As Long) As Long

Công dụng: Đưa cửa sổ lên đầu danh sách hiển thị.
Tham số:

  • hwnd

10–11. ChildWindowFromPoint

Declare Function ChildWindowFromPoint Lib "user32"
Alias "ChildWindowFromPoint" (ByVal hWnd As Long, ByVal xPoint As Long, ByVal yPoint As Long) As Long

Declare Function ChildWindowFromPoint Lib "user32"
Alias "ChildWindowFromPoint" (ByVal hWndParent As Long, ByVal pt As POINTAPI) As Long

Công dụng: Lấy cán cửa sổ con tại một điểm trong cửa sổ chứa.

Trị trả về:

  • Cửa sổ con phù hợp
  • Nếu không có: trả về chính cửa sổ chứa
  • Zero nếu điểm nằm ngoài cửa sổ

12. ClientToScreen

Declare Function ClientToScreen Lib "user32" Alias "ClientToScreen"
(ByVal hwnd As Long, lpPoint As POINTAPI) As Long

Công dụng: Chuyển tọa độ client → screen.


CloseWindow

Declare Function CloseWindow Lib "user32" Alias "CloseWindow" (ByVal hwnd As Long) As Long

Công dụng: Thu nhỏ cửa sổ.


CopyRect

Declare Function CopyRect Lib "user32" Alias "CopyRect"
(lpDestRect As RECT, lpSourceRect As RECT) As Long

Công dụng: Sao chép hình chữ nhật.


DestroyWindow

Declare Function DestroyWindow Lib "user32" Alias "DestroyWindow" (ByVal hwnd As Long) As Long

Công dụng: Phá hủy cửa sổ (kể cả Child).


EnableWindow

Declare Function EnableWindow Lib "user32" Alias "EnableWindow"
(ByVal hwnd As Long, ByVal fEnable As Long) As Long

Công dụng: Bật/tắt khả năng nhận input của cửa sổ.


EnumChildWindows

Declare Function EnumChildWindows Lib "user32" Alias "EnumChildWindows"
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Công dụng: Liệt kê các cửa sổ con.
Cần Custom Control CBK.VBX.


EnumWindowStations

Declare Function EnumWindowStations Lib "user32" Alias "EnumWindowStationsA"
(ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Công dụng: Liệt kê cửa sổ cấp trên.
Cần CBK.VBX.


EqualRect

Declare Function EqualRect Lib "user32" Alias "EqualRect"
(lpRect1 As RECT, lpRect2 As RECT) As Long

Công dụng: So sánh 2 hình chữ nhật.


FindWindow

Declare Function FindWindow Lib "user32" Alias "FindWindowA"
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Công dụng: Tìm cửa sổ theo ClassName / WindowName.


FindWindowEx

Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA"
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Công dụng: Tìm cửa sổ con theo lớp/tiêu đề.


FlashWindow

Declare Function FlashWindow Lib "user32" Alias "FlashWindow"
(ByVal hwnd As Long, ByVal bInvert As Long) As Long

Công dụng: Nháy cửa sổ để thu hút chú ý.


GetActiveWindow

Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long

Công dụng: Lấy cửa sổ đang kích hoạt.


GetClassInfo

Declare Function GetClassInfo Lib "user32" Alias "GetClassInfoA"
(ByVal hInstance As Long, ByVal lpClassName As String, lpWndClass As WNDCLASS) As Long

Công dụng: Lấy thông tin lớp cửa sổ.


GetClassLong

Declare Function GetClassLong Lib "user32" Alias "GetClassLongA"
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Công dụng: Lấy dữ liệu lớp.


GetWindowLong

Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Công dụng: Lấy thông tin trong cấu trúc cửa sổ.


SetWindowLong

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Công dụng: Ghi dữ liệu cấu trúc cửa sổ.


GetWindowText

Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA"
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Công dụng: Lấy tiêu đề cửa sổ hoặc nội dung control.


GetWindowTextLength

Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA"
(ByVal hwnd As Long) As Long

Công dụng: Lấy độ dài tiêu đề.


GetWindowWord

Declare Function GetWindowWord Lib "user32" Alias "GetWindowWord"
(ByVal hwnd As Long, ByVal nIndex As Long) As Integer

SetWindowWord

Declare Function SetWindowWord Lib "user32" Alias "SetWindowWord"
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long) As Long

InflateRect

Declare Function InflateRect Lib "user32" Alias "InflateRect"
(lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long

IntersectRect

Declare Function IntersectRect Lib "user32" Alias "IntersectRect"
(lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long

InvalidateRect

Declare Function InvalidateRect Lib "user32" Alias "InvalidateRect"
(ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long) As Long

IsChild

Declare Function IsChild Lib "user32" Alias "IsChild"
(ByVal hWndParent As Long, ByVal hwnd As Long) As Long

IsIconic

Declare Function IsIconic Lib "user32" Alias "IsIconic"
(ByVal hwnd As Long) As Long

IsRectEmpty

Declare Function IsRectEmpty Lib "user32" Alias "IsRectEmpty"
(lpRect As RECT) As Long

IsWindow

Declare Function IsWindow Lib "user32" Alias "IsWindow"
(ByVal hwnd As Long) As Long