Re: Getting extended error information for PlaySound
From: MikeD (nobody_at_nowhere.edu)
Date: 04/05/04
- Next message: Jim Deutch: "Re: Reparented form crashes"
- Previous message: Simon Woods: "Re: Reparented form crashes"
- In reply to: Robert: "Re: Getting extended error information for PlaySound"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 5 Apr 2004 11:08:51 -0400
"Robert" <noone@nowhere.com> wrote in message
news:Ou8whytGEHA.3540@TK2MSFTNGP09.phx.gbl...
> I've seen GetLastError work in VB, it only seems to depend on the API
call.
Not likely. What you may have seen is GetLastError return the error value
of an API call that the VB runtime or a custom control made. The point is,
it probably wasn't an error value for an API function that you called.
> LastDllError didn't return anything useful, either (is there something I
> have to do to make it work, shouldn't it just be set when VB detects an
> error?)
Not all API functions set an error number. VB can't, and doesn't, "detect"
these. The API function must be specifically written to set an error
number. If it does, Err.LastDllError will have the value. There's nothing
special you need to do.
BTW, the PlaySound API function is NOT a function that sets an error value.
If a function sets it, the Platform SDK will indicate so. For example, the
function's documentation will say something like "To get extended error
information, call GetLastError."
>
> Robert
>
> "MikeD" <nobody@nowhere.edu> wrote in message
> news:ODSjmLMGEHA.3404@TK2MSFTNGP10.phx.gbl...
> >
> > "Robert" <noone@nowhere.com> wrote in message
> > news:O24a$sJGEHA.1240@TK2MSFTNGP10.phx.gbl...
> > > Is there any way to get additional information about why a sound could
> not
> > > be played? Is there no device, is it busy, or maybe the file is
corrupt?
> > > Although some sources indicate that GetLastError should provide that
> > > information, I always get a zero on that.
> >
> >
> > You can't call GetLastError in VB (well, you can; it's just useless).
Use
> > the Err object's LastDllError property instead.
> >
> > Mike
> >
> >
>
>
- Next message: Jim Deutch: "Re: Reparented form crashes"
- Previous message: Simon Woods: "Re: Reparented form crashes"
- In reply to: Robert: "Re: Getting extended error information for PlaySound"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|