Home All Groups Group Topic Archive Search About

How to convert error code to text??

Author
1 Jul 2005 12:08 PM
**Developer**
For  WinSpool.SetPrinter a zero return indicates an error.

SetLastError defaults to True in VB so I can get the errorcode as follows:

ErrorCode = Marshal.GetLastWin32Error()

The value is 6 but that tells me very little.

Where can I find some text to better describe the error??





Thanks

Author
1 Jul 2005 12:19 PM
Mattias Sjögren
>Where can I find some text to better describe the error??

Manually, run "net helpmsg 6" in a console window, or run the Visual
C++ error lookup utility (can be installed with VS).

Programatically:

Dim e As New Win32Exception
errmsg = e.Message



Mattias

--
Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
1 Jul 2005 1:30 PM
**Developer**
Maybe I'm not doing it correctly

I pasted    net helpmsg 6     after the prompt> in the Command Window and
hit CR and got:
Command "net" is not valid.



Thanks


Show quoteHide quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:Oc%23bicjfFHA.3656@TK2MSFTNGP09.phx.gbl...
> >Where can I find some text to better describe the error??
>
> Manually, run "net helpmsg 6" in a console window, or run the Visual
> C++ error lookup utility (can be installed with VS).
>
> Programatically:
>
> Dim e As New Win32Exception
> errmsg = e.Message
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
Author
1 Jul 2005 1:49 PM
Herfried K. Wagner [MVP]
" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb:
> I pasted    net helpmsg 6     after the prompt> in the Command Window and
> hit CR and got:
> Command "net" is not valid.

On my Windows XP Professional SP2 machine:

---
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\...>net helpmsg 6

Das Handle ist ungültig.


C:\...>
---

Translated:  The handle is invalid.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
2 Jul 2005 1:55 AM
**Developer**
I'm probably doing something wrong.
>> I pasted    net helpmsg 6     after the prompt> in the Command Window and
>> hit CR

Is that realy the way to do it?
Do I need to install something special?
Do I need to find the directory Net is in an give the full path?

Thanks

Show quoteHide quote
> ---
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\...>net helpmsg 6
>
> Das Handle ist ungültig.
>
>
> C:\...>
> ---
>
> Translated:  The handle is invalid.
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
2 Jul 2005 10:19 AM
Herfried K. Wagner [MVP]
" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb:
>>> I pasted    net helpmsg 6     after the prompt> in the Command Window
>>> and hit CR
>
> Is that realy the way to do it?
> Do I need to install something special?
> Do I need to find the directory Net is in an give the full path?

Mhm...  I simply started "cmd" and entered the command.  The directory
doesn't matter.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
2 Jul 2005 1:14 PM
**Developer**
Well I couldn't get it to work so I tried Help and that worked. Got as far
as using immed and >cmd and will probably get net to work eventually - but
not yet. No big deal - I used your


\\\
Dim s As String = _
    (New Win32Exception(Marshal.GetLastWin32Error())).Message
///

works great

Thanks

PS

After the > prompt I type
net helpmsg 6
and get
Command "net" is not valid


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:eMG8E%23ufFHA.2372@TK2MSFTNGP14.phx.gbl...
>" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb:
>>>> I pasted    net helpmsg 6     after the prompt> in the Command Window
>>>> and hit CR
>>
>> Is that realy the way to do it?
>> Do I need to install something special?
>> Do I need to find the directory Net is in an give the full path?
>
> Mhm...  I simply started "cmd" and entered the command.  The directory
> doesn't matter.
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
1 Jul 2005 12:22 PM
Herfried K. Wagner [MVP]
" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb:
> For  WinSpool.SetPrinter a zero return indicates an error.
>
> SetLastError defaults to True in VB so I can get the errorcode as follows:
>
> ErrorCode = Marshal.GetLastWin32Error()
>
> The value is 6 but that tells me very little.
>
> Where can I find some text to better describe the error??

\\\
Dim s As String = _
    (New Win32Exception(Marshal.GetLastWin32Error())).Message
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
1 Jul 2005 1:31 PM
**Developer**
Work perfectly


thanks


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:%23XYI9djfFHA.2424@TK2MSFTNGP09.phx.gbl...
>" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb:
>> For  WinSpool.SetPrinter a zero return indicates an error.
>>
>> SetLastError defaults to True in VB so I can get the errorcode as
>> follows:
>>
>> ErrorCode = Marshal.GetLastWin32Error()
>>
>> The value is 6 but that tells me very little.
>>
>> Where can I find some text to better describe the error??
>
> \\\
> Dim s As String = _
>    (New Win32Exception(Marshal.GetLastWin32Error())).Message
> ///
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>