calpol2004
Joined: 16 Dec 2004
Posts: 110
|
this isnt necessarily a problem everything does function fine just it really annoys me. using the "USECOM" example ive made my application not appear in the taskbar, however for like a second it appears then disappears, this is what annoys me. i know its because the code which makes it disappear from task bar initializes a split second after the program is actually put in the the taskbar. there must be another method of doing this so it doesnt appear for a split second, ive seen a fair few other applications do it unfortunatly i cant look at their source  . heres my code:
format PE GUI 4.0
entry start
include '..\..\include\win32a.inc'
struc GUID def
{
match d1-d2-d3-d4-d5, def
\{
.Data1 dd 0x\#d1
.Data2 dw 0x\#d2
.Data3 dw 0x\#d3
.Data4 db 0x\#d4 shr 8,0x\#d4 and 0FFh
.Data5 db 0x\#d5 shr 40,0x\#d5 shr 32 and 0FFh,0x\#d5 shr 24 and 0FFh,0x\#d5 shr 16 and 0FFh,0x\#d5 shr 8 and 0FFh,0x\#d5 and 0FFh
\}
}
interface ITaskBarList,QueryInterface,AddRef,Release,HrInit,AddTab,DeleteTab,ActivateTab,SetActiveAlt
CLSCTX_INPROC_SERVER = 0x1
ID_PASS = 100
ID_OK = 102
ID_CLOSE = 103
section '.data' data readable writeable
CLSID_TaskbarList GUID 56FDF344-FD6D-11D0-958A-006097C9A090
IID_ITaskbarList GUID 56FDF342-FD6D-11D0-958A-006097C9A090
ShellTaskBar ITaskBarList
flags dd ?
password db 'password',0
incorrect db 'Invalid Password, Please Try Again',0
alert db 'Alert!',0
buffer db 49
section '.code' code readable executable
start:
;!!! functions to make program disappear from taskbar here !!!!
invoke CoInitialize,NULL
invoke CreateInstance,CLSID_TaskbarList,NULL,CLSCTX_INPROC_SERVER,IID_ITaskbarList,ShellTaskBar
invoke GetModuleHandle,0
invoke DialogBoxParam,eax,37,NULL,DialogProc,0
cominvk ShellTaskBar,Release
or eax,eax
jz exit
exit:
invoke ExitProcess,0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Initial Dialog ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc DialogProc hwnddlg,msg,wparam,lparam
cominvk ShellTaskBar,HrInit
cominvk ShellTaskBar,DeleteTab,[hwnddlg]
push ebx esi edi
cmp [msg],WM_INITDIALOG
je wminitdialog
cmp [msg],WM_COMMAND
je wmcommand
xor eax,eax
jmp finish
wminitdialog:
invoke SetWindowPos,[hwnddlg],HWND_TOPMOST,0,0,0,0,SWP_NOMOVE+SWP_NOSIZE
jmp processed
wmcommand:
mov eax,[wparam]
and eax,0FFFFh
cmp eax,ID_OK
je enteredpass
cmp eax,ID_CLOSE
je close
jmp processed
enteredpass:
invoke GetDlgItemText,[hwnddlg],ID_PASS,buffer,buffer
invoke lstrcmp,password,buffer
cmp eax,0
je equal
invoke MessageBox,[hwnddlg],incorrect,alert,MB_OK+MB_ICONINFORMATION
jmp processed
equal:
invoke EndDialog,[hwnddlg],0
;run second dialog from here
jmp processed
close:
invoke EndDialog,[hwnddlg],0
processed:
mov eax,1
finish:
pop edi esi ebx
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; function imports and resources ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section '.idata' import data readable writeable
library kernel,'KERNEL32.DLL',user,'USER32.DLL',ole,'OLE32.DLL'
import kernel,GetModuleHandle,'GetModuleHandleA',ExitProcess,'ExitProcess',lstrcmp,'lstrcmp'
import user,DialogBoxParam,'DialogBoxParamA',GetDlgItemText,'GetDlgItemTextA',MessageBox,'MessageBoxA',EndDialog,'EndDialog',SetWindowPos,'SetWindowPos'
import ole,CoInitialize,'CoInitialize',CoCreateInstance,'CoCreateInstance'
section '.rsrc' resource data readable
directory RT_DIALOG,dialogs
resource dialogs,37,LANG_ENGLISH+SUBLANG_DEFAULT,filehider
dialog filehider,'Enter Your Password',340,280,140,37,DS_MODALFRAME+DS_CENTER+WS_POPUP+WS_CAPTION
dialogitem 'EDIT','',ID_PASS,2,3,136,15,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_PASSWORD
dialogitem 'BUTTON','&Enter',ID_OK,12,20,52,15,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON
dialogitem 'BUTTON','&Close',ID_CLOSE,74,20,52,15,WS_VISIBLE
enddialog
any form of help appreciated.
|