News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GetDesktopWindow Error

Started by bomz, August 25, 2010, 01:52:09 PM

Previous topic - Next topic

bomz

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

jj2007

See here 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.

bomz

#2
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