flat assembler
Message board for the users of flat assembler.

Index > Windows > Multiple questions

Author
Thread Post new topic Reply to topic
Rookie



Joined: 21 Aug 2003
Posts: 44
Location: Planet Romania
Rookie
Hy!

I have a bunch of questions directed to anyone who can help, so I won't waste any more time and get to the point:

1) How do I remove an app from the taskbar? In Delphi I use a little trick, calling
Code:
ShowWindow(Application.Handle,SW_HIDE);
    

when activating/deactivating,minimizing/maximizing/restoring and showing/hiding a form. I tried something similar in fasm:
Code:
proc WindowProc, hwnd,wmsg,wparam,lparam
        push    ebx esi edi
        ...
        cmp     [wmsg],WM_ACTIVATE
        je      .wmactivate
        cmp     [wmsg],WM_SHOWWINDOW
        je      .wmshowwindow
        cmp     [wmsg],WM_SYSCOMMAND
        je      .wmsyscommand
        ...
  .defwndproc:
        invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
        jmp     .finish
  .wmactivate:
  .wmshowwindow:
        invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
        invoke  ShowWindow,[hinstance],SW_HIDE
        xor     eax,eax
        jmp     .finish
  .wmsyscommand:
        cmp     [wparam],SC_MINIMIZE
        je     .sc_minimize
        cmp     [wparam],SC_MAXIMIZE
        je     .sc_maximize
        cmp     [wparam],SC_RESTORE
        je     .sc_restore
        jmp    .defwndproc
     .sc_minimize:
     .sc_maximize:
     .sc_restore:
        invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
        invoke  ShowWindow,[hinstance],SW_HIDE
        xor     eax,eax
        jmp     .finish
        ...
  .finish:
        pop     edi esi ebx
        return
    

but it doesn't work.

2) This is a DirectDraw question, with ddraw.inc provided by fasmw's examples. I did everything by the book: inited DirectDraw
Code:
        invoke  DirectDrawCreate,NULL,DDraw,NULL
        or      eax,eax
        jnz     .failed
        comcall DDraw,SetCooperativeLevel,[mainhwnd],DDSCL_NORMAL
        or      eax,eax
        jnz     .failed
    

created a primary surface:
Code:
        stdcall zeromem,DDSurfaceDesc,sizeof.DDSURFACEDESC
        mov     [DDSurfaceDesc.dwSize],sizeof.DDSURFACEDESC
        mov     [DDSurfaceDesc.dwFlags],DDSD_CAPS
        mov     [DDSurfaceDesc.ddsCaps.dwCaps],DDSCAPS_PRIMARYSURFACE+DDSCAPS_VIDEOMEMORY
        comcall DDraw,CreateSurface,DDSurfaceDesc,DDSPrimary,NULL
        or      eax,eax
        jnz     .failed
        ; Create clipper
        comcall DDraw,CreateClipper,0,DDClipper,NULL
        or      eax,eax
        jnz     .failed
        comcall DDClipper,SetHWnd,0,[mainhwnd]
        or      eax,eax
        jnz     .failed
        comcall DDSPrimary,SetClipper,DDClipper
        or      eax,eax
        jnz     .failed
    

and a back surface (for window drawing, not full screen):
Code:
        ; Create back surface
        stdcall zeromem,DDSurfaceDesc,sizeof.DDSURFACEDESC
        mov     [DDSurfaceDesc.dwSize],sizeof.DDSURFACEDESC
        mov     [DDSurfaceDesc.dwFlags],DDSD_WIDTH+DDSD_HEIGHT+DDSD_CAPS
        push    [width]
        pop     [DDSurfaceDesc.dwWidth]
        push    [height]
        pop     [DDSurfaceDesc.dwHeight]
        mov     [DDSurfaceDesc.ddsCaps.dwCaps],DDSCAPS_OFFSCREENPLAIN+DDSCAPS_VIDEOMEMORY
        comcall DDraw,CreateSurface,DDSurfaceDesc,DDSBack,NULL
        or      eax,eax
        jnz     .failed
    

I then did some drawing on the back surface and tried to blit it:
Code:
        comcall DDSPrimary,Blt,DestRect,[DDSBack],SrcRect,DDBLT_WAIT,NULL
    

but this call causes an exception, the source of which I cannot identify (I compared with some Delphi sources and coulnd't find any difference, except for the syntax), then I looked at the example provided by fasmw (which is full screen, so there's a little bit of difference), and still couldn't see the problem. I'll spend some more time trying to solve this, but any help is greatly appreciated (I attached the full app source for those that are interested - the project is totally useless, started just for the pleasure (and practice) of fasming).

That's it... I did say a 'bunch of questions' in the beginning, but I solved the others meanwhile.


Description: Source code for above questions
Download
Filename: bidd.tar.gz
Filesize: 26.36 KB
Downloaded: 92 Time(s)


_________________
This is who I choose to be.
Post 01 Oct 2004, 21:29
View user's profile Send private message Reply with quote
wanderer



Joined: 18 Jun 2003
Posts: 44
Location: Moldova, Kishinev
wanderer
Rookie wrote:
Hi!
1) How do I remove an app from the taskbar?
[skipped]
Code:
        invoke  ShowWindow,[hinstance],SW_HIDE
    

but it doesn't work.

You should use [hwnd] instead of [hinstance].

_________________
Best regards,
Antoch Victor
Post 02 Oct 2004, 22:43
View user's profile Send private message Yahoo Messenger Reply with quote
Rookie



Joined: 21 Aug 2003
Posts: 44
Location: Planet Romania
Rookie
If I use [hwnd], it hides also the window itself. I need to remove just the app from the taskbar.
Post 03 Oct 2004, 10:40
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
Rookie,

Attached is a Radasm Project, done in MASM32 which does what you want for 1). If you or any one else translates this into FASM, post it here to help me with my mission to translate all my routines from MASM32 to FASM.

Thanks to donkey for the original code!

hth

farrier


Description:
Download
Filename: taskonoff.zip
Filesize: 4.32 KB
Downloaded: 85 Time(s)


_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 03 Oct 2004, 22:03
View user's profile Send private message Reply with quote
Rookie



Joined: 21 Aug 2003
Posts: 44
Location: Planet Romania
Rookie
I promise to do so (at least for this one), but you'll have to wait a while, as I left home for university but left my computer behind for now. It'll take a couple of weeks before I settle myself in with computer and all. Then I'll get back to work. Promise.

_________________
This is who I choose to be.
Post 06 Oct 2004, 08:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.