//KickResource "D:\Dev\Oxygen\o2\~code\~~~Resource.res" //kick add a manifest for CommonControl-6
//KickSwitch -32 //compile to 32bit
//KickEnd //optional, end of kick instructions
% Edit01 102
% lText01 201
% CheckboxTopMost 301
% DEFAULT_GUI_FONT 17
% GCL_HICON -14
% SWP_NOSIZE 1
% HWND_NOTOPMOST 0xFFFFFFFE
uses dialogs
'____________________________________________________________________________
function DialogProc(sys hDlg, uint uMsg, sys wParam, lParam) as int callback
select case uMsg
case WM_INITDIALOG
sys hIcon = ExtractIcon(GetModuleHandle(""), "Shell32.dll", 294) 'o
SetClassLongPtr(hDlg, GCL_HICON, hIcon)
sys hEdit = GetDlgItem(hDlg, Edit01)
sys hFont = CreateFont(14, 0, 'Height 14 = 9, 16=12, 15=11, 14=11, Width usually 0,
0, 0, 'Escapement(angle), Orientation
0, 0, 0, 0, 'Bold, Italic, Underline, Strikethru
0, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FF_DONTCARE, "Consolas") 'Fixed width font ("Segoe UI", 9 Arial Consolas)
SendMessage(hEdit, WM_SETFONT, hFont, 0)
SendMessage(GetDlgItem(hDlg, IDCANCEL), WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), 0)
SendMessage(GetDlgItem(hDlg, lText01), WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), 0)
SendMessage(GetDlgItem(hDlg, CheckboxTopMost), WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), 0)
PostMessage(hEdit, %EM_SETSEL, -1, 0) 'Set caret at the end of text
return true
case WM_COMMAND
select case loword(wParam)
case IDCANCEL
if hiword(wParam) = BN_CLICKED OR hiword(wParam) = 1
EndDialog(hDlg, null)
end if
case Edit01
if hiword(wParam) = EN_CHANGE 'OR hiword(wParam) = 1
word CharCount = SendMessage(GetDlgItem(hDlg, Edit01), EM_LINELENGTH, 0, 0)
string sText = nuls(CharCount)
if CharCount = 1 then CharCount = 2 'EM_GETLINE need at least 2 to work on a one char string,
'--------------------------------------
long choice = 2 'try 1, 2, or 3
'-
if choice = 1 'bad, value is not assigned to CharCount
word WordLen at strptr(sText) = CharCount
end if
'-
if choice = 2 'ok, value is assigned to CharCount
word WordLen at strptr(sText)
WordLen = CharCount
end if
'-
if choice = 3 'gpf, reassigmnet will gpf
word WordLen at strptr(sText) = CharCount
WordLen = CharCount
end if
'--------------------------------------
long retval = SendDlgItemMessage(hDlg, Edit01, EM_GETLINE, 0, STRPTR(sText))
SetWindowText(GetDlgItem(hDlg, lText01), "[" + sText + "] len " & str(len(sText)) & ", count from em_getline " & str(retval))
end if
case CheckboxTopMost
if hiword(wParam) = BN_CLICKED OR hiword(wParam) = 1
if IsDlgButtonChecked(hDlg, CheckboxTopMost) then
SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)
else
SetWindowPos(hDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)
end if
end if
end select
case WM_CLOSE
EndDialog(hDlg, null)
case WM_DESTROY
DeleteObject(hFont)
DestroyIcon(hIcon)
end select
return 0
end function
'______________________________________________________________________________
sub winmain()
Dialog(0, 0, 155, 30, "edit EM_GETLINE", WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | DS_CENTER, WS_EX_LEFT)
EditText("123456", Edit01, 05, 05, 80, 10)
Ltext("try choice 1, 2, 3 in code", lText01, 5, 18, 100, 10, SS_NOTIFY, ws_ex_staticedge, 0) 'ws_ex_windowedge) 'ws_ex_clientedge) 'ws_ex_staticedge)
PushButton("&close" , IDCANCEL, 110, 5, 40, 10)
AutoCheckBox("topmost" , CheckboxTopMost, 110, 18, 40, 10)
CreateModalDialog(null, @DialogProc, 0)
end sub
'______________________________________________________________________________
winmain()
'______________________________________________________________________________
'
word WordValue at strptr(sText) = CharCount
'pierre
word CharCount = 7
string sText = nuls CharCount ' "0000000"
word WordValue at strptr(sText) ' CharCount
WordValue = CharCount
print stext
%wlan_notification_acm_profile_unblocked = %wlan_notification_acm_adhoc_network_state_change + 1 'Added 2025-04-09
%wlan_notification_acm_screen_power_change = %wlan_notification_acm_profile_unblocked + 1 'Added 2025-04-09
%wlan_notification_acm_profile_blocked = %wlan_notification_acm_screen_power_change + 1 'Added 2025-04-09
%wlan_notification_acm_scan_list_refresh = %wlan_notification_acm_profile_blocked + 1 'Added 2025-04-09
%wlan_notification_acm_operational_state_change = %wlan_notification_acm_scan_list_refresh + 1 'Added 2025-04-09
%wlan_notification_acm_end = %wlan_notification_acm_operational_state_change + 1 'Added 2025-04-09
'%wlan_notification_acm_end = %wlan_notification_acm_adhoc_network_state_change + 1 'REMed 2025-04-09
' only an experimental test, 21-04-2025, frank brübach
' and it works :-)
#file "indep1d.exe" 'independent -> no need for it
'------
'PROLOG
'======
' I have added -------------- //
def _epilog 'FOR EXE
====================
._end_
mov edi,eax 'hold exit value in edi
push 0 'place for exit code
mov eax,esp
push eax
call getModuleHandle
push eax
call GetExitCodeProcess
mov eax,edi 'return exit value in eax
push eax
call ExitProcess
._error_
push 0x30
"MISSING OR UNLOADABLE"
push eax
push ecx
push 0
call [ebx+472]
mov eax,0
jmp _end_
end def 'eplilog for exe
' I have added -------------- //
mbox "hello" ' only for test purpose
push ebx : push esi : push edi : push ebp
mov ebp,esp
sub esp,256
'--------------------------------------------------------------
'MOVE BOOTSTRAP PROCEDURE POINTERS TO RUNTIME LIBRARY POSITIONS
'==============================================================
'
'GET ABSOLUTE ADDRESSES
'
call fwd here
.here
pop eax
sub eax,here
mov ebx,eax : add ebx,bssdata
mov edi,eax : add edi,import_address_table
'
mbox "hello2" ' only for test purpose
'--------------------------------
'COPY BOOTSTRAP LIBRARY ADDRESSES
'================================
'
mov eax,[edi+00] : mov [ebx+024],eax 'LoadLibrary
mov eax,[edi+04] : mov [ebx+040],eax 'GetProcAddress
mov eax,[edi+08] : mov [ebx+032],eax 'FreeLibrary
mov eax,[edi+12] : mov [ebx+440],eax 'GetModuleHandle
mov eax,[edi+16] : mov [ebx+448],eax 'GetGetCommandLine
mov eax,[edi+20] : mov [ebx+456],eax 'GetExitProcess
mov eax,[edi+24] : mov [ebx+464],eax 'ExitProcess
mov eax,[edi+28] : mov [ebx+480],eax 'CreateFileA
mov eax,[edi+32] : mov [ebx+488],eax 'Readfile
mov eax,[edi+36] : mov [ebx+496],eax 'CloseHandle
mov eax,[edi+44] : mov [ebx+472],eax 'MessageBoxA
'=============
jmp fwd endlib
'=============
mbox "hello3" ' only for test purpose
'-----------
TestMessage:
'===========
push 0
"title dolphin"
push eax
"message ocean"
push eax
push 0
call [ebx+472]
ret
'------------------
DisplayCommandLine:
'==================
push 0
"COMMAND LINE"
push eax
call [ebx+448]
push eax
push 0
call [ebx+472]
ret
'-------
Message:
'=======
pop edi
call [ebx+472]
push edi
ret 16
'======
endlib:
'======
'-----
'TESTS
'=====
call TestMessage
call DisplayCommandLine
call Message 0,"message oxygen","title o2h",1
mbox "ok4"
'------
'EPILOG
'======
endprog:
mov esp,ebp : pop ebp : pop edi : pop esi : pop ebx
ret
' ends
Page created in 0.105 seconds with 11 queries.