Hi guys,
I'm using the Preferences Lib of PB. When I create a preference file,
CreatePreferences() returns 0. GetLastError_() returns 3. Does anybody
know WTF error number 3 is?
EDIT: Solved, I found this link: http://msdn.microsoft.com/library/defau ... _codes.asp
What is Error number 3?
What is Error number 3?
Windows 7 & PureBasic 4.4
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
An easy way, for next time:
Code: Select all
ProcedureDLL.s ShowAPIError (CheckReturnValue) ; Forum code, unsure of original author
Buffer.s = Space (4096)
NumberOfChars = FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, 0, CheckReturnValue, 0, Buffer.s, Len(Buffer.s), 0)
ProcedureReturn Left (Buffer.s, NumberOfChars-2)
EndProcedure BERESHEIT
I think the original source of ShowAPIError() is:
http://www.purebasic.fr/english/viewtopic.php?t=21432
http://www.purebasic.fr/english/viewtopic.php?t=21432
Anthony Jordan
another very short one :
Code: Select all
Macro LastErrorMessage()
Left(LastErrorMessage.s{4096}, FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError_(), 0, @LastErrorMessage, 4096, 0) - 2)
EndMacro
Macro LastErrorMessageRequester()
MessageRequester("LastError", LastErrorMessage(), #MB_ICONERROR)
EndMacroNo programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer

