Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1078
2012-05-12 21:01:17 UTC
this is a problem with local variables, you can try
eax = hInstance;
wndClass.hInstance = eax;
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #1079
2012-05-12 21:24:00 UTC
compiled okay now.
but found strange things here
when run the program no window creating at all , and when put inline term before the
CreateWin procedure it works fine?
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1081
2012-05-12 21:57:05 UTC
seems still a bug with local variables, i'm taking a look into it now :)
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1083
2012-05-12 23:02:38 UTC
OK seems i have a few bugs to fix, else here it is working:
procedure CreateWin()
{
const className = 'ZMainFRM';
tagWndClassA wndClass;
Dword hInstance = GetModuleHandleA(nil);
m_strFill(@wndClass, 40, 0);
wndClass.hbrBackground = COLOR_BACKGROUND;
eax = hInstance;
wndClass.hInstance = eax;
eax = @className;
wndClass.lpszClassName = eax;
mov eax, @WindowProc;
wndClass.lpfnWndProc = eax;
if (RegisterClassA(@wndClass) == 0) {
eax = GetLastError();
print('RegisterClassA error: ',eax:int,'\r\n');
}
hMainFRM = CreateWindowExA(0, className, 'window Demo', WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, 0, 0, hInstance, nil);
if (hMainFRM == null) {
eax = GetLastError();
print('CreateWindowEx error: ',eax:int,'\r\n');
}
ShowWindow(hMainFRM, SW_SHOWNORMAL);
}
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1084
2012-05-12 23:30:14 UTC
I've just updated the beta version which fixes these problems
procedure CreateWin() {
const className = 'ZMainFRM';
tagWndClassA wndClass;
Dword hInstance = GetModuleHandleA(nil);
m_strFill(@wndClass, sizeof tagWndClassA, 0);
wndClass.hbrBackground = COLOR_BACKGROUND;
wndClass.hInstance = hInstance;
wndClass.lpszClassName = className;
wndClass.lpfnWndProc = @WindowProc;
if (RegisterClassA(@wndClass) == 0) {
eax = GetLastError();
print('RegisterClassA error: ',eax:int,'\r\n');
}
hMainFRM = CreateWindowExA(0, className, 'window Demo', WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, 0, 0, hInstance, nil);
if (hMainFRM == null) {
eax = GetLastError();
print('CreateWindowExA error: ',eax:int,'\r\n');
}
ShowWindow(hMainFRM, SW_SHOWNORMAL);
}
Emil_halim
member
Posts
639
Threads
104
Location
Alex, Egypt
Post #1085
2012-05-13 19:02:54 UTC
ok works fine , thanks for debug the local variable error.
hope by 2013 ziron will be bug free.
BTW , why you did not declare functions name of kernel32 library without 'A' at the end.
some thing like this
function GetModuleHandle = GetModuleHandleA(Pointer lpModuleName): DWord; stdcall;
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1086
2012-05-13 19:13:36 UTC
at some point i planned to add unicode support
$if defined(UNICODE):
//etc
since alot of the features are added already, once the bugs are ironed out of all current features, it should then be bug-free :) only new features/opcodes would be potentially buggy...