Solar_OS API Reference

Free the captured caption ...

You are here: -> Main -> GUI API ->


API_Window_Set_Caption
API_Window_Set_Caption PROC STDCALL
	USES	ebx,esi,edi
	ARG	@@wnd_handle:dword,@@lp_caption:dword	

This function setups the window's caption. For Edit controls the caption is the text inside.

OS setups a default debug caption for every window created. Basic debug caption contains the window handle and its parent.

Returns: nothing

Errors: none

Take care not to setup a caption greater than 128 bytes as this will corupt other window data.

Arguments:

Argument Type Description
wnd_handle dword HANDLE of the destination window.
lp_caption pointer to null terminated string
dword

The new caption string.
Source string is copied into window caption.

Sample code form Hello World:

ALIGN 4
hello_app_sz_caption	db	"Hello World",0

ALIGN 4
Hello_App_Init PROC STDCALL
	USES	esi
	LOCAL	@@wnd_handle:dword
	
	;------------------------------------
	; Create Main App Window
	;------------------------------------
	mov	eax,FLAG_WND_ALPHA+FLAG_WND_MINI
	Call	API_Window_Create STDCALL,[desk_crt],132,105,240,112,eax,WND_TYPE_TOP
	mov	[@@wnd_handle],eax
	;-------------------------------
	; set callback and caption
	;-------------------------------
	Call	API_Window_Set_Callback STDCALL,[@@wnd_handle],OS_CALL_AFTER,offset Hello_App_Callback
	Call	API_Window_Set_Caption STDCALL,[@@wnd_handle],offset hello_app_sz_caption
	;--------------------------------------
	; minimum resize values, optional
	;---------------------------------------
	Call	API_Window_Set_Property STDCALL,[@@wnd_handle],offset window_dx_min,200	
	Call	API_Window_Set_Property STDCALL,[@@wnd_handle],offset window_dy_min,108

	;--------------------------------------------
	; this is it! END of Application init code
	; only callback will be called by OS
	; from now on
	;--------------------------------------------

	ret
ENDP

;----------------------------------
; Callback routine for main Window
;----------------------------------

;--------------------------------------------------
; We deal with only 1 event:
; -Paint == to show some info
; note that wnd_param1, wnd_param2 depend on action
;--------------------------------------------------
hello_app_sz_msg	db	"Hello World!",0
align 4
Hello_App_Callback PROC STDCALL
	USES	ebx,esi
	ARG	@@wnd_handle:DWORD,@@wnd_action:DWORD,@@wnd_param1:DWORD,@@wnd_param2:DWORD

	;--------------------------------------
	; a case based on message/event value
	;--------------------------------------
	.IF [@@wnd_action]==ACT_PAINT_CHILD
		;-------------------
		; Wnd::On_Paint
		;--------------------
		Call	API_Text_Draw STDCALL,[@@wnd_handle],64,32,offset hello_app_sz_msg
		
	.ELSEIF [@@wnd_action]==ACT_LEFT_UP_CHILD
		;-----------------------------------
		; Wnd::ON_Mouse_Left_Down :)
		; todo: add click code here
		;-----------------------------------
		
	.ELSEIF [@@wnd_action]==ACT_CLOSE_CHILD
		;---------------------------
		;Wnd::Destructor
		;todo:add code here
		;---------------------------
	.ENDIF

	; by convention must return zero 
	; or parent will terminate you
	xor	eax,eax
	ret
ENDP


;-------------------------------------
; End of sample
;-------------------------------------