Stwoo Stwoo slideshow slideshow slideshow slideshow slideshow slideshow

You are not logged in.

Led Lamps for win32

I own one lappy that don't have led lamps, so I've wrote simple app that will emulate this feature.
Application is written in Assembly (MASM32 - intel syntax), and it's very very simple and light...nothing fancy, just to work...though


Source:


.Const
inv Equ Invoke
WM_TRAY Equ WM_USER + 2048


.Data?
tray DD ?
notif DD ?
posx DD ?
posy DD ?
autorun DD ?
wndnum DD ?
wndcaps DD ?
wndscrl DD ?
iconh DD ?
mnu DD ?
buff DB 256 Dup(?)

.Data
nID NOTIFYICONDATA <0>
tti TOOLINFO <0>
.Code

mnProcedure Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
Local tmp, rct:RECT, pt:POINT
.If uMsg == WM_CREATE
Mov nID.cbSize, SizeOf nID
Mov nID.uCallbackMessage, WM_TRAY
Mov Eax, hWnd
Mov nID.hwnd, Eax
Mov nID.uFlags, NIF_ICON Or NIF_TIP Or NIF_MESSAGE
Mov nID.uID, 1
Mov iconh, FUNC(LoadIcon, App.Instance, IDI_ICON)
Mov Eax, iconh
Mov nID.hIcon, Eax
inv LoadString, App.Instance, IDT_TTL, Addr nID.szTip, 40
inv Shell_NotifyIcon, NIM_ADD, Addr nID

inv LoadMenu, App.Instance, IDR_MENUEN
inv GetSubMenu, Eax, 0
Mov mnu, Eax


inv FindWindow, TextAddr("Shell_TrayWnd"), 0
Mov tray, Eax
inv GetWindow, tray, GW_CHILD + GW_HWNDFIRST
Move notif, tmp
inv SetParent, hWnd, tray
inv GetClientRect, tray, Addr rct
Mov Eax, rct.left
Mov posx, Eax
Mov Eax, rct.bottom
Sub Eax, 9
Mov posy, Eax
inv MoveWindow, hWnd, posx, posy, 54, 9, 1
inv GetWindowItem, hWnd, IDC_MN_NUM
Mov wndnum, Eax
inv GetWindowItem, hWnd, IDC_MN_CAPS
Mov wndcaps, Eax
inv GetWindowItem, hWnd, IDC_MN_SCROLL
Mov wndscrl, Eax
inv GetRegistryValue, ecCurrentUser, TextAddr("SOFTWARE\Microsoft\Windows\CurrentVersion\run"), TextAddr("LedLamps"), Addr buff
.If Eax
inv CheckMenuItem, mnu, IDM_AS, 8
.Else
inv CheckMenuItem, mnu, IDM_AS, 0
.EndIf
inv SetWindowPos, hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE
inv SetTimer, hWnd, 0, 0, 0
.ElseIf uMsg == WM_TIMER
inv GetWindowRect, notif, Addr rct
Mov Eax, rct.left
Mov posx, Eax
inv RtlZeroMemory, Addr rct, SizeOf rct
inv GetClientRect, tray, Addr rct
Mov Eax, rct.bottom
Sub Eax, 9
Mov posy, Eax
inv MoveWindow, hWnd, posx, posy, 54, 9, 1
inv keystates
Mov tmp, Eax
.If tmp >= 100
inv GetPicture, wndnum
.If Eax != IDI_ION
inv SetPicture, wndnum, IDI_ION
.EndIf
Sub tmp, 100
.Else
.If Eax != IDI_IOFF
inv SetPicture, wndnum, IDI_IOFF
.EndIf
.EndIf
.If tmp >= 10
.If Eax != IDI_ION
inv SetPicture, wndcaps, IDI_ION
.EndIf
Sub tmp, 10
.Else
.If Eax != IDI_IOFF
inv SetPicture, wndcaps, IDI_IOFF
.EndIf
.EndIf
.If tmp == 1
.If Eax != IDI_ION
inv SetPicture, wndscrl, IDI_ION
.EndIf
.Else
.If Eax != IDI_IOFF
inv SetPicture, wndscrl, IDI_IOFF
.EndIf
.EndIf
.ElseIf uMsg == WM_COMMAND
HiWord wParam
Mov Bx, Ax
LoWord wParam
.If Bx == 0
.If Ax == IDC_MN_NUM
inv toogle_num
.ElseIf Ax == IDC_MN_CAPS
inv toogle_caps
.ElseIf Ax == IDC_MN_SCROLL
inv toogle_scroll
.EndIf
.EndIf
.If Ax == IDM_EXIT
inv SendMessage, hWnd, WM_CLOSE, 0, 0
.ElseIf Ax == IDM_AS
inv GetRegistryValue, ecCurrentUser, TextAddr("SOFTWARE\Microsoft\Windows\CurrentVersion\run"), TextAddr("LedLamps"), Addr buff
.If Eax
inv DeleteRegistryValue, ecCurrentUser, TextAddr("SOFTWARE\Microsoft\Windows\CurrentVersion\run"), TextAddr("LedLamps")
inv CheckMenuItem, mnu, IDM_AS, 8
.Else
inv GetModuleFileName, 0, Addr buff, SizeOf buff
inv SetRegistryValue, ecCurrentUser, TextAddr("SOFTWARE\Microsoft\Windows\CurrentVersion\run"), TextAddr("LedLamps"), Addr buff
inv CheckMenuItem, mnu, IDM_AS, 0
.EndIf
.ElseIf Ax == IDM_ABT
inv ShellAbout, hWnd, TextAddr("LedLamps"), TextAddr("Copyright 2011, stwoowerks, wook", 13, 10, "wook"), IDI_ICON
.EndIf
.ElseIf uMsg == WM_TRAY
.If lParam == WM_RBUTTONUP
inv GetRegistryValue, ecCurrentUser, TextAddr("SOFTWARE\Microsoft\Windows\CurrentVersion\run"), TextAddr("LedLamps"), Addr buff
.If Eax
inv CheckMenuItem, mnu, IDM_AS, 8
.Else
inv CheckMenuItem, mnu, IDM_AS, 0
.EndIf
inv GetCursorPos, Addr pt
inv TrackPopupMenu, mnu, 0, pt.x, pt.y, 0, hWnd, NULL
Return TRUE
.ElseIf lParam == WM_LBUTTONDBLCLK
inv SendMessage, hWnd, WM_CLOSE, 0, 0
.ElseIf lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN
Invoke SetForegroundWindow, hWnd
.EndIf
.ElseIf uMsg == WM_CLOSE
inv Shell_NotifyIcon, NIM_DELETE, Addr nID
inv DestroyIcon, iconh
inv DestroyMenu, mnu
Invoke IsModal, hWnd
.If Eax
Invoke EndModal, hWnd, IDCANCEL
Mov Eax, TRUE
Ret
.EndIf
.EndIf
Xor Eax, Eax
Ret
mnProcedure EndP

keystates Proc Private
Local retx
Mov retx, 0
inv GetKeyState, VK_NUMLOCK
.If Eax != 0
Add retx, 100
.EndIf
inv GetKeyState, VK_CAPITAL
.If Eax != 0
Add retx, 10
.EndIf
inv GetKeyState, VK_SCROLL
.If Eax != 0
Add retx, 1
.EndIf
Mov Eax, retx
Ret
keystates EndP

toogle_caps Proc Private
inv keybd_event, VK_CAPITAL, 3AH, KEYEVENTF_EXTENDEDKEY Or 0, 0
inv keybd_event, VK_CAPITAL, 3AH, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
Ret
toogle_caps EndP

toogle_num Proc Private
inv keybd_event, VK_NUMLOCK, 45H, KEYEVENTF_EXTENDEDKEY Or 0, 0
inv keybd_event, VK_NUMLOCK, 45H, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
Ret
toogle_num EndP

toogle_scroll Proc Private
inv keybd_event, VK_SCROLL, 46H, KEYEVENTF_EXTENDEDKEY Or 0, 0
inv keybd_event, VK_SCROLL, 46H, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
Ret
toogle_scroll EndP

leds_source.zip source code archive (svg icon included)
ledlamps executable archive



under construction
FreeBSD Apache Python dot TK Free DNS

under construction
In case you have problems with loading site try alternative version:
mobile version (under construction) | desktop version
Intel on Linux
17:30:30 up 1 day, 18:13, 1 user, load average: 0.01, 0.09, 0.09
News:
Title: test-will -reedit
just test thingy...
let's see how it will look in preview :D
Title: The Very First!
Hello WORLD!!! from my very first python-ba...
I've managed to set up web server with https://www...
Title: Project: Turbulences
The Turbulences
This is project that I am working on for last few ...
Gallery:
img153.jpg
Copyright © wook, Stwoowerks 2012.
Sitemap | Top | AVG Report

Valid XHTML + RDFaValid CSS!