Are you Secondary or Primary? We plan to do a secondary version as soon as possible.
Lazarus404: The program (at present) is just to do end of term reports quickly and easily. It will be expanded to do more, but this will be after the initial takeup before Easter. The main thing we are concentrating on is getting the statement database to between 15,000 and 20,000 statements and to getting the feature ready and bug-free. The database is an internal format, but it can/does import from various other formats including those that use access .mdb format. I don't mind PM'ing with you about cross product promotion, I would have to speak to the other people here at ApplePanic first though before commiting to anything. Your app sounds great btw.
zikirake: I don't know why, I'll get in touch with them. Some anti-virus programs are a bit wierd. The AutoUpdate.exe code is basically a hack just to get a file downloaded with a progress bar. Here is the source code:
Code: Select all
; ReportBuilder autoupdate
#WindowW=600
#OX=4
#OY=4
#BtnH=20
#BtnW=90
#ZoomH=30
#SpcX=4
#SpcY=4
#SpcX2=#SpcX*2
#BtnW2=#BtnW+#SpcX
#WindowH=(#OX*2)+(#BtnH*2)+#SpcY
Global Url.s, SaveTo.s, MainWindow.l
Global Abort,Complete,Fault
Structure ProgressData
Progress.l ; bytes downloaded
ProgressMax.l ; bytes total (this value might change during the download)
StatusCode.l ; A code indicating what is happening
EndStructure
Structure IID ; Interface Identifier structure. a IID is a 16byte value, that uniquely
Data1.l ; identifys each interface.
Data2.w
Data3.w
Data4.b[8]
EndStructure
#WM_DOWNLOADPROGRESS = #WM_USER + 1
#WM_DOWNLOADEND = #WM_USER + 2
Enumeration 1
#BINDSTATUS_FINDINGRESOURCE
#BINDSTATUS_CONNECTING
#BINDSTATUS_REDIRECTING
#BINDSTATUS_BEGINDOWNLOADDATA
#BINDSTATUS_DOWNLOADINGDATA
#BINDSTATUS_ENDDOWNLOADDATA
#BINDSTATUS_BEGINDOWNLOADCOMPONENTS
#BINDSTATUS_INSTALLINGCOMPONENTS
#BINDSTATUS_ENDDOWNLOADCOMPONENTS
#BINDSTATUS_USINGCACHEDCOPY
#BINDSTATUS_SENDINGREQUEST
#BINDSTATUS_CLASSIDAVAILABLE
#BINDSTATUS_MIMETYPEAVAILABLE
#BINDSTATUS_CACHEFILENAMEAVAILABLE
#BINDSTATUS_BEGINSYNCOPERATION
#BINDSTATUS_ENDSYNCOPERATION
#BINDSTATUS_BEGINUPLOADDATA
#BINDSTATUS_UPLOADINGDATA
#BINDSTATUS_ENDUPLOADINGDATA
#BINDSTATUS_PROTOCOLCLASSID
#BINDSTATUS_ENCODING
#BINDSTATUS_VERFIEDMIMETYPEAVAILABLE
#BINDSTATUS_CLASSINSTALLLOCATION
#BINDSTATUS_DECODING
#BINDSTATUS_LOADINGMIMEHANDLER
#BINDSTATUS_CONTENTDISPOSITIONATTACH
#BINDSTATUS_FILTERREPORTMIMETYPE
#BINDSTATUS_CLSIDCANINSTANTIATE
#BINDSTATUS_IUNKNOWNAVAILABLE
#BINDSTATUS_DIRECTBIND
#BINDSTATUS_RAWMIMETYPE
#BINDSTATUS_PROXYDETECTING
#BINDSTATUS_ACCEPTRANGES
EndEnumeration
Structure IBindStatusCallback_Functions
QueryInterface.l
AddRef.l
Release.l
OnStartBinding.l
GetPriority.l
OnLowResource.l
OnProgress.l
OnStopBinding.l
GetBindInfo.l
OnDataAvailable.l
OnObjectAvailable.l
EndStructure
IBindStatusCallback_Functions.IBindStatusCallback_Functions
Structure StatusObject
*IBindStatusCallback.IBindStatusCallback_Functions
EndStructure
Global StatusObject.StatusObject
StatusObject\IBindStatusCallback = IBindStatusCallback_Functions
Procedure.l StatusObject_QueryInterface(*THIS.StatusObject, *iid.IID, *Object.LONG)
If CompareMemory(*iid, ?IID_IUnknown, SizeOf(IID)) Or CompareMemory(*iid, ?IID_IBindStatusCallback, SizeOf(IID))
*Object\l = *THIS
ProcedureReturn #S_OK
Else
*Object\l = 0
ProcedureReturn #E_NOINTERFACE
EndIf
EndProcedure
Procedure.l StatusObject_AddRef(*THIS.StatusObject)
Shared StatusObject_Count.l
StatusObject_Count + 1
ProcedureReturn StatusObject_Count
EndProcedure
Procedure.l StatusObject_Release(*THIS.StatusObject)
Shared StatusObject_Count.l
StatusObject_Count - 1
ProcedureReturn StatusObject_Count
EndProcedure
Procedure.l StatusObject_OnStartBinding(*THIS.StatusObject, Reserved.l, *IB.IBinding)
ProcedureReturn #S_OK
EndProcedure
Procedure.l StatusObject_GetPriority(*THIS.StatusObject, *Priority.LONG)
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l StatusObject_OnLowResource(*THIS.StatusObject)
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l StatusObject_OnProgress(*THIS.StatusObject, Progress.l, ProgressMax.l, StatusCode.l, szStatusText.l)
ProgressData.ProgressData
ProgressData\Progress = Progress
ProgressData\ProgressMax = ProgressMax
ProgressData\StatusCode = StatusCode
Length = WideCharToMultiByte_(#CP_ACP, 0, szStatusText, -1, 0, 0, 0, 0)
*String = HeapAlloc_(GetProcessHeap_(), 0, Length) ; allocate memory for the string
WideCharToMultiByte_(#CP_ACP, 0, szStatusText, -1, *String, Length, 0, 0)
Result = SendMessage_(MainWindow,#WM_DOWNLOADPROGRESS,@ProgressData, *String) ; send a message to the main routine
HeapFree_(GetProcessHeap_(), 0, *String) ; free the string
If Result = #True ; if the message returns true, then abort download!
ProcedureReturn #E_ABORT
Else
ProcedureReturn #S_OK
EndIf
EndProcedure
Procedure.l StatusObject_OnStopBinding(*THIS.StatusObject, Result.l, szError.l)
ProcedureReturn #S_OK
EndProcedure
Procedure.l StatusObject_GetBindInfo(*THIS.StatusObject, BINDF.l, *bindinfo)
ProcedureReturn #S_OK
EndProcedure
Procedure.l StatusObject_OnDataAvailable(*THIS.StatusObject, BSCF.l, Size.l, *formatec, *stgmed)
ProcedureReturn #S_OK
EndProcedure
Procedure.l StatusObject_OnObjectAvailable(*THIS.StatusObject, *iid.IID, *UNK.IUnknown)
ProcedureReturn #S_OK
EndProcedure
IBindStatusCallback_Functions\QueryInterface = @StatusObject_QueryInterface()
IBindStatusCallback_Functions\AddRef = @StatusObject_AddRef()
IBindStatusCallback_Functions\Release = @StatusObject_Release()
IBindStatusCallback_Functions\OnStartBinding = @StatusObject_OnStartBinding()
IBindStatusCallback_Functions\GetPriority = @StatusObject_GetPriority()
IBindStatusCallback_Functions\OnLowResource = @StatusObject_OnLowResource()
IBindStatusCallback_Functions\OnProgress = @StatusObject_OnProgress()
IBindStatusCallback_Functions\OnStopBinding = @StatusObject_OnStopBinding()
IBindStatusCallback_Functions\GetBindInfo = @StatusObject_GetBindInfo()
IBindStatusCallback_Functions\OnDataAvailable = @StatusObject_OnDataAvailable()
IBindStatusCallback_Functions\OnObjectAvailable = @StatusObject_OnObjectAvailable()
DataSection
IID_IUnknown: ; {00000000-0000-0000-C000-000000000046}
Data.l $00000000
Data.w $0000, $0000
Data.b $C0, $00, $00, $00, $00, $00, $00, $46
IID_IBindStatusCallback: ; {79eac9c1-baf9-11ce-8c82-00aa004ba90b}
Data.l $79eac9c1
Data.w $baf9, $11ce
Data.b $8c, $82, $00, $aa, $00, $4b, $a9, $0b
EndDataSection
Enumeration
#DownloadWindow
EndEnumeration
Enumeration
#Gadget_1
#Gadget_2
#Gadget_Url
#Gadget_SaveTo
#Gadget_ChooseFile
#Gadget_Status
#Gadget_Progress
#Gadget_Start
#Gadget_Stop
#Gadget_Close
#Gadget_StatusText
EndEnumeration
Procedure BackgroundDownload(Dummy.l)
Result.l = URLDownloadToFile_(0, @Url, @SaveTo, 0, @StatusObject)
SendMessage_(MainWindow, #WM_DOWNLOADEND, 0, Result)
EndProcedure
Procedure WindowCallback(Window.l, Message.l, wParam.l, lParam.l)
Result.l = #PB_ProcessPureBasicEvents
Select Message
Case #WM_DOWNLOADPROGRESS
*Progress.ProgressData = wParam
; let's update the ProgressBar:
If *Progress\Progress = *Progress\ProgressMax Or *Progress\ProgressMax = 0
SetGadgetState(#Gadget_Progress, 0)
Else
SetGadgetState(#Gadget_Progress, (*Progress\Progress*100)/*Progress\ProgressMax)
EndIf
ProcedureReturn Abort
Case #WM_DOWNLOADEND ; download finished:
If lParam = #S_OK ;jippeeeee :)
SetGadgetState(#Gadget_Progress, 100)
Else
Fault=#True
EndIf
Complete=#True
DisableGadget(#Gadget_Stop, #True)
EndSelect
ProcedureReturn Result
EndProcedure
Name$="ReportBuilder Update"
MainWindow=OpenWindow(#DownloadWindow,0,0,#WindowW,#WindowH,#PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_ScreenCentered,Name$)
If MainWindow=0
Goto Error
EndIf
If CreateGadgetList(WindowID())=0
Goto Error
EndIf
ProgressBarGadget(#Gadget_Progress,#OX,#OY,#WindowW-(#OX*2),#BtnH,0,100)
ButtonGadget(#Gadget_Stop,#WindowW-#OX-#BtnW,#OX+#BtnH+#SpcY,#BtnW,#BtnH, "Abort")
SetWindowCallback(@WindowCallback())
DisableGadget(#Gadget_Stop, #True) ; who needs an 'abort' button now?
; A nice little extra for the StringGadgets: AutoComplete feature only present on IE5+, so we load the function manually
#SHACF_URLALL = 2|4
#SHACF_FILESYSTEM = 1
CoInitialize_(0)
Complete=#False
Abort = #False ; set Abort to false, so our download doesn't get stopped imediately
DisableGadget(#Gadget_Stop, #False)
SetGadgetState(#Gadget_Progress, 0) ; clear gadgets:
Url = "http://www.applepanic.com/downloads/rb/install.exe"
SaveTo = "install.exe"
CreateThread(@BackgroundDownload(), 0) ; finally, start the download by creating the thread:
Repeat
Event = WindowEvent()
Select Event
Case #PB_EventCloseWindow
Abort=#True
Case #PB_EventGadget
Select EventGadgetID()
Case #Gadget_Stop
Abort=#True
EndSelect
Default
Delay(1)
EndSelect
Until Abort=#True Or Complete=#True
If Abort=#True
MessageRequester(Name$,"You aborted the download, no changes made!"+Chr(10)+"Click okay to restart ReportBuilder...")
RunProgram("ReportBuilder.exe")
Else
If Fault=#True
MessageRequester(Name$,"The download was NOT successful!"+Chr(10)+"Click okay to restart ReportBuilder...")
RunProgram("ReportBuilder.exe")
Else
MessageRequester(Name$,"The download was a success!"+Chr(10)+"Click okay to install new the version of ReportBuilder...")
RunProgram("Install.exe","auto","")
EndIf
EndIf
End
Error:
MessageRequester(Name$,"An error occurred while initialising the AutoUpdate..."+Chr(10)+"Click okay to restart ReportBuilder...")
RunProgram("ReportBuilder.exe")
End