Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 To: onytoo
  Where is onytoo?
 Padang
 Indonesia
 onytoo
 Tags
Subject: RE: declare warning
Thread ID: 310907 Message ID: 311250 # Views: 37 # Ratings: 0
Version: Visual FoxPro 9 Category: Projects and Design
Date: Wednesday, June 29, 2011 11:38:01 PM         
   


> >
> > There's another point in colleague Martina's post: check if the DLL you need has already been loaded with ADLLS() function. I even wrote a wrapper function specifically for this very purpose. Here it is
> >
> >
***********************************************************************************************************************************
> > FUNCTION DLL_IsLoaded(tcFunctName)
> > ***********************************************************************************************************************************
> > ** Function Name : DLL (function) Is Loaded
> > ** Purpose       : Checks if the API function in subject has been already declared/loaded.
> > ** Description   : Uses built-in ADLLS() function to place the info on loaded API functions into a local array, and then scans
> > **                 this array in search for the function name - or the latter's alias name - in subject.
> > ** Parameter(s)  : Sought API function's - or alias' - name as String (by val.): mandatory
> > ** Return        : Success as Boolean.
> > ** Side Effect(s): None.
> > ** Notes:        : 1. Silent.
> > **                 2. Case insensitive.
> > ** Author	 : Ilya I. Rabyy
> > ** Revisions	 : 
> > ***********************************************************************************************************************************
> > IF TYPE("tcFunctName") # "C"
> >    RETURN .F.
> > ENDIF
> > 
> > LOCAL ARRAY laDLL[1]
> > LOCAL lcFunctName, lnRet, I
> > 
> > lcFunctName = ALLTRIM(UPPER(tcFunctName))
> > 
> > lnRet = ADLLS(laDLL)
> > 
> > FOR I = 1 TO lnRet
> >    IF UPPER(laDLL[I, 1]) == lcFunctName .OR. UPPER(laDLL[I, 2]) == lcFunctName && Covers also possible alias name
> >       EXIT  && FOR...NEXT cycle
> >    ENDIF
> > NEXT I
> > 
> > RETURN (I <= lnRet)
> > ENDFUNC
> > ***********************************************************************************************************************************

> > HTH.
> >
> > Regards,
> >
> > Ilya
>
>
> That is good stuff, but I think not necessary to do
> It will slow down your app.
>
> If you want just give one public variable or user defined _vfp/_screen property
>
>
> *!*
> *!* declare_api.prg
> *!*
> *!* you can call this prg from anywhere and anytime
> *!*
> 
> IF TYPE([m.glDeclare_API_Functions]) == [U]
>   PUBLIC glDeclare_API_Functions
> ENDIF
> IF m.glDeclare_API_Functions
>   RETURN
> ENDIF
> 
> m.glDeclare_API_Functions = .T.
> 
> *!* declare all api functions that you want here
> *!*
> 

>
>
> Regards,
> Onytoo

Actually, my idea was to check if the API function that is needed right
here/now is already loaded. The code in this my little function doesn't
take long to execute because both, ADLLS() and ASORT(), are written in C/C++,
the best languge for the fastest execution I know of.
OTOH, to have all the DLLs loaded at the start is also OK, as long as the
quantity of them - and, thus, the RAM consumption - is not that significant.
However, I myself had a program (written in VFP7) that used a slew of DLLs
(some belonged to WinAPI, but majority of them were custom ones, written by C/C++
programmer in my department). Since this my program went for sale-off-the-shelves,
and the consumers of my product worked on a wide variety of machines and/or WinOS's,
ranging from WinNT 3.5 on P1 with 256 MB RAM, to WinXP on P4 2GB RAM... I hope
you understand what I am saying.

Regards,

Ilya

ENTIRE THREAD

declare warning Posted by Martin Krivka @ 6/27/2011 7:37:00 AM
RE: declare warning Posted by Martina Jindrov√° @ 6/27/2011 7:58:16 AM
RE: declare warning Posted by Martin Krivka @ 6/27/2011 9:04:43 AM
RE: declare warning Posted by onytoo @ 6/27/2011 8:29:25 PM
RE: declare warning Posted by Ilya Rabyy @ 6/28/2011 6:57:26 PM
RE: declare warning Posted by onytoo @ 6/28/2011 9:27:55 PM
RE: declare warning Posted by Ilya Rabyy @ 6/29/2011 11:38:01 PM
RE: declare warning Posted by onytoo @ 6/30/2011 9:18:57 AM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 9:29:38 PM
RE: declare warning Posted by onytoo @ 6/28/2011 9:41:42 PM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 10:19:09 PM
RE: declare warning Posted by Ilya Rabyy @ 6/29/2011 11:42:56 PM
RE: declare warning Posted by Martin Krivka @ 6/30/2011 8:46:05 AM
RE: declare warning Posted by Ilya Rabyy @ 6/30/2011 4:34:36 PM
RE: declare warning Posted by Martin Krivka @ 6/30/2011 5:20:37 PM
RE: declare warning Posted by Ilya Rabyy @ 6/30/2011 6:21:06 PM
RE: declare warning Posted by onytoo @ 6/30/2011 10:14:51 PM
RE: declare warning Posted by Ilya Rabyy @ 6/30/2011 10:45:55 PM
RE: declare warning Posted by onytoo @ 7/1/2011 12:13:20 AM
RE: declare warning Posted by Samir H. @ 7/1/2011 5:53:19 AM
RE: declare warning Posted by onytoo @ 7/1/2011 10:59:04 AM
RE: declare warning Posted by Ilya Rabyy @ 7/1/2011 4:37:50 PM
RE: declare warning Posted by onytoo @ 7/1/2011 7:35:38 PM
RE: declare warning Posted by Mike Yearwood @ 7/1/2011 2:31:27 AM
RE: declare warning Posted by Cetin Basoz @ 6/28/2011 11:02:20 AM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 12:09:38 PM
RE: declare warning Posted by onytoo @ 6/28/2011 12:15:01 PM
RE: declare warning Posted by Samir H. @ 6/28/2011 2:17:07 PM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 3:41:05 PM
RE: declare warning Posted by Cetin Basoz @ 6/28/2011 4:15:06 PM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 9:18:29 PM
RE: declare warning Posted by onytoo @ 6/30/2011 9:28:04 AM