The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: shankle on August 16, 2011, 01:20:34 PM

Title: differences between windows 7 and vista
Post by: shankle on August 16, 2011, 01:20:34 PM
Thanks for any suggestions.
This code worked in Vista Pro.
It gives Windows 7 Pro fits.

.ELSEIF iMsg==WM_PAINT
              .IF SWH==0           ; process first time only
                mov SWH, 1
                invoke SendMessage, hWnd, WM_COMMAND, NULL, NULL
              .ENDIF 
            invoke BeginPaint, hWnd, ADDR ps
          invoke EndPaint, hWnd, ADDR ps

SWH is defined as a DD set to zero
My purpose is to execute WM_Command once.
I guess there is another way to accomplish the same task.
Title: Re: differences between windows 7 and vista
Post by: dedndave on August 16, 2011, 01:57:47 PM
is it possible to give a non-zero value for wParam in SendMessage ?
if you give it a value that has the high word set to 0, it will look like a menu item was selected

http://msdn.microsoft.com/en-us/library/ms647591%28v=vs.85%29.aspx

it looks like you want a sort of WM_CREATE
but you may not be able to do what you like during WM_CREATE   :P

i sometimes call a proc to perform such tasks, just before entering the message loop
Title: Re: differences between windows 7 and vista
Post by: shankle on August 17, 2011, 12:25:51 PM
Hi Dave,
Problem solved. Maybe not the best way but it seems to work.
WM_LBUTTONDOWN then left click then Sendmessage
Thanks
Title: Re: differences between windows 7 and vista
Post by: Bill Cravener on August 17, 2011, 01:14:24 PM
Don't understand what it is your doing in the WM_PAINT message there shankle, but anyway, the problem may be SendMessage does not return until the window procedure has processed the message where as PostMessage returns without waiting. Might want to give that one a try.