Wierd error (PING ROB)

new topic     » topic index » view thread      » older message » newer message

Some wierd thing, hSaveStdout is a constant, defined as you will see
below. But using this constant /*/broke/*/ working code...

Bizarrely, calling c_func(xGetStdHandle..) inline works, but saving
this as a constant does not !!!!!!!

I get the same results on 2.4 and 2.5(a)...

--
-- odd thing with STD_OUTPUT_HANDLE/constants
--
include dll.e
include machine.e

constant 
	kernel32 = open_dll("kernel32.dll")

constant 
	xGetStdHandle = define_c_func(kernel32, "GetStdHandle",
		{C_LONG},		-- 	DWORD  nStdHandle 	// input, output, or
error device
		C_POINTER),		-- HANDLE

	xGetConsoleScreenBufferInfo = define_c_func(kernel32,
"GetConsoleScreenBufferInfo",
		{C_POINTER,		--	HANDLE	hConsoleOutput,	// handle of
console screen buffer
		 C_POINTER},	--	PCONSOLE_SCREEN_BUFFER_INFO
lpConsoleScreenBufferInfo 	// address of screen buffer info.
		C_INT)			-- BOOL

constant  sizeofCSBI		= 18	-- (trust me!)
constant pCSBI=allocate(sizeofCSBI)
constant STD_OUTPUT_HANDLE = #FFFFFFF5 -- (-11)

constant hSaveStdout = c_func(xGetStdHandle,{STD_OUTPUT_HANDLE})

puts(1,"Hello\n")
----!!!! FINE !!!! -----
	if not
c_func(xGetConsoleScreenBufferInfo,{c_func(xGetStdHandle,{STD_OUTPUT_HANDLE}),pCSBI})
then
----!!!! BROKEN !!!! -----
--	if not c_func(xGetConsoleScreenBufferInfo,{hSaveStdout,pCSBI})
then
		?9/0
	end if


new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu