flat assembler
Message board for the users of flat assembler.

Index > Windows > Simple about box help

Author
Thread Post new topic Reply to topic
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg 23 Dec 2011, 09:59
EDIT: I just can't make a working about box without it closing the whole program.
See attachment in my later reply.


Last edited by rohagymeg on 23 Dec 2011, 10:52; edited 1 time in total
Post 23 Dec 2011, 09:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 23 Dec 2011, 10:04
I can't find the code attachment in your post. It would be easier for us to help you if you gave us something to work with, because we don't know what you have done.
Post 23 Dec 2011, 10:04
View user's profile Send private message Visit poster's website Reply with quote
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg 23 Dec 2011, 10:20
Code:
proc WindowProc, hWnd, uMsg, wParam, lParam
local pt:POINT
mov eax, [uMsg]
mov ebx, [wParam]

cmp ebx, IDM_ABOUT
jne @f
invoke ShowWindow, [hwndabout],SW_SHOW
jmp .returning
@@:
cmp ebx, IDM_EXIT
je exit
cmp eax, WM_DESTROY
jne @f
;invoke ShowWindow, [hwndabout],SW_SHOW    When pressing the x, it should just hide itself
jmp exit ;if i didn't put this here, I would always have to kill the process
@@:
cmp eax, WM_SHELLNOTIFY
jne .returning
cmp     [lParam],WM_RBUTTONDOWN
jne      .returning
lea     eax,[pt]
invoke GetCursorPos, eax
invoke SetForegroundWindow,[hwnd]
invoke TrackPopupMenu, [hMenu], TPM_LEFTALIGN,[pt.x], [pt.y],0,[hwnd],0

.returning:
invoke DefWindowProc,[hWnd],[uMsg],[wParam],[lParam]

ret
endp     

I don't want the main invisible msg only window [hwnd]to be closed when I close the other [hwndabout]
Post 23 Dec 2011, 10:20
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 23 Dec 2011, 10:32
rohagymeg: I can't compile your code. It appears to be incomplete.
Post 23 Dec 2011, 10:32
View user's profile Send private message Visit poster's website Reply with quote
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg 23 Dec 2011, 10:34
It was just a snippet, sorry for that. I will send you the whole file in pm.
Post 23 Dec 2011, 10:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 23 Dec 2011, 10:35
Don't pm me the file please. Post it here so others can help you. I can't do it all.
Post 23 Dec 2011, 10:35
View user's profile Send private message Visit poster's website Reply with quote
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg 23 Dec 2011, 10:47
I made it compileable. Please show me how one can make it so when you close the about box/window, the program doesn't close, only the window hides.


Description:
Download
Filename: Test2.rar
Filesize: 3.27 KB
Downloaded: 334 Time(s)

Post 23 Dec 2011, 10:47
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 23 Dec 2011, 11:04
You must process WM_CLOSE message, not WM_DESTROY.
Example:
Code:
cmp eax, WM_CLOSE
je  .closeit
;........
;..........
.closeit:
        invoke ShowWindow, [hWnd], SW_HIDE
        xor    eax, eax
        ret
    


Note that you should not pass WM_CLOSE to DefWindowProc, because it will destroy the window.
Also, there are many flaws in your code, including the whole structure and source layout.
If this is intended to become usable program, you have to clean the mess and make it more readable.
Post 23 Dec 2011, 11:04
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg 23 Dec 2011, 11:11
Thanks for the help! I know I am a beginner, but I removed a lot of things like comments and unrelated code for the simplicity of the example. I'm reading msdn all day like crazy:) When the main functions are ready, I will clean it up.
Post 23 Dec 2011, 11:11
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.