Check File Open Another Process Using API In PowerBuilder
External Function Declaration
1 2 3 |
//[External Function Declaration] Function Long CreateFile(Ref String lpszName, Long fdwAccess, Long fdwShareMode, Long lpsa, Long fdwCreate, Long fdwAttrsAndFlags, Long hTemplateFile) Library "Kernel32.dll" Alias For "CreateFileA;Ansi" Function Boolean CloseHandle (Long file_hand) Library "KERNEL32.DLL" |
PowerScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
//PowerScript Constant ULong GENERIC_ACCESS = 268435456 Constant ULong EXCLUSIVE_ACCESS = 0 Constant ULong OPEN_EXISTING = 3 Long ll_handle String ls_file ls_file = "c:\temp\myfile.xls" ll_handle = CreateFile ( ls_file, GENERIC_ACCESS, EXCLUSIVE_ACCESS, 0, OPEN_EXISTING, 0, 0) If ll_handle < 1 Then MessageBox("Infor", "Can't open, maybe missing or already opened ?") Else MessageBox("Warning","File can be opened") End If CloseHandle(ll_handle) |
Good Luck!
Subscribe
Login
0 Comments