Author Topic: error msg?  (Read 78444 times)

wjr

  • Member
  • **
  • Posts: 226
    • WJR's website
Re: error msg?
« Reply #60 on: July 10, 2012, 01:46:05 AM »
Assuming you are simply trying to use a RECT called RC, the "forced dll" part would lead me to believe that in your source you have a reference to "RC:" (or "RCC:") with a colon (where one is not needed, or instead of a period).

shankle

  • Member
  • ****
  • Posts: 868
Re: error msg?
« Reply #61 on: July 10, 2012, 02:38:58 AM »
Got a clean compile and link.
When I click on MyProg.exe it blinks and nothing happens.
Major digging now. Have a test msg in WM_PRINT and it never gets there.
Will put a test msg in WM_CREATE  to see if it gets there.

Seems I am confused in GoAsm as to when to put in a Frame/Local
statement for ex: rc:RECT or rc?       
   
Will do more digging to see if I can figure this one out.
« Last Edit: July 10, 2012, 05:11:53 AM by shankle »

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: error msg?
« Reply #62 on: July 10, 2012, 02:48:55 AM »
Code: [Select]
Local msg, MSG, hWnd, hBrush, rc, wc_WNDCLASSEXA, cc:codecode
that's a bit of a mess, Jack   :biggrin:

local's need to be typed
MSG is a structure (which is a sort of a type)
try this
Code: [Select]
    LOCAL msg:MSG, hWnd:HWND, hBrush:HBRUSH, wc:WNDCLASSEX, cc:codecodei am not sure about the last one
i assume you have defined the type (or structure) "codecode" somewhere previously in the source

MSG and WNDCLASSEX are structures that should be defined in the include files
HWND and HBRUSH are DWORD types that should be defined in the include files

shankle

  • Member
  • ****
  • Posts: 868
Re: error msg?
« Reply #63 on: July 11, 2012, 02:50:01 AM »
In the testing phase of MyProg.exe I got this error message:
  " MyProg.exe has stopped working"
No 1st screen or anything. I put  messagebox  code right after the START
and it did not execute. So I assume  something else is happening.
     
.code
start:
;   test begin
;TM3              db   'at start',0
      invoke MessageBox, NULL,[TM3],[TM3],MB_YESNO     
       cmp eax,MB_YESNO
        je > Twrite
Twrite:
;   test end

   invoke GetModuleHandleA, NULL
   mov    [hInstance],eax
   invoke GetCommandLine
   invoke WinMain
   invoke ExitProcess,eax

WinMain:
    FRAME hInst,hPrevInst,CmdLine,CmdShow,hInstance;
   LOCAL msg,MSG,hWnd,hBrush,rc:RECT,wc:WNDCLASSEXA;,cc:codecode       

   mov   D[wc.cbSize], SIZEOF WNDCLASSEXA
   mov   D[wc.style], CS_BYTEALIGNWINDOW    
   mov   D[wc.lpfnWndProc], OFFSET WndProc
   mov   D[wc.cbClsExtra], NULL
   mov   D[wc.cbWndExtra], NULL
   push  [hInst]
   pop   [wc.hInstance]
   invoke LoadIcon, NULL,IDI_APPLICATION
   mov   D[wc.hIcon], eax
    invoke LoadCursor, NULL,IDC_ARROW
   mov   D[wc.hCursor], eax
   invoke CreateSolidBrush, [colorbk]          ; background color
    mov   D[hBrush], eax
   mov   D[wc.hbrBackground], eax
   mov   D[wc.lpszMenuName], NULL
   mov   D[wc.lpszClassName], OFFSET szDisplayName
   mov   D[wc.hIconSm], 0

   invoke RegisterClassExA, addr wc
    invoke SystemParametersInfoA, SPI_GETWORKAREA,0,addr rc,0       
     mov eax,[rc.left]
     mov [holdleft], eax
     mov eax,[rc.right]
     mov [holdright],eax
     mov eax,[rc.bottom]
     mov [holdbottom],eax
     mov eax,[rc.top]
     mov [holdtop],eax
     push edx               
     push ebx
     xor edx,edx     
     mov eax,[holdright]     
     mov ebx,2               
     div ebx
     mov [savemiddleofX],eax   
     pop ebx
     pop edx
   INVOKE CreateWindowExA, NULL,addr szDisplayName,addr AppName,\
           WS_OVERLAPPEDWINDOW,[rc.left],[rc.top],[rc.right],\
           [rc.bottom],NULL,NULL,[hInst],NULL       
      mov   [hWnd],eax     
 
   INVOKE ShowWindow, [hWnd], SW_SHOWNORMAL
   INVOKE UpdateWindow, [hWnd]

      .StartLoop
          INVOKE GetMessageA, addr msg,NULL,0,0
          cmp eax,0
          je >.ExitLoop
          INVOKE TranslateMessage, addr MSG
          INVOKE DispatchMessageA, addr MSG
          jmp .StartLoop
       .ExitLoop
       mov eax,[MSG.wParam]
          ret           
       ENDF
   

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: error msg?
« Reply #64 on: July 11, 2012, 03:38:30 AM »
try this program, Jack
Code: [Select]
.data
TM3              db   'at start',0
.code
start:
      invoke MessageBox, NULL,TM3,TM3,MB_YESNO
      invoke ExitProcess,0
end start

wjr

  • Member
  • **
  • Posts: 226
    • WJR's website
Re: error msg?
« Reply #65 on: July 11, 2012, 04:21:00 AM »
GoAsm syntax differs a bit from MASM for an address:

Code: [Select]
INVOKE MessageBox, NULL, ADDR TM3, ADDR TM3, MB_YESNO
Going further, you will need Dave's above corrections for LOCAL and the
WinMain FRAME should have 4 parameters:

Code: [Select]
WinMain:
FRAME hInst, hPrevInst, CmdLine, CmdShow

More importantly, when you call WinMain, you need to supply those arguments to the call, something like:

Code: [Select]
INVOKE GetCommandLine
mov [pCmdLine],eax

INVOKE WinMain, [hInstance], NULL, [pCmdLine], SW_SHOWDEFAULT

Also, in your message loop, change MSG (structure template) to msg (your locally defined instance of that structure).

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: error msg?
« Reply #66 on: July 11, 2012, 05:05:38 AM »
hi Wayne
i thought GoAsm syntax would yield the address of TM3 for "TM3"
and the contents at the address for "[TM3]"

shankle

  • Member
  • ****
  • Posts: 868
Re: error msg?
« Reply #67 on: July 11, 2012, 05:46:58 AM »
Some progress.
I did get my info msg at START. Then moved it to WinMain and nothing.

To Dave- codecode is a struct I defined,  TM3 is a msg defined in the data section.

To WJR - I changed to LOCAL statement to the following:
   Local msg:MSG, hWnd:HWND, hBrush:HBRUSH, rc:RECT, wc:WNDCLASSEX, cc:codecode
Now I get the following error:  "data type given in local data declaration not recognized:-
  HWND"
I changed MSG to msg as directed in your last statement.
Here is the error msg I get: "The following symbol was not defined in the object file
or files:- msg.wParam"

Guess I'm confusing the Local statement with the Frame statement?

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: error msg?
« Reply #68 on: July 11, 2012, 06:28:58 AM »
if HWND is not defined in the include files, it probably should be
if one of the DWORD typedef's is missing, you can just use DWORD...
Code: [Select]
    Local   hWnd:DWORD
however, it may be that the name "hWnd" is used elsewhere in a visible scope

it might be easier if you'd attach the source, then Wayne or i could step through and clean it up in one pass

Quote
I changed MSG to msg as directed in your last statement.
Here is the error msg I get: "The following symbol was not defined in the object file
or files:- msg.wParam"

this problem may be related to the first
if it doesn't resolve all of the LOCAL declarations, it may not create any of them

wjr

  • Member
  • **
  • Posts: 226
    • WJR's website
Re: error msg?
« Reply #69 on: July 11, 2012, 06:45:10 AM »
Correction, the syntax difference is more on the memory addressing side which requires the square brackets for the contents at the address. For the address itself though, ADDR or OFFSET (either one for GoAsm, some differences between them for MASM) is still required in code (but not necessary as part of a data declaration).

A very quick look and I didn't see HWND defined in the header files, in WinDef.h at least, so you can also use HANDLE instead. Not sure why msg does not work for you if rc and wc do...

shankle

  • Member
  • ****
  • Posts: 868
Re: error msg?
« Reply #70 on: July 11, 2012, 07:02:19 AM »
Thanks guys.
Made some progress and am now into the WM_CREATE.

       invoke  GlobalLock, eax      
       mov       [pinf04],eax      t
       mov       ebx,eax      
       push  ebx
        invoke  EnumPrintersA, PRINTER_ENUM_LOCAL,NULL,4,[pinf04],\
                                [dwNeeded],[dwNeeded],[dwReturned]
                 
        pop ebx                                                          
        invoke  CreateDC, NULL,[ebx+PRINTER_INFO_4.pPrinterName],NULL,NULL

The offending instruction is the CreateDC. The ones above it worked.
Most likely it is the ebx+PRINTER_INFO_4.pPrinterName



dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: error msg?
« Reply #71 on: July 11, 2012, 12:04:32 PM »
see if this works
Code: [Select]
       invoke  GlobalLock, eax     
       mov       [pinf04],eax      t
       mov       ebx,eax     
        invoke  EnumPrintersA, PRINTER_ENUM_LOCAL,NULL,4,eax,\
                                [dwNeeded],[dwNeeded],[dwReturned]
        lea     eax,[ebx+PRINTER_INFO_4.pPrinterName]
        invoke  CreateDC, NULL,eax,NULL,NULL

shankle

  • Member
  • ****
  • Posts: 868
Re: error msg?
« Reply #72 on: July 11, 2012, 01:10:05 PM »
Hi Dave.
The lea seemed to solve the problem. More testing will tell for sure

jj2007

  • Member
  • *****
  • Posts: 11310
  • Assembler is fun ;-)
    • MasmBasic
Re: error msg?
« Reply #73 on: July 11, 2012, 03:30:16 PM »
Masm can do the lea for you:

invoke CreateDC, NULL, addr [ebx+PRINTER_INFO_4.pPrinterName], NULL, NULL

shankle

  • Member
  • ****
  • Posts: 868
Re: error msg?
« Reply #74 on: July 11, 2012, 09:41:47 PM »
Hi JJ2007 and thanks for the reply.
GoAsm gives an error with your suggestion.

Now the ShowWindow gives an error in GoAsm.
It works fine in Masm32.
The CreateWindowEXA works.

hWnd    dd  0

    INVOKE CreateWindowExA, NULL,addr szDisplayName,addr AppName,\
           WS_OVERLAPPEDWINDOW,[rc.left],[rc.top],[rc.right],\
           [rc.bottom],NULL,NULL,[hInst],NULL       
      mov   [hWnd],eax     
 
   INVOKE ShowWindow, [hWnd], SW_SHOWNORMAL
   INVOKE UpdateWindow, [hWnd]