Solar OS API - GUI - Functions

How can an address ever be private with all those Curiculum vitae ...
SHARE the world they say...but can't i have a little privacy?


API_Window_Get_Addr_Private
API_Window_Get_Addr_Private PROC STDCALL
	USES	ebx,esi
	ARG	@@wnd_handle:dword

This function returns the address of the window's private data/variables.

This variables are not shared between multiple applications instances.

Returns:

Errors: none

Curently the wnd_handle is NOT checked against existing windows. If you ask the handle of a non existing window it will return an dummy address nevertheless. Accessing an invalid addres can result in a system crash.

It is fair to expect future versions of this function to make this simple check of the handle and return ERR_INVALID_PARAMS for out or range window handles.

Arguments:

Argument Type Description
wnd_handle dword HANDLE of the window who's addres to return.

Remarks:

Primary usage of this function is to get the addres of window_data01 private window variable. The same address can be obtained in other ways also, however this API makes code easyer to read and understand.

Below is an article/discussion about private variables in SOLAR OS: SOLAR OS and Private Global Variables

Sample code:


;------------------------------------------
;define this structure for easy acces to
;private variables
;------------------------------------------
My_App_Private_Vars STRUC
	my_strings_count	dword	?
	my_strings_mem_handle	dword	?
	my_strings_lp		dword	?
ENDS
...
	;init this application instance

	;---------------------------------------------
	; get access to windows's private data
	; since we need each instance
	; to have it's own variables
	;---------------------------------------------
	Call	API_Window_Get_Addr_Private STDCALL,[@@wnd_handle]
	mov	edi,eax
	mov	[edi.my_strings_count],-1	;no strings
	;-----------------------------
	; alloc some memory
	;-----------------------------
	Call	API_Memory_Alocate,1		;get 4k for start
	mov	[edi.my_strings_mem_handle],eax	;store handle as we need it for Release
	mov	[edi.my_strings_lp],esi		;store pointer

...