03-04-2007, 08:06 PM
I created a function and dialog that interfaces with an Access DB to help me keep track of hours worked for my many jobs. It works great. I'll post the code once complete. I made the dialog style a WS_POPUP to remove the title bar so I can stick it at the top of the screen and not be distracted. The problem is that I can't move it now. Is there a way to drag it around? Thanks
Matt B
Code:
Matt B
Code:
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90000244 0x100 0 0 130 13 "Work Hours"
;2 Button 0x54032000 0x0 120 0 10 12 "x"
;3 Button 0x54032000 0x0 0 0 12 12 "In"
;4 Button 0x54032000 0x0 12 0 16 12 "Out"
;5 Static 0x54001000 0x0 28 2 92 10 "Text"
;END DIALOG
;DIALOG EDITOR: "" 0x2020002 "" ""
ret
;messages
sel message
,case WM_CREATE
,,;declare varibles, make them thread scope
,,str- mess,InDT,OutDT, ConnStr, SQLStr,OSDStr, LogInTimeStr HoursTBText ElapsedHoursStr
,,str+ DBPath LoginID LoginDT LogoutDT LoginJobNote LoginWorkTypeAbbr LoginWorkType WorkTypes ConnStr SQLStr IsLoggedIn LoginWorkTypeID
,,int- r c ItemSel
,,ARRAY(str)+ RSArr
,,DATE+ LogInDATE NowDATE
,,SetTimer(hDlg 1 5000 0) ;;5 sec timer to update elasped time
,,Database+ DB
,,DBPath="$personal$\JPS Stuff\Invoices\Work Hours.mdb" ;;needed for all the functions that connect to the DB
,,;get last login data
,,GetLoginData
,,DispLoginData hDlg
,,ont hDlg
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_TIMER
,,DispLoginData hDlg
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3 ;;"In Button"
,,;get WorkTypes
,,GetWorkTypes
,,ItemSel=PopupMenu(WorkTypes)
,,;get menu selection and get WorkType ID, do nothing if no item selected
,,if(ItemSel<>0)
,,,;if logged in then, log out of previous job
,,,if(IsLoggedIn=1)
,,,,LogOut
,,,LoginWorkTypeID=RSArr[0 ItemSel-1] ;; get the work type selected
,,,LogIn
,,,GetLoginData ;;need the updated loginstuff
,,,;reset elapsed hours
,,,DispLoginData hDlg
,case 4 ;;"Out Button"
,,;connect to database
,,if(IsLoggedIn=1)
,,,LogOut
,,,LoginID=-1
,,,DispLoginData hDlg
,,else
,,,mes "You're not logged in."
ret 1
Matt B