We are currently migrating from PB 8.0.3 to 10.0.2 and are having
issues with COPYFILEA always returning FALSE, and subsequently failing.
A previous posting talked about adding ANSI to our alias, however our
application's local external function has no alias:
Function boolean CopyFileA(ref string cfrom, ref string cto, boolean
flag) LIBRARY "Kernel32.dll"
The code we are trying to execute is:
IF i_l_read_write_status <> 1 or isnull(i_l_read_write_status) then
l_b_copy_file_flag = FALSE
l_s_copy_file_from = "c:\pb5\temp\" + i_s_ftp_filename
l_s_copy_file_to = "c:\pb5\temp\l_s_file2.doc"
l_b_copy_file_rtn = CopyFileA(l_s_copy_file_from, l_s_copy_file_to,
l_b_copy_file_flag)
IF l_b_copy_file_rtn = False THEN
mle_ole_text.text = mle_ole_text.text + "Failed to copy to temp
file. !~r~n"
This.TriggerEvent("ue_save_event_txt")
Messagebox("w_m_ole_report","Failed to copy to temp file - Notify
HelpDesk!", StopSign!, OK!, 1)
END IF
END IF
Does anyone our there have an example of what the alias should look
like?
Thanks,
Mike
Function boolean CopyFileA(ref string cfrom, ref string cto, boolean
flag) LIBRARY "Kernel32.dll" ALIAS FOR "CopyFileA;ANSI"
Alternatively you could just declare the UNICODE version of the API
function:
Function boolean CopyFileA(ref string cfrom, ref string cto, boolean
flag) LIBRARY "Kernel32.dll" ALIAS FOR "CopyFileW"
OR
Function boolean CopyFileW(ref string cfrom, ref string cto, boolean
flag) LIBRARY "Kernel32.dll"
Better yet, you could just use the built in FileCopy powerscript function.
Brad