Surely you must double click on it to show the blue rectangle incorporating any text.
A click sets the cursor position.
Code: Select all
#include "windows.bi"
Declare Function SetWindowTheme Lib "UxTheme.dll" Alias "SetWindowTheme"(As Any Ptr,As zstring Ptr,As zstring Ptr) As Long
Function fb_Set_Font (Font As String,Size As Integer,Bold As Integer=0,Italic As Integer=0,Underline As Integer=0,StrikeThru As Integer=0) As HFONT
Dim As HDC hDC=GetDC(HWND_DESKTOP)
Dim As Integer CyPixels=GetDeviceCaps(hDC,LOGPIXELSY)
ReleaseDC(HWND_DESKTOP,hDC)
Return CreateFont(0-(Size*CyPixels)/72,0,0,0,Bold,Italic,Underline,StrikeThru,ANSI_CHARSET _
,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,Font)
End Function
Function wndproc(hwnd As HWND, msg As Uinteger,_
wparam As WPARAM, lparam As LPARAM) As Integer
Static As Any Ptr edit
Select Case msg
Case WM_CREATE
edit= CreateWindowEx( 0, "edit", "" , WS_VISIBLE Or WS_CHILD Or WS_BORDER Or ES_MULTILINE Or WS_VSCROLL Or WS_HSCROLL,100,100,300,300,hWnd,0,0,0 )
SetWindowTheme(hwnd," "," ")
Dim As HFONT font
Dim As String temp="ABCDEFGHIJKLMNOPQRSTTUVWXYZ "
font=fb_Set_Font("arial",15,,TRUE)
SendMessage(edit,WM_SETFONT,Cast(WPARAM,font),0)'<<--- optional font
setwindowtext(edit,temp)
Case WM_DESTROY
PostQuitMessage(0)
End Select
Return DefWindowProc(hwnd,msg,wparam,lparam)
End Function
Function WinMain ( Byval hInstance As HINSTANCE, _
Byval hPrevInstance As HINSTANCE, _
Byval szCmdLine As Zstring Ptr, _
Byval iCmdShow As Integer ) As Integer
Dim wMsg As MSG
Dim wcls As WNDCLASS
Dim main As HWND
Dim As hwnd button
Function = 0
With wcls
.style = CS_HREDRAW Or CS_VREDRAW
.lpfnWndProc = @WndProc
.cbClsExtra = 0
.cbWndExtra = 0
.hInstance = hInstance
.hIcon = LoadIcon( NULL, IDI_APPLICATION )
.hCursor = LoadCursor( NULL, IDC_ARROW )
.hbrBackground = GetStockObject( WHITE_BRUSH )
.lpszMenuName = NULL
.lpszClassName = @"MyWin"
End With
If( RegisterClass( @wcls ) = False ) Then
MessageBox( null, "Failed To register wcls", "Error", MB_ICONERROR )
Exit Function
End If
main = CreateWindowEx( 0, _
@"MyWin", _
"Hi", _
WS_OVERLAPPEDWINDOW Or ws_visible, _
50, _
50, _
600, _
600, _
NULL, _
NULL, _
hInstance , _
NULL )
ShowWindow( main, iCmdShow )
UpdateWindow( main )
While( GetMessage( @wMsg, NULL, 0, 0 ) <> False )
TranslateMessage( @wMsg )
DispatchMessage( @wMsg )
Wend
Function = wMsg.wParam
End Function
WinMain( GetModuleHandle( null ), null, Command( ), SW_NORMAL )