It's purpose is to upload/download an access database. If the user has it open and tries to upload it, it uploads as 0 bytes and is successful.

Can I set the database for exclusive use somehow, or check in the ftp program so it won't upload when opened or in use on the local machine?

Thanks.
Posted on 2005-01-05 13:02:27 by drarem
erhm, if I understood your question correctly: the file_share_... flags from createfile specify if the file can be re-opened again. maybe this helps.
Posted on 2005-01-05 13:52:09 by lifewire
found better generic solution -

FindWindowEx

thanks
Posted on 2005-01-05 13:56:19 by drarem
Are you planning on sharing your source or just the binary? I know little about the details of writing an FTP app, and am kinda currious about it. Nothing more really.

Regards,
:NaN:
Posted on 2005-01-08 11:05:40 by NaN
probably best to set the dwShareMode paramater to zero, that should onnly return a handle if the file isn''t open allready.
Posted on 2005-01-08 11:48:06 by QuantumMatrix1024
Here is my proc to upload the file to the server, it's easier than I thought, I went between MSDN and this site to put the code together.





CheckFileIn proc
;;TODO: Upload to a temp remote file first (Write_Update) to ensure entire file makes it across
;then rename temp remote file to actual .mde file
;also verify you were the one who checked out pdst and not someone else
;;
invoke CheckIOF ;see if it has been checked out by someone else

.if eax != NULL
invoke MessageBox,NULL, addr lpNotCheckedOut, addr etitle,MB_OK
ret
.elseif eax == NULL
invoke InternetOpen,addr appName,INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0
mov hOpen,eax

invoke InternetSetStatusCallback,hOpen, addr InternetStatusCallback

invoke InternetConnect,hOpen,addr serverName, INTERNET_DEFAULT_FTP_PORT, addr userName, addr userPassword,INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,addr Crap
mov ftpHandle,eax
invoke wsprintf,addr lpOut, addr lpConnectedTo, addr serverName
invoke SendMessage,hSBar,WM_SETTEXT,0,addr lpSFMT

;delete backup
invoke FtpDeleteFile,ftpHandle,addr RemoteNewName
;rename current .mde file to backup file
;;;invoke FtpRenameFile,ftpHandle,addr RemoteFile,addr RemoteNewName ;this part works

;transmit local file to host
invoke FtpOpenFile,ftpHandle,addr RemoteTempFile,GENERIC_WRITE,FTP_TRANSFER_TYPE_BINARY,addr InternetStatusCallback
mov ftpFile,eax

; invoke FtpPutFile,ftpHandle,addr NewFile,addr RemoteFile,FTP_TRANSFER_TYPE_BINARY,NULL

invoke Write_Update
invoke InternetCloseHandle,ftpFile

;close handle to remote temp file
;rename temp file to current .mde file

invoke FtpRenameFile,ftpHandle,addr RemoteFile,addr RemoteNewName ;this part works

invoke FtpRenameFile,ftpHandle,addr RemoteTempFile,addr RemoteFile

.endif
invoke InternetCloseHandle,hOpen
invoke InternetCloseHandle,ftpHandle
invoke ForceCheckIn
invoke MessageBox,NULL,addr comptext,addr gtitle,MB_OK
ret
CheckFileIn endp
Posted on 2005-01-10 07:25:52 by drarem