Welcome to MSDN Blogs Sign in | Join | Help

More DECLARE DLL performance discussion

In this post DECLARE DLL performance questions I asked whether using the WIN32API keyword or the particular DLL file name would be faster. It turns out that Win32API is much faster, and Martin Jindra, Timo, and Fabio Lunardon answered correctly that with Win32API, VFP doesn’t have to deal with files at all, but rather just DLLs that are already loaded.

 

Instead of dealing with files, DECLARE DLL for a Win32API calls the much faster GetModuleHandle to find the handle for the already loaded DLL.

 

Fabio goes on to ask whether the “A” feature can be restricted to Win32API calls. However, this is very difficult, because the DLLs that comprise the Win32API are not constant from Windows version to Windows version. For example, the VFP GETDIR() function calls the  SHBrowseForFolder  API, which is implemented in Shell32.dll.

 

GETDIR("c:\Windows","Description","Window Caption",64)

 

The AddUrlToFavorites function is found in shdocvw.dll. The GDIPlus Win32API functions are found in GDIPlus.dll Also, not every Win32API DLL is loaded in every process.

 

Published Thursday, April 27, 2006 10:57 AM by Calvin_Hsia

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: More DECLARE DLL performance discussion

Thursday, April 27, 2006 2:59 PM by RyanNerd
Thanks Calvin for this very useful info.

I used to take the time and research what DLL a system function was in so that I could "improve the performance" by directly referencing it in my DECLARE statements.

Stupid me (I'm wiser now thanks to you).

-Ryan(Nerd)

# re: More DECLARE DLL performance discussion

Thursday, April 27, 2006 4:21 PM by Fabio Lunardon
With requirements OS,
can you calls GetModuleHandleEx for other dlls ?

Can you implement a SET/SYS() for disable the "A" feature ?

# What API calls reset GetLastError between Declare DLL calls in VFP8?

Wednesday, May 03, 2006 2:32 PM by Calvin Hsia's WebLog
I received a comment on this post: Will GetLastError ever work properly in VFP8.0?.  I was consistently...

# performance discussion

Sunday, June 01, 2008 2:53 AM by performance discussion

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker