Re: User32 And GDI32 Wrapper Feedback

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
coconut said...

You can't pass a string to a WIN32 API function. Windows knows nothing about euphoria sequence. this should be something like that:

procedure WinHelp(atom handle,sequence str,atom ex,atom ex2) 
atom pStr 
         pStr = allocate_string(str)	 
	 c_proc(xWinHelp,{handle,pStr,ex,ex2}) 
         free(pStr) 
	 
end procedure 

With euphoria 4.0, you can simplify this a bit so that you don't have to worry about memory management:

procedure WinHelp(atom handle,sequence str,atom ex,atom ex2) 
atom pStr 
	 c_proc(xWinHelp,{handle,allocate_string(str, 1),ex,ex2}) 
end procedure 

Adding the extra 1 to the allocate_string() call causes the pointer to be freed once there are no more euphoria references to it.

Matt

Thanks for the tip, Matt. Although I had already gone and fixed things using the old way. Oh well, no biggie, I'll keep this in mind for next time.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu