Try change it: IF Empty (hLib) ---> IF Valtype(hLib) <> "P" if hLib <= 32 ---> IF Valtype(hLib) <> "P"
I'm not sure this would work. 'P' type is returned even in case of error, but its content is NULL. To solve this specific and similar cases, I've added WIN_P2N() function, so such code can be used (until we don't find something even better): h := wapi_LoadLibrary( "my.dll" ) IF win_P2N( h ) > 32 ? "OK" ENDIF Probably better would be to use something like wapi_GetLastError() or even to embed '<= 32' to a slightly higher level API, win_LoadLibrary(), which would return NULL in all error cases, automatically: // [ this isn't implemented yet in Harbour ] h := win_LoadLibrary( "my.dll" ) IF ! Empty( h ) ? "OK" ENDIF Maybe I should explain the win_ vs. wapi_ naming logic: 'wapi_' is everything which is a plain wrapper to a single Windows API call, replicating all functions and return values as is. 'win_' is everything which uses Windows API calls to achieve a goal, but such function may combine these or add some extra logic to make usage easier, in fact everything which isn't wapi_ should be called win_. Brgds, Viktor _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour