Subversion Repositories Kolibri OS

Rev

Rev 3363 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3363 leency 1
#define MEMSIZE 0x3E80
3225 leency 2
#include "..\lib\kolibri.h"
3363 leency 3
#include "..\lib\strings.h"
4718 leency 4
#include "..\lib\mem.h"
3225 leency 5
#include "..\lib\file_system.h"
6
 
4718 leency 7
void str_replace(dword buf_in, what_replace, to_what_replace) {
8
	dword start_pos=0;
9
	dword buf_from;
3225 leency 10
 
4718 leency 11
	buf_from = malloc(strlen(buf_in));
12
	loop() {
13
		strcpy(buf_from, buf_in);
14
		start_pos = strstr(buf_from, what_replace);
15
		if (start_pos == 0) break;
16
		strlcpy(buf_in, buf_from, start_pos-buf_from);
17
		strcat(buf_in, to_what_replace);
18
		start_pos += strlen(what_replace);
19
		strcat(buf_in, start_pos);
20
	}
21
	free(buf_from);
22
}
23
 
3225 leency 24
void main()
25
{
26
	int id, key;
4718 leency 27
	strcpy(#param, " lorem");
28
	str_replace(#param, "<", "<");
29
	str_replace(#param, ">", ">");
3225 leency 30
 
31
	loop()
32
   {
33
      switch(WaitEvent())
34
      {
35
         case evButton:
36
            id=GetButtonID();
37
            if (id==1) ExitProcess();
38
			break;
39
 
40
        case evKey:
41
			key = GetKey();
42
			IF (key==013){ //Enter
43
				WriteText(50,90,0x80,0xFF00FF,"Pressed Enter");
44
			}
45
			break;
46
 
47
         case evReDraw:
48
			draw_window();
49
			break;
50
      }
51
   }
52
}
53
 
54
 
55
void draw_window()
56
{
3363 leency 57
	proc_info Form;
3225 leency 58
	DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Window header");
3363 leency 59
	GetProcessInfo(#Form, SelfInfo);
3225 leency 60
	WriteText(50,80,0x80,0,"Press Enter");
4718 leency 61
	WriteText(10,110,0x80,0,#param);
3225 leency 62
}
63
 
64
 
65
stop: