Adjustment API Function Design About Window

zhaozj2021-02-11  193

API function calls designed ABOUT window Author: Cai trainability

The Windows 98 system has a Windows style About window that reflects some basic information in the front system, which shows information such as WINDOWS and its application software. Information and other information. The author uses VB 6.0 through the call of the API function to set the application system's About window. The effect is shown in Figure 1. (Omitted) 1. Building a window with the following control: Control Name CAPTION

Window Form1 Test the About window with VB6.0

Command button Command1 is closed in the sales management system

2 . Listing: ---- Private Declare Function GetWindowWord Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Integer ---- Private Declare Function ShellAbout Lib "shell32.dll" Alias ​​"ShellAboutA" (ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long ---- Private Declare Function ExtractIcon Lib "shell32.dll" Alias ​​"ExtractIconA" (ByVal hinst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias ​​"GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As Long Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long ---- Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO) Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Private Const gwl_exstyle = (-20)

Private const GWL_Style = (-16)

Private const GWL_WndProc = (-4)

Private const GWL_HINSTANCE = (-6)

Private Type System_info

Dwoemid As Long

DWPAGESIZE AS Long

LPMINIMUMAPPLICATIONADDRESS AS LonglpMaximumApplicationAddress As Long

DWACTIVEPROCESSORMASK AS Long

Dwnumberfprocessors as long

DWProcessORTYPE AS Long

DwallocationGranularity As Long

DWRESERVED AS Long

End Type

Private const SM_CXScreen = 0

Private const SM_CYSCREEN = 1

Private submmand1_click ()

DIM HINST AS Long

DIM ICONS as long

DIM ABOUTS As Long

DIM DISPX AS STRING

DIM DISPY AS STRING

DIM CPS AS STRING

DIM SPACE1 AS STRING

DIM Space2 As String

Hinst = getWindowWord (me.hwnd, gwl_hinstance)

Icons = Extracticon (Hinst, "D: /FPW26/foxprow.exe", 0)

Dim sysinfo as system_info

DIM CLS1 AS Long

DIM CLS2 As Long

DIM SecS as long

DIM BYTES AS Long

DIM BUFFS AS STRING

BUFF = "C: /"

X = getDriveType (buffs)

x = getDiskFreespace (Buffs, Secs, Bytes, CLS1, CLS2)

CLS1 = CLS1 * SECS * BYTES

CLS2 = CLS2 * SECS * bytes

Space1 = "C drive total capacity:

Format $ (CLS2 / 1024, "#, #") "Thousand Bies"

Space2 = "C Drive available capacity:

" Format $ (CLS1 / 1024," #, # ") " Thousand Bytes "

x = getSystemMetrics (SM_CXSCREEN)

Dispx = "Display Resolution:" STR $ (x)

x = getSystemMetrics (SM_CYSCREEN)

Dispy = STR $ (x)

Call getSystemInfo (sysinfo)

Select Case Sysinfo.dwProcessORTYPE

Case 386

CPUS = "Processor Type: 386"

Case 486

CPUS = "Processor Type: 486"

Case 586

CPUS = "Processor Type: 586"

End SELECT

Abouts = shellabout (me.hwnd, "demo",

"Sales Management System V2.0 All rights reserved [C] 1998-1999 Cai Texas"

& Chr $ (13) & chR $ (10) & Space1 & Chr $ (13) & chr $ (10)

& Space2 & CHR $ (13) & Chr $ (10) & CPUS "" DISPX

"*" DISPY, ICONS) End Sub

---- Upper Up to Windows 98, Visual Basic 6.0 for Windows Environment is available. User can add it to the application system from the About menu item, and call it through the menu item, the effect is better.

转载请注明原文地址:https://www.9cbs.com/read-4859.html

New Post(0)