flat assembler
Message board for the users of flat assembler.

Index > Windows > Miscellaneous questions

Author
Thread Post new topic Reply to topic
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Hello,
I have some questions about different topics.

1. Cannot 'WS_TABSTOP' be used outside dialog boxes? When I use it like this...
Code:
dialogitem 'EDIT',0,DialBoxEditID,4,4,120,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP    

it works, but when I use it like this...
Code:
invoke  CreateWindowEx,0,'BUTTON','Proceed',WS_CHILD+WS_VISIBLE+WS_TABSTOP,10,200,310,22,[hwnd],ProcButtonID,[wc.hInstance],0    

it does not.
Am I missing something here? Do I need to add something to make it work when invoking 'CreateWindowEx', should I invoke some other function I am not aware of, ...?

2. Can I call my own procedures using the 'invoke' pseudo-instruction or will I have to modify the equates, parameters counts, etc...?

3. Are there any macros, procedures or APIs for string manipulation (copy, get length, concatenate, delete character, etc...)?

4. I did not fully understand the use of the pseudo-instruction 'uses' in procedures.
From the manual:
Quote:
Then also the uses keyword may follow, and after it the list of registers (separated only with spaces) that will be automatically stored on entry to procedure and restored on exit.

Does that mean that the registers I write there will be pushed when entering the procedure and poped when getting out of it, 'uses eax edi esi' being the same as 'push eax edi esi / pop esi edi eax'?

5. I have a problem with the 'WM_SYSCOMMAND' message. Every time I include a
Code:
cmp     [wmsg],WM_SYSCOMMAND
je      wmsyscommand
    

in the WindowProc procedure (along with WM_COMMAND, WM_CREATE, WM_DESTROY, etc...) I am unable to close the program by clicking the 'x' button and I have to terminate it with 'CTRL+ALT+DEL'.

Thank you in advance for your help.
Post 22 Aug 2006, 09:30
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
2. you can call your own with "stdcall", not invoke. search board for recent posts with "stdcall" and "invoke", it was explained lately

3. you can use libc(.dll)
(soon there will be FASMLIB prepared for use, unfortunately it isn't in state to become used by now)

4. it means that you can use these registers in functions, but their value will be preserved in prologue / epilogue code. for example:
Code:
proc a uses ebx
...
ret
endp    

is same (not really) as
Code:
proc a
push ebx
...
pop ebx
ret
endp    
Post 22 Aug 2006, 10:03
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004
1. You can write your message loop as following

Code:
local .msg:MSG
    lea esi,[.msg]
.startloop:
    invoke GetMessage, esi,0,0,0
    test eax,eax
    jz .endloop
    invoke IsDialogMessage, [hwndDialog],esi;  <-- WS_TABSTOP should process
    test eax,eax
    jnz .startloop
    invoke TranslateMessage, esi
    invoke DispatchMessage, esi
    jmp .startloop
.endloop:

    
Post 22 Aug 2006, 11:00
View user's profile Send private message ICQ Number Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Thank you for your replies.


vid,
Quote:
you can use libc(.dll)

What is that libc? I have no such library in my system. Or could it be called something other than 'libc.dll'.

Quote:
is same (not really) as

What do you mean by 'not really'? Does it push/pop the registers or not?



afw2004,
Is 'IsDialogMessage' not for dialog boxes only? I need to make it work in the main window.



I have new questions related to files. I recently saw an example on how to use file mapping without ReadFile/WriteFile: by using MapViewOfFile and wsprintf (to write). Is there any other API I could use for writing? What API could I use for reading?
Post 29 Aug 2006, 07:44
View user's profile Send private message Reply with quote
farrier



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

afw2004 is correct! Attached is a small program which creates a regular widow, then adds a few child controls. You can see how the tab key takes the focus from one control to the other.

I included:

invoke TranslateAccelerator, [gWnd], [hAccel], msg

in the message loop, in case there is a keyboard accelerator in the program--not used in this one.

hth,

farrier


Description:
Download
Filename: TabWindows.zip
Filesize: 2.31 KB
Downloaded: 105 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 29 Aug 2006, 08:10
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Thank you everyone, it works fine now.
Post 02 Sep 2006, 09:05
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.