The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: bomz on August 25, 2010, 01:52:09 PM

Title: GetDesktopWindow Error
Post by: bomz on August 25, 2010, 01:52:09 PM
Quote
   invoke GetDesktopWindow
   invoke GetWindowRect,eax,addr DesktopRect
   mov eax, DesktopRect.right
   shr eax, 1
   sub eax, 70
   mov XPosition, eax
   mov eax, DesktopRect.bottom
   shr eax, 1
   sub eax, 65
   mov YPosition, eax
what way may be get the screen resolution else? GetDesktopWindow gives a fatal error running first time after any programe which sreen resolution change (contral strike).
or may be only on my computer?

Quote
.386

.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib

.data
ClassName db "WorkerW",0

.data?
buffer db 512 dup(?)

.code
start:

invoke GetDesktopWindow
INVOKE GetClassName,eax,ADDR buffer,sizeof buffer
invoke MessageBox,0,ADDR buffer,ADDR ClassName,MB_OK + MB_ICONASTERISK
invoke ExitProcess,0
end start

PS Are any help for FPU for MASM32 command and Variables exists?

find answer at first question
Quote
invoke GetSystemMetrics,ARW_BOTTOMRIGHT
mov XPOS, eax
invoke GetSystemMetrics,ARW_BOTTOMLEFT
mov YPOS, eax
Title: Re: GetDesktopWindow Error
Post by: jj2007 on August 25, 2010, 03:09:25 PM
See here (http://www.masm32.com/board/index.php?topic=14617.msg118180#msg118180) for an explanation why this could fail. The handle returned by GetDesktopWindow looks, ehm, a bit odd, at least on Win XP.
However, it does work with GetWindowRect, so there might be another reason why your code fails.
Title: Re: GetDesktopWindow Error
Post by: bomz on August 25, 2010, 03:37:02 PM
in this code there is no any other reason for fail. may be it's only on my computer - video driver for example or something else.....

.386

.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib

.data
ClassName db "WorkerW",0

.data?
buffer db 512 dup(?)

.code
start:
invoke GetDesktopWindow
invoke ExitProcess,0
end start


PS C:\masm32\help\fpuhelp.chm