FoxBarcode Project : API Function DeleteObject. Can be renamed?

Topics: Attention VFPX Admins, Bug Information, General
Oct 6, 2013 at 11:02 PM
Hi, recently I start to test foxbarcode class, and I can read the barcodes even from very screen. That's a goal.

But, I have the new trouble now : The function DeleteObject had the same name, the very same name, in another API that I usually use!
Then, How can I rename the API Function name? Otherwise, How I can use both functions with same name?

See :
DECLARE INTEGER DeleteObject IN gdi32 INTEGER hObject
and
DECLARE LONG DeleteObject IN Win32API LONG hObject

When I declare DeleteObject in GDI32, VFP release DeleteObject in Win32API? I need them both working at same time!

Please, I need a lot of help with this.
BTW : I had test : DeclareObject in gdi32 Integer Hobject AS BarcodeDelObject
and did not worked! The compiler didn't recognized and declared missing.

Thanks in advance,
David Brea.
Developer
Oct 7, 2013 at 6:33 PM
Edited Oct 7, 2013 at 7:52 PM
Hi David

You have 2 workarounds:
  1. Change in the Destroy method in gpInit class in gpImage2.prg file, the line:
# IF VERSION (5)>= 700
by the line:
# IF VERSION (5)>= 999
This change will not execute the statements CLEAR DLLS
  1. Assign an alias in the DeleteObject API function declaration in the file gpImage2.prg:
  DECLARE LONG AS GPI2_DeleteObject WIN32API DeleteObject IN;
     LONG hObject
and change all (3 in all gpImage2.prg file) DeleteObject function calls by the alias GPI2_DeleteObject

Example:
GPI2_DeleteObject(m.hBmp) && Old: DeleteObject(m.hBmp)
And also change in the line:
CLEAR DLLS ("DeleteObject")
by
CLEAR DLLS ("GPI2_DeleteObject")
Luis Maria Guayan
FoxBarcode Team

Oct 12, 2013 at 9:40 PM
Hi Luis, thanks for answer.

I had tested both and the first one it is not a viable solution, at least in my environment.

Second method, did the job .

In addition, I give you my solution :

When I am going to use the foxbarcode class, before I execute the report,
I clear the previous DeleteObject function, and use the foxbarcode class and
print my barcodes, after report execution, I clear the actual DeleteObject
function and declare again the previous DeleteObject
function, in order to get the previous behavior.

As I only use a report at a time (for VFP reports), and had not found how to use in other way,
this technique works flawlessly for me.

Thanks,
David Brea
Dominican Republic.