Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Skipping and dups when printing fillable pdfs
Message
From
27/05/2011 12:41:49
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01456159
Message ID:
01512068
Views:
66
>Hi Christof,
>
>I see you declared GetLastError function, but I don't see it used in this routine. Is it to translate the error code to error text? What exactly did you plan to use it for?
>
>Thanks again.



To translate GetLastError() into text you have to use FormatMessage() api

see message#1489722
declare Integer FormatMessage in win32api ;
					Integer	dwFlags, ;
					string @lpSource, ;
					Integer	dwMessageId, ;
					Integer	dwLanguageId, ;
					string @lpBuffer, ;
					Integer nSize, ;
					Integer 
	
 local n, s
 n = GetLastError()
 = Format(@m.s, m.n)
 ? m.s
function Format(s, lastError)

	
	
	local n, buf
	buf = space(1024)
	
	#define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
	#define FORMAT_MESSAGE_IGNORE_INSERTS  0x00000200
	#define FORMAT_MESSAGE_FROM_STRING     0x00000400
	#define FORMAT_MESSAGE_FROM_HMODULE    0x00000800
	#define FORMAT_MESSAGE_FROM_SYSTEM     0x00001000
	#define FORMAT_MESSAGE_ARGUMENT_ARRAY  0x00002000
	#define FORMAT_MESSAGE_MAX_WIDTH_MASK  0x000000FF

	n = FormatMessage(	FORMAT_MESSAGE_FROM_SYSTEM, ;
						0, ;
						m.lastError, ;
						0, ;
						@m.buf, ;
						len(m.buf), ;
						0 ;
					  )
	
	
	s  = 'Error ' + transf(m.lastError)
	
	do case
	case !empty(m.n)
		s  = m.s + ' : ' + left(m.buf, m.n)
	endcase
	


	#undefine FORMAT_MESSAGE_ALLOCATE_BUFFER
	#undefine FORMAT_MESSAGE_IGNORE_INSERTS
	#undefine FORMAT_MESSAGE_FROM_STRING
	#undefine FORMAT_MESSAGE_FROM_HMODULE
	#undefine FORMAT_MESSAGE_FROM_SYSTEM
	#undefine FORMAT_MESSAGE_ARGUMENT_ARRAY
	#undefine FORMAT_MESSAGE_MAX_WIDTH_MASK

endfunc
*_______________________________________________________________________________
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform