Eureeka! 
Author Message
 Eureeka!

Eureka!

I thought I'd offer this little story, just in case anyone else has been
having sleepless nights trying to use an undocumented API call - like what I
woz doooin. I was porting a bit of code from VB to PBDLL and had an
undocumented API call (as we often do!). The function definition I had used
in VB was as follows (remember that the VB app was running fine!)

PRIVATE DECLARE FUNCTION WNetEnumCachedPasswords LIB "mpr.dll" (etc.) AS
LONG

So I changed it to

DECLARE FUNCTION WNetEnumCachedPasswords LIB "mpr.dll" (etc.) AS LONG

.and then spent 2 days trying to get the damn thing to work. Result, the app
simply refused to run - no warning messages, no dialogs - hit the
compile/run button and nothing.. zip.. nada.. I thought I had a problem with
the proc addressing (ADDRESSOF in VB, CODEPTR in PBDLL) so I foolishly
concentrated there.

Last night, I hit the Compile/Debug button in PBDLL by mistake and got an
error message saying that the PBDLLTMP.EXE file was linked to missing export
MPR.DLL:WNETENUMCACHEDPASSWORDS

Oh.. S*&%% - The light went on, and I remembered that the CASE of the
function is just (ever so slightly) important.

Changed it to

DECLARE FUNCTION WNetEnumCachedPasswords LIB "mpr.dll"  _
   ALIAS "WNetEnumCachedPasswords" (etc.) AS LONG

And off we went. Yahooo!!!!

The m{*filter*}of the story (and there are a few).

1. If it ain't in the WIN32API file then REMEMBER TO ALIAS or you loose the
function case, and it don't go !!!!!!!!!!
2. PB's got a cool debug button - I must remember to use it !!
3. If Microsoft don't document an API, they don't want you to use it.
4. It's little things like this that make it all worthwhile!
5. I think I need to get out more.

Anyway, I'm happy now, the app works, and I've stopped shouting at the
kids...

Right, now how do I get a PBDLL/DDT dialog pretend it's an NT service? - Ah,
I think I've got an undocumented function for that here somewhere.

Alan Jones

This public service announcement is released in the hope that it may avoid
some programmers getting sleepless nights. For real programmers, sleep is
not a keyword, it's that thing you do between contracts.



Mon, 01 Apr 2002 03:00:00 GMT  
 Eureeka!

Quote:
Alan Jones wrote...
> The m{*filter*}of the story (and there are a few).

> 1. If it ain't in the WIN32API file then REMEMBER TO ALIAS or you loose the
> function case, and it don't go !!!!!!!!!!
> 2. PB's got a cool debug button - I must remember to use it !!
> 3. If Microsoft don't document an API, they don't want you to use it.
> 4. It's little things like this that make it all worthwhile!
> 5. I think I need to get out more.

HA! I wrote nearly this very list about six weeks ago :) I had
the EXACT same problem using the Win API :) I could've SWORN I was
spelling CoInitialize() correctly, ya know?

Quote:
> Right, now how do I get a PBDLL/DDT dialog pretend it's an NT service? - Ah,
> I think I've got an undocumented function for that here somewhere.

See my response to your other message. The process to create an NT Service
is actually quite well documented.

- Troy



Tue, 02 Apr 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 
 

 
Powered by phpBB® Forum Software