![]() |
|
|
#2 (permalink) |
|
Banned
Location: UCSD, 510.49 miles from my love
|
if it hasnt been written, it doesnt look like it would be very difficult to write at all.
Just ask one of the other coders here, and perhaps you may get something. If I have time in the next week, I'll have a crack at it. |
|
|
|
|
#3 (permalink) |
|
Junkie
Location: RI
|
That'd be pretty easy. If I wasn't at work, I'd see if I could throw somethin together, but I am. What'd be even better is if it took out taxes and the like beforehand =p. Ugh, damn you...=p
All of a sudden, my brain is thinking about many different things that could be added, like if theres direct deposit, how much will go into it, if you have it split, how much will go into both. I wanna go home now... Last edited by Fallon; 11-07-2003 at 07:34 AM.. |
|
|
|
|
#4 (permalink) |
|
Insane
|
well it has been quite slow at work lately. Ive averaged out a net $/hr after taxes and what from my last few pay's. So if i could just put in a $/hr or even $/sec and it just counted it in realtime that'd be perfect.
im sure someone has done it before, or could do something up |
|
|
|
|
#5 (permalink) |
|
Tilted
Location: So. Cali
|
A search engine consultant friend of mine uses something like that to keep track of his time spent on the phone... he puts $400/hour in the box and hits the start button at the beginning of the call and the end button when it is done then he can bill the client for the exact amount of time... i will email him and ask him what the name of the program is.
__________________
Tell me what we’re fighting for— I don’t remember anymore, only temporary reprieve. And the world might cease if we fail to tame the beast; from the faith that you release comes an atheist peace. |
|
|
|
|
#6 (permalink) | |
|
Insane
|
Quote:
![]() |
|
|
|
|
|
#7 (permalink) |
|
Loves my girl in thongs
Location: North of Mexico, South of Canada
|
It's more money than you'd care to spend but the design and law standard program Timeslips does this and breaks it down into what each task or job was worth.
Perfect for keeping track of what i've done for a client and what i bill each client since they all are on different rates.
__________________
Seen on an employer evaluation: "The wheel is turning but the hamsters dead" ____________________________ Is arch13 really a porn diety ? find out after the film at 11. -Nanofever |
|
|
|
|
#9 (permalink) |
|
Junkie
Location: RI
|
Tonight, I'm gonna make myself a program that I can turn on when I start work, and when I finish, but it won't have a running counter, if you want a copy, get the .NET Framework 1.1, and when I'm done I'll see if I can send it.
What it'll do is hopefully write the start time, and when you click again, the end time, it'll save that to a file, if you want, you can then total the day, and get the hours and such. I'm sure the extras could be added, such as taxes and such. For me, it became a need after I did my timecard today so =p. |
|
|
|
|
#14 (permalink) |
|
Junkie
Location: Go A's!!!!
|
i seen something similar to this but it was java based and calculated how much texas rangers shortstop alex rodriguez made per hour minute second of each day on his 10 year 100+ million dollar contract never been able to find it again
__________________
Spank you very much |
|
|
|
|
#16 (permalink) |
|
Junkie
Location: North Hollywood
|
Here you go, its still a work in progress, but i think it works
http://www.finitemonkeys.com/tfp/waiw.zip havent tested it outside XP, a lot of the shell stuff changed on 2000 and XP, so it probably doesn't work pre 2k and possibly not even pre XP,.. yes in fact i just tried in my 2k advanced server and it started up but looked like it failed on something later. so i'll check to see what stuff i have to add to make it work pre XP. its pretty simple, defaults to 100 err units, you can change it easily enough, select start to start it, change to change it and quit to exit, it updates every 1 minute. if you have XP play with it, see if it does what you want it to do, and i'll fix the bugs, like the one where it might in fact be showing 10x the earnings its what we like to call a one level demo |
|
|
|
|
#19 (permalink) |
|
Junkie
Location: North Hollywood
|
I upated it again and added the code ( should run at the right rate )
if this posts right, i'll be very suprised :) (ok edit for disable smileys, i bet when they came up with :DWORD they werent expecting cheesy grins , dunno about the double line feed though, try small size) Code:
.386
.model flat, stdcall
option casemap:none
;===============================================================================================
; include
;===============================================================================================
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc
include \MASM32\include\gdi32.inc
include \MASM32\include\MASM32.inc
include \MASM32\INCLUDE\advapi32.inc
;===============================================================================================
; libs
;===============================================================================================
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\gdi32.lib
includelib \MASM32\lib\gdi32.lib
includelib \MASM32\lib\MASM32.lib
includelib \MASM32\LIB\advapi32.lib
;===============================================================================================
; prototypes
;===============================================================================================
main PROTO :DWORD
SetBmpColor PROTO :DWORD
GetRateProc PROTO :HWND,:DWORD,:WPARAM,:LPARAM
Float2ASCII PROTO
CalcRate2 PROTO
;===============================================================================================
; macros
;===============================================================================================
LOWORD MACRO bigword ;; Retrieves the low word from double word argument
mov eax,bigword
and eax,0FFFFh ;; Set to low word
ENDM
return MACRO arg
mov eax, arg
ret
ENDM
;===============================================================================================
; defines
;===============================================================================================
.const
WM_SHELLNOTIFY equ WM_USER+5
IDI_TRAY equ 0
; icon resource number
ProgIcon equ 100
; menu ID's
IDM_Pause equ 1005
IDM_Stop equ 1004
IDM_Start equ 1003
IDM_ChangeRate equ 1002
; standard items
IDM_AboutBox equ 1001
IDM_Quit equ 1000
IDB_Pause equ 10002
IDB_AboutBox equ 10001
IDB_Quit equ 10000
IDC_DOLLARS equ 1000
IDC_CENTS equ 1001
ID_OK equ 1003
IDD_RATE equ 9; ; hmm how did i manage that one
Count equ 14
; simple state
STATE_STOPPED equ 1
STATE_STARTED equ 2
STATE_PAUSED equ 3
STATE_ABOUT equ 4
;===============================================================================================
; const non bss data
;===============================================================================================
.data
currentState db STATE_STOPPED
ProcessInfo PROCESS_INFORMATION <>
; ---------------------------------
ClassName db "WaiwWinClass", 0
ProgramName db "WAIW", 0
NotRunningText db "Stopped", 0
; ---------------------------------
SetHourlyText db "&Change hourly rate", 0
StartText db "&Start", 0
StopText db "S&top", 0
PauseText db "&Pause", 0
; ---------------------------------
AboutBoxTitle db "About", 0
AboutBoxText db "WAIW, Copyright © 2003 charliex, root@charliex.net", 0
; ---------------------------------
QuitText db "&Quit", 0
ConfirmText db "Are you sure you wish to quit ?", 0
; ---------------------------------
ChangeRateText db "Changing rate", 0
StartedText db "Running", 0
PausedText db "Paused", 0
div60 dd 03c888889h
div2 dd 03c23d70ah
fipaddcon dd 000000000h,04f800000h
startMS dd 0
milliSeconds dd 0
startTime dd 0
; rate per hour
ratePerHour dd 100
; how much made so far
made REAL4 0.0
; internal calcs, exposed for debugging
rph REAL4 0.0
; temp buff
buffer db 255 dup (0)
;===============================================================================================
; non const data
;===============================================================================================
ETDBuffer db "ETD : $"
ETDData db 128 dup (0)
;===============================================================================================
; non const bss data
;===============================================================================================
.data?
hInstance dd ?
note NOTIFYICONDATA <>
StatusInfo db ?
hPopupMenu dd ?
hBmp1 dd ? ; bitmap handle
IDM dd ? ; menu number id
IDB dd ? ; menu bitmap id
;===============================================================================================
; code
;===============================================================================================
.code
code:
invoke GetModuleHandle, NULL
mov hInstance, eax
; call our main
invoke main, hInstance
invoke ExitProcess, eax
;===============================================================================================
; WinMain
;===============================================================================================
main PROC hInst:HINSTANCE
LOCAL WindowClass : WNDCLASSEX
LOCAL Msg : MSG
LOCAL hWindow : HWND
mov WindowClass.cbSize, SIZEOF WNDCLASSEX
mov WindowClass.style, CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS
mov WindowClass.lpfnWndProc, OFFSET WindowProc
mov WindowClass.cbClsExtra, NULL
mov WindowClass.cbWndExtra, NULL
push hInst
pop WindowClass.hInstance
mov WindowClass.hbrBackground, COLOR_APPWORKSPACE
mov WindowClass.lpszMenuName, NULL
mov WindowClass.lpszClassName, OFFSET ClassName
; load icon
invoke LoadIcon, hInstance, ProgIcon
mov WindowClass.hIcon, eax
mov WindowClass.hIconSm, eax
invoke LoadCursor, hInstance, IDC_ARROW
mov WindowClass.hCursor, eax
invoke RegisterClassEx, ADDR WindowClass
invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR ClassName, ADDR ProgramName,\
0, \
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL,\
hInst, NULL
mov hWindow, eax
; process message pump
.while TRUE
invoke GetMessage, ADDR Msg, NULL, 0, 0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR Msg
invoke DispatchMessage, ADDR Msg
.endw
mov eax, Msg.wParam
ret
main ENDP
;===============================================================================================
; WindowProc
;===============================================================================================
WindowProc PROC hWindow:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL pt : POINT
LOCAL StartInfo : STARTUPINFO
LOCAL hWnd : HWND
LOCAL Nb: QWORD
.code
.if uMsg==WM_CREATE
invoke CreatePopupMenu
mov hPopupMenu, eax
invoke AppendMenu, hPopupMenu, MF_STRING, IDM_Start, ADDR StartText
invoke AppendMenu, hPopupMenu, MF_STRING, IDM_Stop, ADDR StopText
invoke AppendMenu, hPopupMenu, MF_STRING, IDM_Pause, ADDR PauseText
invoke AppendMenu, hPopupMenu, MF_STRING, IDM_ChangeRate, ADDR SetHourlyText
invoke AppendMenu, hPopupMenu, MF_SEPARATOR, NULL, NULL
invoke AppendMenu, hPopupMenu, MF_STRING, IDM_AboutBox , ADDR AboutBoxTitle
invoke AppendMenu, hPopupMenu, MF_SEPARATOR, NULL, NULL
invoke AppendMenu, hPopupMenu, MF_STRING, IDM_Quit , ADDR QuitText
mov ecx, Count
mov IDB, IDB_Quit
mov IDM, IDM_Quit
loadBitmaps:
push ecx
invoke LoadBitmap, hInstance, IDB
mov hBmp1, eax
invoke SetBmpColor, hBmp1
mov hBmp1, eax
invoke SetMenuItemBitmaps, hPopupMenu, IDM, MF_BYCOMMAND, hBmp1, hBmp1
pop ecx
inc IDB
inc IDM
LOOP loadBitmaps
mov note.cbSize, SIZEOF NOTIFYICONDATA
push hWindow
pop note.hwnd
mov note.uID, IDI_TRAY
mov note.uFlags, NIF_ICON+NIF_MESSAGE+NIF_TIP
mov note.uCallbackMessage, WM_SHELLNOTIFY
invoke LoadIcon, hInstance, ProgIcon
mov note.hIcon, eax
; set the program tool trap icons tool tip
invoke lstrcpy, ADDR note.szTip, ADDR NotRunningText
invoke Shell_NotifyIcon, NIM_ADD, ADDR note
.elseif uMsg==WM_COMMAND
.if lParam==0
mov eax, wParam
.if ax==IDM_Quit
invoke MessageBox, NULL, ADDR ConfirmText, ADDR ProgramName, MB_YESNO or MB_ICONINFORMATION
.if eax==IDNO
invoke Shell_NotifyIcon, NIM_ADD, ADDR note
.else
invoke DestroyWindow, hWindow
.endif
.elseif ax==IDM_AboutBox
cmp StatusInfo, 1
jz menu
inc StatusInfo
invoke LoadIcon, NULL, IDI_INFORMATION
mov note.hIcon, eax
invoke lstrcpy, ADDR note.szTip, ADDR AboutBoxTitle
invoke Shell_NotifyIcon, NIM_MODIFY, ADDR note
invoke LoadIcon, hInstance, ProgIcon
invoke ShellAbout, NULL,ADDR AboutBoxTitle, ADDR AboutBoxText, eax
dec StatusInfo
; change this to show the current status instead.
;; invoke lstrcpy, ADDR note.szTip, ADDR NotRunningText
invoke LoadIcon, hInstance, ProgIcon
mov note.hIcon, eax
invoke Shell_NotifyIcon, NIM_MODIFY, ADDR note
menu:
.elseif ax==IDM_ChangeRate
; popup a dialog asking use to set the hourly rate
invoke lstrcpy, ADDR note.szTip, ADDR ChangeRateText
invoke Shell_NotifyIcon, NIM_MODIFY, ADDR note
invoke DialogBoxParam, hInstance, IDD_RATE,0,ADDR GetRateProc,NULL
.elseif ax==IDM_Stop
; stop counting
invoke lstrcpy, ADDR note.szTip, ADDR NotRunningText
invoke Shell_NotifyIcon, NIM_MODIFY, ADDR note
invoke KillTimer, hWnd, 0
.elseif ax==IDM_Start
; get the current ms counter
invoke GetTickCount
; clear up old one not needed anymore
mov startMS, eax
mov startTime,eax
; start of a windows timer for n seconds
invoke SetTimer,hWindow,NULL,(1*60)*1000,NULL ; Set the timer to 60000 mSec (1 min)
; start counting
invoke lstrcpy, ADDR note.szTip, ADDR StartedText
invoke Shell_NotifyIcon, NIM_MODIFY, ADDR note
.elseif ax==IDM_Stop
; pause counting
invoke lstrcpy, ADDR note.szTip, ADDR PausedText
invoke Shell_NotifyIcon, NIM_MODIFY, ADDR note
invoke KillTimer, hWnd, 0
.endif
.endif
.elseif uMsg==WM_SHELLNOTIFY
.if wParam==IDI_TRAY
.if (lParam==WM_LBUTTONDOWN) || (lParam==WM_RBUTTONDOWN)
; popup menu
invoke GetCursorPos, ADDR pt
invoke TrackPopupMenu, hPopupMenu, TPM_LEFTALIGN, pt.x, pt.y, NULL, hWindow, NULL
.endif
.endif
.elseif uMsg==WM_TIMER
; temp test, remove later !! :)
; mov ratePerHour,600
; calculate
invoke CalcRate2
; convert current amount made from float to ascii,
lea esi,made
fld dword ptr [esi]
fstp [Nb]
invoke FloatToStr, [Nb], ADDR ETDData
; invoke DebugPrint, addr ETDBuffer
invoke lstrcpy, ADDR note.szTip, ADDR ETDBuffer
invoke OutputDebugStringA, ADDR ETDBuffer
invoke Shell_NotifyIcon, NIM_MODIFY, ADDR note
.elseif uMsg==WM_DESTROY
; quit
invoke Shell_NotifyIcon, NIM_DELETE, ADDR note
invoke PostQuitMessage, NULL
return 0
.endif
invoke DefWindowProc, hWindow, uMsg, wParam, lParam
ret
WindowProc ENDP
;===============================================================================================
; SetBmpColor
;===============================================================================================
SetBmpColor proc hBitmap:DWORD
LOCAL mDC :DWORD
LOCAL hBrush :DWORD
LOCAL hOldBmp :DWORD
LOCAL hReturn :DWORD
LOCAL hOldBrush :DWORD
invoke CreateCompatibleDC, NULL
mov mDC, eax
invoke SelectObject, mDC, hBitmap
mov hOldBmp, eax
invoke GetSysColor, COLOR_BTNFACE
invoke CreateSolidBrush, eax
mov hBrush, eax
invoke SelectObject, mDC, hBrush
mov hOldBrush, eax
invoke GetPixel,mDC, 1, 1
invoke ExtFloodFill, mDC, 1, 1, eax, FLOODFILLSURFACE
invoke SelectObject, mDC, hOldBrush
invoke DeleteObject, hBrush
invoke SelectObject, mDC, hBitmap
mov hReturn, eax
invoke DeleteDC, mDC
mov eax, hReturn
ret
SetBmpColor endp
;===============================================================================================
; GetRateProc
;===============================================================================================
GetRateProc proc hDlg:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM
LOCAL rateDollars:DWORD
LOCAL rateCents:DWORD
mov eax,iMsg
.if eax==WM_INITDIALOG
.elseif eax==WM_COMMAND
LOWORD wParam
.if eax==ID_OK
invoke GetDlgItemInt, hDlg,IDC_DOLLARS,NULL,0
mov rateDollars,eax
; convert to p
mov ebx,100
mul ebx
mov ratePerHour,eax
invoke GetDlgItemInt, hDlg,IDC_CENTS,NULL,0
mov rateCents,eax
; add to dollarrs for one figure in units
add ratePerHour,eax
invoke EndDialog,hDlg,TRUE
.elseif eax==IDCANCEL
invoke EndDialog,hDlg,FALSE
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
GetRateProc endp
;===============================================================================================
; Float2ASCII - Convert a float to an ASCIZ string
;===============================================================================================
Float2ASCII proc
LOCAL Nb:QWORD
fld QWORD PTR [esi]
fstp [Nb]
invoke FloatToStr, [Nb], ADDR ETDData
ret
Float2ASCII endp
;===============================================================================================
; CalcRate2 - Calculate how much has been earnt since started.
;===============================================================================================
CalcRate2 proc
; use a local!!
sub esp, 8
; ms = GetTickCount()-startTime;
; get current ms counter
invoke GetTickCount
; eax = edx = ms
mov edx, eax
; rph = rateperhour
fild dword ptr ratePerHour
; this really only needs to be done everytime the rate is updated or at start
; rph = rph/100.0
fmul dword ptr div2
; get start time in ms
mov ecx, dword ptr startTime
; made = rph * (( ms/60.0)/60.0)
fld dword ptr div60
fxch st(1)
; store as float / 100.0
fst dword ptr rph
; ms = current - last
sub edx, ecx
mov eax, 274877907
mul edx
shr edx, 6
; store secs count (for debug) yes yes i know it says ms, its milli vanilli seconds
mov dword ptr milliSeconds, edx
; now do the actual math
mov dword ptr [esp], edx
fild dword ptr [esp]
shr edx, 31
fadd dword ptr fipaddcon[0+edx*4]
fmul st, st(2)
fmulp st(2), st
fmulp st(1), st
; store the amount calculated
fstp dword ptr made
; use a local!
add esp, 8
ret
CalcRate2 endp
end code
Last edited by charliex; 11-19-2003 at 10:50 PM.. |
|
|
| Thread Tools | |
|
|