|
'========================================================================= #include "windows.bi" #include "win/commctrl.bi" '=========================================================================
Function Edit( Byref text As String, _ Byval hParent As HWND, _ Byval x As Integer, _ Byval y As Integer, _ Byval w As Integer, _ Byval h As Integer, _ Byval cid As Integer, _ Byval style As Integer, _ Byval extendedStyle As Integer = 0 ) As HWND
Return CreateWindowEx( extendedStyle, _ "EDIT", _ text, _ style, _ x, y, w, h, _ hParent, _ cast( HMENU, cid ), _ GetModuleHandle( null ), _ null ) End Function
'=========================================================================
Function WindowProc( Byval hWnd As HWND,_ Byval uMsg As uint,_ Byval wParam As WPARAM,_ Byval lParam As LPARAM ) As LRESULT
Static As HWND hEdit
Select Case uMsg
Case WM_CREATE
'' Each character in the password will display as a '' black circle if the app is using the XP visual '' styles, or as an asterisk (*) if not.
hEdit = Edit( "password", hWnd, 25, 28, 100, 30, 101, _ WS_CHILD Or WS_VISIBLE Or ES_PASSWORD, _ WS_EX_CLIENTEDGE )
Case WM_CLOSE
PostQuitMessage( null )
Case Else
Return DefWindowProc( hWnd, uMsg, wParam, lParam )
End Select
Return 0
End Function
'========================================================================= '' Start of implicit main. '=========================================================================
Dim hWnd As HWND Dim wMsg As MSG Dim As Integer wx, wy, nWidth, nHeight Dim wcx As WNDCLASSEX Dim className As String = "manifest_test_class"
InitCommonControls
With wcx .cbSize = sizeof( WNDCLASSEX ) .style = CS_HREDRAW Or CS_VREDRAW Or CS_BYTEALIGNWINDOW .lpfnWndProc = cast( WNDPROC, @WindowProc ) .cbClsExtra = null .cbWndExtra = null .hInstance = GetModuleHandle( null ) .hbrBackground = cast( HBRUSH,COLOR_WINDOW + 1 ) .lpszMenuName = null .lpszClassName = Strptr( className ) .hIcon = LoadIcon( null, IDI_APPLICATION ) .hCursor = LoadCursor ( null, IDC_ARROW ) .hIconSm = 0 End With
RegisterClassEx( @wcx )
nWidth = 160 nHeight = 120 wx = (GetSystemMetrics( SM_CXSCREEN ) / 2) - nWidth / 2 wy = (GetSystemMetrics( SM_CYSCREEN ) / 2) - nHeight / 2
hWnd = CreateWindowEx( WS_EX_OVERLAPPEDWINDOW,_ Strptr( className ),_ "Test",_ WS_OVERLAPPED Or WS_SYSMENU,_ wx, wy, nWidth, nHeight,_ null, null,_ GetModuleHandle( null ), null )
ShowWindow( hWnd, SW_SHOWNORMAL ) UpdateWindow( hWnd )
Do Until( GetMessage( @wMsg, null, 0, 0 ) = 0 ) TranslateMessage( @wMsg ) DispatchMessage( @wMsg ) Loop
|