News:

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

Icons on desktop....

Started by Dark Schneider, November 08, 2006, 08:36:31 AM

Previous topic - Next topic

ragdog

to ToutEnMasm

works on your maschien??

ramguru

maybe this works
this should be enough to get desktop_listview handle:

GetDesktopListView  proc
    invoke  FindWindow, offset szProgman, 0
    test    eax, eax
    jz      error
    invoke  FindWindowEx, eax, 0, 0, 0
  error:
    ret
GetDesktopListView  endpt

[attachment deleted by admin]

ragdog

this was just an example of my possibilitys :bg

ragdog

ToutEnMasm

Hello,
I am working and found a first mistake  in the WM_COMMAND
You must extract the words from wParam and lparam like that ,it's enough to have different results
in differents systems
                                 ToutEnMasm


   .elseif uMsg == WM_COMMAND
      HIWORD wParam   ;events of controls
      mov edx,eax      ;exemple :TCN_SELCHANGE
      LOWORD wParam   ;ID of commands eax
      mov ebx,lParam   ; handle of controles
      ;suite   
      .if eax == IDC_EXIT
         call HideIcons
      .elseif   eax == 1002
         call ShowIcons
      .endif         


   HIWORD MACRO ParamFen
      mov eax,ParamFen
      shr eax,16
   ENDM
   LOWORD MACRO ParamFen
      mov eax,ParamFen
      and eax,0FFFFh
   ENDM




ragdog

 :U
that is not to work between home and professinal?
or which you meant?

ToutEnMasm


Try this one , he would have les random work
                              ToutEnMasm
Quote
; #########################################################################
.NOLIST
.586
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive
   include macro.inc
   include \masm32\include\windows.inc
   LIB user32,kernel32,comdlg32,comctl32,shell32,advapi32,gdi32
   DlgProc         PROTO   :HWND,:UINT,:WPARAM,:LPARAM
   ShowIcons PROTO
   GetDesktopListView   PROTO
   HideIcons   PROTO
.const

IDD_DIALOG    equ 1000
IDC_EXIT     equ 1001   

;#########################################################################
.data
szProgman       db  "Progman", 0
    szSHELLDLL      db  "SHELLDLL_DefView", 0
    szSysList       db  "SysListView32", 0
     HidingState     db  1
    IconState       db  1

hInstance      dd 0

.code

start:
invoke GetModuleHandle,NULL
mov   hInstance,eax
invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,addr DlgProc,NULL
invoke ExitProcess,0

DlgProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg == WM_INITDIALOG

   .elseif uMsg == WM_COMMAND
      HIWORD wParam   ;evenements des listbox ,combo sont ici
      mov edx,eax      ;exemple :TCN_SELCHANGE
      LOWORD wParam   ;IDentificateurs de  commandes eax
      mov ebx,lParam   ; handle du controle
      ;suite   
      .if eax == IDC_EXIT
         invoke HideIcons
      .elseif   eax == 1002
         invoke ShowIcons
      .endif         
   
   .elseif uMsg == WM_CLOSE
      invoke EndDialog,hWnd,0                   
   .endif
xor eax, eax
ret
DlgProc endp
;-------------------------------------------------------------------------
GetDesktopListView  proc
   invoke  FindWindow, offset szProgman, NULL
   .if eax != 0
      invoke  FindWindowEx, eax, NULL, offset szSHELLDLL, NULL
      .if eax != 0
         invoke  FindWindowEx, eax, NULL, offset szSysList, NULL
      .endif
   .endif
   ret
GetDesktopListView  endp
;----------------------------------------------------------------------------------------------------
ShowIcons       proc
   Local Hwindow:DWORD
   invoke    GetDesktopListView
   .if eax != 0
      mov  Hwindow,eax
      invoke  IsWindowVisible, Hwindow
      .if eax == 0
         invoke  ShowWindow, Hwindow, SW_SHOW   
      .endif      
      mov     IconState, 1      
   .endif
   ret
ShowIcons       endp
;-------------------------------------------------------------------------
HideIcons       proc
   Local Hwindow:DWORD
   invoke    GetDesktopListView
   .if eax != 0
      mov  Hwindow,eax      
      invoke  IsWindowVisible,Hwindow
      .if eax == TRUE
         invoke  ShowWindow, Hwindow, SW_HIDE
      .endif
      mov     IconState, 0
   .endif
ret
HideIcons       endp
end start

[attachment deleted by admin]

EddieB

Ramaguru's code worked for me :)

ragdog

how said that was a fast example!
also there I have it still ma tested with my sister their laptop xp home edition thats works

which you meant with ?

HIWORD wParam   ;evenements des listbox ,combo sont ici
      mov edx,eax      ;exemple :TCN_SELCHANGE
      LOWORD wParam   ;IDentificateurs de  commandes eax
      mov ebx,lParam   ; handle du controle

you can explain to me more exactly?

GetDesktopListView  proc
    invoke  FindWindow, offset szProgman, 0
    test    eax, eax
    jz      error
    invoke  FindWindowEx, eax, 0, 0, 0
  error:
    ret
GetDesktopListView  endp

and why functions only with EddieB?

ragdog

ToutEnMasm


Hello,
A little explain
The wparam is defined as follow in winhelp
WM_COMMAND

wNotifyCode = HIWORD(wParam); // notification code         
wID = LOWORD(wParam);         // item, control, or accelerator identifier
hwndCtl = (HWND) lParam;      // handle of control

EAx mus be divide in two words (it's a a double word = 4 bytes),each word have a differant information in it.
                                     ToutEnMasm



ragdog

there are differences with the wparam function there between home and pro?

.if wParam == IDC_EXIT
      call HideIcons

       
        .elseif    wParam == 1002
   
        call    ShowIcons
   

        .endif         

ToutEnMasm


There is no difference between the definition but values are differents and you can have random results if you compare a word with a dword.
First you must extract the word,make his size a dword filling it with 0 and then you can compare it with a dword.
                                 ToutEnMasm

ragdog

I understand nothing more :bg

       mov edi ,wParam
   .if edi == IDC_HIDE
                call xxx
       .elseif    edi == IDC_SHOW
                      call   xxx
   .endif 

this algo functioned to today on each pc with me and with befriend pc


ragdog

sorry this algo

   .if wParam == IDC_HIDE
      call xxx

       
        .elseif    wParam == IDC_SHOW
   
        call   xxx
   

        .endif

ToutEnMasm


I repeat that there is two informations in wparam (coded in two words) and not only one coded in a DWORD.Wparam is a dword.
If the hight word has no information in it (0),your code can work,but if he has one your code fail.
              ToutEnMasm

ramguru

when u press a button u can expect only one notification code

BN_CLICKED  equ 0

so zero'ing of wparam high-order word(0000XXXX) is waste of time and this

.if wParam == 1002

is enough, correct etc.