News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

program won't display 1st screen

Started by shankle, January 06, 2013, 09:27:30 AM

Previous topic - Next topic

shankle

I have about a half dozen programs converted to GoAsm 32.
They all work fine using the same code as below.

I have one that I am trying to convert that will NOT show the 1st screen
using the code below. It fails at the ShowWindow API saying that the
handle is invalid.
Have tried with GoBug but could not solve the problem.
The #define code is added as per Edgar. He said the windows headers
have to be changed because of LPSTR.

#define LINKFILES
#define codejps   ;this is a folder I created
#define
#INCLUDE windows.h

DATA SECTION 
#ifndef LPSTR
  #if !x64
   #define LPSTR dd
  #else
   #define LPSTR dq
  #endif     
#endif 
CommandLine LPSTR  ?

WinMain:
    FRAME hInst,hPrevInst,CmdLine,CmdShow
   LOCAL wc:WNDCLASSEXA,msg:MSG,hWnd,RR:RECT     
   mov   D[wc.cbSize], SIZEOF WNDCLASSEXA
   mov   D[wc.style],CS_BYTEALIGNWINDOW | CS_HREDRAW | CS_VREDRAW
   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 RegisterClassEx, addr wc
    invoke SystemParametersInfo, SPI_GETWORKAREA, 0, addr RR, 0        
   
   INVOKE CreateWindowEx, NULL, ADDR szDisplayName, ADDR AppName,\
          WS_OVERLAPPEDWINDOW,[RR.left],[RR.top],[RR.right],\
          [RR.bottom],NULL,NULL,[hInst],NULL           
   mov  [hWnd],eax       
   INVOKE ShowWindow, [hWnd],SW_SHOWNORMAL 

Thanks for any help.

dedndave

hiya Jack
it is likely that the problem lies with WndProc - code you have not shown us
the frame may not be set up properly or DefaultWindowProc may not be executed properly
but - more likely that the WM_CREATE code does not return 0 in EAX
this is a signal used to tell windows whether or not to continue creating the window
if you return a non-zero value, windows doesn't create the window, and the call to CreateWindow(Ex) will return 0

shankle

Problem is fixed Dave.
Thank you.
I was looking for the cause at B when it was at Y.

In other words I had a "ret" ticked out in WM_Destroy.
YUK......

dedndave