Register | Login
Forum Index > Source Help > assignment error
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1076] assignment error - posted: 2012-05-12 20:45:27
hi,

I got this error

[39,34]: Expected procedure/function call or number or hexadecimal or register or constant or procedure address but found hInstance in [Win.zir]
Code:
wndClass.hInstance = hInstance;


from this code
Code:
//handles
Dword hMainFRM;
procedure CreateWin()
{
  const  className = 'ZMainFRM';
  tagWndClassA wndClass;

  Dword hInstance = GetModuleHandle(nil);

  wndClass.hbrBackground = COLOR_BACKGROUND;
  wndClass.hInstance = hInstance;
  wndClass.lpszClassName = className;
  wndClass.lpfnWndProc = @WindowProc;  

  RegisterClass(@wndClass);
  hMainFRM = CreateWindowEx(0, className, 'window Demo', WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, 0, 0, hInstance, nil);
  ShowWindow(hMainFRM, SW_SHOWNORMAL);
}


any help please?

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1078] - posted: 2012-05-12 21:01:17
this is a problem with local variables, you can try

Code:
eax = hInstance;
wndClass.hInstance = eax;


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1079] - posted: 2012-05-12 21:24:00

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
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1081] - posted: 2012-05-12 21:57:05
seems still a bug with local variables, i'm taking a look into it now smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1083] - posted: 2012-05-12 23:02:38
OK seems i have a few bugs to fix, else here it is working:

Code:
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);
}


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1084] - posted: 2012-05-12 23:30:14
I've just updated the beta version which fixes these problems

Code:
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);
}


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1085] - posted: 2012-05-13 19:02:54

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

Code:
function GetModuleHandle = GetModuleHandleA(Pointer lpModuleName): DWord; stdcall;


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1086] - posted: 2012-05-13 19:13:36
at some point i planned to add unicode support

Code:
$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 smile only new features/opcodes would be potentially buggy...

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 6 user(s) online. 0 member(s) and 6 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd