B
Hallo,
Ich habe unter Win NT4.0 ein Taskbar Programm geschrieben das wunderbar funktioniert.
Es sitzt am oberen Bildschirmrand und erscheint wenn man mit der Maus ganz nach oben fährt.
Wirklich simpel.
Leider erscheint unter Windows XP Pro schon bei Programm Start ein GPF. Kann das aber nicht näher verfolgen, da
ich nur unter Win NT4.0 arbeite.
Vielleicht kann mir jemand helfen?
Hier ist der code:
.data?
hInstance dd ?
CommandLine dd ?
hWnd dd ?
hIcon dd ?
hTimer dd ?
hMenu dd ?
hBOOL dd ?
lngWidth dd ?
.code
WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
;/* Local variables */
LOCAL point:POINT
LOCAL rect:RECT
;/*Note: used the style-manager addin (Radasm != default ) */
mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
;/* our application icon */
invoke LoadIcon,hInstance,500
mov hIcon,eax
invoke SendMessage,hWin,WM_SETICON,NULL,hIcon
;/* creating the timer, every half-second */
invoke SetTimer,hWin,hTimer,100, NULL
;/* Get the screen width */
invoke GetWindowRect,NULL,addr rect
mov edx,rect.right
mov lngWidth,edx ;/* Screenwidth now stored in our variable */
;/* Set our dialog position and width */
invoke SetWindowPos,hWin,HWND_TOPMOST,0,0,addr lngWidth,35,SWP_SHOWWINDOW or SWP_NOACTIVATE
;/* creating our simple menu */
invoke CreatePopupMenu
mov hMenu,eax
invoke AppendMenu, hMenu, MF_STRING, IDM_SETTINGS, SADD("Settings")
invoke AppendMenu, hMenu, MF_STRING, IDM_ABOUT, SADD("About")
invoke AppendMenu, hMenu, MF_SEPARATOR, 0, 0
invoke AppendMenu, hMenu, MF_STRING, IDM_QUIT, SADD("Quit")
.elseif eax==WM_TIMER
;/* Get user mouse position */
invoke GetCursorPos,addr point
mov ebx, point.y
.if ebx == 0 ;/*if user mouse is on Screentop then show our taskbar */
invoke SetWindowPos,hWin,HWND_TOPMOST,0,0,addr lngWidth,35,SWP_SHOWWINDOW or SWP_NOACTIVATE
mov hBOOL, 0
.elseif ebx>35 ;/* else we hide the taskbar */
.if hBOOL != 1 ;/* using a simple boolean as a trick to prevent infinite loop */
invoke SetWindowPos,hWin,HWND_TOPMOST,0,0,addr lngWidth,35,SWP_HIDEWINDOW
mov hBOOL, 1
.endif
.endif
.elseif eax==WM_COMMAND
mov eax,wParam
and eax,0FFFFh
.if eax==IDM_SETTINGS
.elseif eax==IDM_ABOUT
fn MessageBox,hWin,"This is a little taskbar demo - created for fun.","ASMbar by Me",MB_OK or MB_ICONINFORMATION
.elseif eax==IDM_QUIT
invoke SendMessage,hWin,WM_CLOSE,0,0
.endif
.elseif eax==WM_LBUTTONDOWN
;/* drag taskbar */
mov eax,lParam
invoke PostMessage,hWin,WM_NCLBUTTONDOWN,HTCAPTION,eax
.elseif eax==WM_CONTEXTMENU
;/* user right clicks somewhere on the taskbar --> popupmenu */
mov eax, lParam
and eax, 0FFFFh
mov ebx, lParam
shr ebx, 16
invoke TrackPopupMenu, hMenu, TPM_LEFTALIGN, eax, ebx, 0, hWin, 0
.elseif eax==WM_CLOSE
;/* kill timer on exit */
invoke KillTimer, hWin, hTimer
invoke DestroyWindow,hWin
.elseif uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
WndProc endp