flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution 16 Mar 2009, 11:38
What comes after the last .endif? Do you use the value in eax again or do you reload it from [wparam] again?
What is "invoke SendMessage,[hEdit],WM_SETTEXT,0,0" going to do? It will erase the edit space. Is that what you want to do every time the user tries to make a change? |
|||
![]() |
|
frech 16 Mar 2009, 13:15
After the last .endif there's just a jmp to the end of the examination of WM_COMMAND, that's why I did not write it. The above code, of course, should be executed only in cases such as: does the user want to quit without saving? If the text has changed and variable "saved" is not set, the user will be prompted. Of course this code is going to be execute if and only if the user choses the menu option NEW or QUIT (and also OPEN, as the program will be SDI), and of course there must be a check on that "saved" variable, I don't want the edit control to erase itself on each key pression...
![]() My problem is just to get the value of hiword(wparam) and loword(wparam). This will be useful also for other WinAPI message, of course. |
|||
![]() |
|
revolution 16 Mar 2009, 13:19
So what is not working exactly?
After the second ".if" I would expect you want to put "mov [notsaved],1" instead of what you have there. Then when you get the "close" message you can check the notsaved variable and decide what to do from that. |
|||
![]() |
|
frech 16 Mar 2009, 13:43
Hi revolution. I tried also that solution, but no way: the .if condition (don't know if the first or the second) is not met, so the code after the last .endif is run in all cases. Maybe I'm wrong in how to get hiword or loword?
I attach the source. Before throwing it into the trashcan (or /dev/null) please remember that I'm still beginning both asm and WinAPI... I will optimize it and give it a better look once I get it working. The source is far from complete, I'm just working on the gui and the main commands for now, that's why you won't find find/replace and other things... Thanks.
|
|||||||||||
![]() |
|
revolution 16 Mar 2009, 14:09
frech wrote: ... so the code after the last .endif is run in all cases. Code: mov eax, [wparam] .if ax,e,IDC_EDIT shr eax,16 .if ax,e,EN_CHANGE mov [notsaved],1 jmp .somewhereElse ;<--- add this. .endif .endif |
|||
![]() |
|
frech 16 Mar 2009, 14:22
Hi. Try and substitute in my code the content of ..creanuovo: with the following lines:
Code: ..creanuovo: mov eax, [wparam] .if ax,e,IDC_EDIT shr eax,16 .if ax,e,EN_CHANGE invoke SendMessage,[hEdit],WM_SETTEXT,0,0 .endif .endif jmp ..wmCOMMAND_COMMAND_EXIT_POINT You will see that SendMessage will not be executed. So the problem must be in getting hiword(wparam) and loword(wparam). |
|||
![]() |
|
revolution 16 Mar 2009, 15:00
I'm still not sure what is wrong or what you are trying to achieve? Can you please explain in more detail what exactly is not working the way you expect.
There seem to be conflicting goals, one is to save the user edit space before quitting and the other is to erase the user edit space when the users changes something. |
|||
![]() |
|
frech 16 Mar 2009, 15:14
I need to implement a way to check for the file being saved on disk
- when the user wants to quit the program - when the user wants to open another file - when the user wants to create a new file I learnt from google that in order to do that I need to check if the edit control has been modified, and that to do it I need to check the value of the hiword and the loword of the wparam message, set a variable to a certain value according to those hiword/loword and check the value of that variable when the user chooses one of the above mentioned options. The problem is that I can't get those values, so I can't perform any check. |
|||
![]() |
|
bitRAKE 16 Mar 2009, 17:20
if the values are unsigned:
movzx eax,word[wparm] ; LOWORD movzx ecx,word[2+wparm] ; HIWORD or with older processors: mov eax,[wparm] mov ecx,eax and eax,$FFFF ; LOWORD shr ecx,16 ; HIWORD if the values are signed: movsx eax,word[wparm] ; LOWORD movsx ecx,word[2+wparm] ; HIWORD or with older processors: mov eax,[wparm] mov ecx,eax shl eax,16 sar ecx,16 ; HIWORD sar eax,16 ; LOWORD |
|||
![]() |
|
comrade 16 Mar 2009, 17:26
bitRAKE wrote: or with older processors: Those would be some very old processors ![]() Though we didn't have a discussion recently about some newer VIAs or some other embedded x86 clones not supporting cmov? |
|||
![]() |
|
bitRAKE 16 Mar 2009, 17:30
I guess the odds of someone both using a 286,
and running Windows on it are quite low. ![]() Last edited by bitRAKE on 17 Mar 2009, 05:28; edited 1 time in total |
|||
![]() |
|
Tomasz Grysztar 16 Mar 2009, 17:34
bitRAKE wrote: I guess the odds of someone both using a 286, I guess the odds of someone running Win32 on 286 machine are like... zero? ![]() |
|||
![]() |
|
rugxulo 17 Mar 2009, 03:38
comrade wrote:
I assume he means for speed, e.g. original Pentiums (not PPro/PII), which supposedly run MOV[SZ]X slower than otherwise. Quote:
Some so-called older 686s of VIA didn't support CMOV (which caused Ubuntu and/or Debian to only tune for "486"). Even some early PPros may not either (although GCC has always, possibly erroneously, assumed -march=ppro or =i686 means CMOV.. is supported.) Quote:
Win95 needs a 386. WinXP needs a 586 (in reality, even newer). IIRC, the last Windows to support a 286 was Win 3.1 "standard mode" (not WfW 3.11). |
|||
![]() |
|
revolution 17 Mar 2009, 04:43
Tomasz Grysztar wrote:
Ever heard of an emulator? I think with old Win3.1 and the Win32S extension one could find an old 286 machine with lots of ram/hdd and emulate. Although it would probably run like a snail into a gale force head wind. I have emulated 64bit on my 32bit machine so it's not like it is impossible. |
|||
![]() |
|
frech 17 Mar 2009, 07:27
bitRAKE wrote: if the values are unsigned: Sorry, I can't understand very well... yet. Would You be so kind to quote the entire code snippet for this kind of operation? Just to try, in the code I submitted I've tried to change the ..creanuovo routine this way: Code: ..creanuovo: mov eax, [wparam] movzx ecx,word[2+wparam] .if cx,e,IDC_EDIT movzx eax,word[wparam] .if ax,e,EN_CHANGE invoke SendMessage,[hEdit],WM_SETTEXT,0,0 .endif .endif jmp ..wmCOMMAND_COMMAND_EXIT_POINT without setting any variable, just to test. No way. Of course I've mistaken... |
|||
![]() |
|
revolution 17 Mar 2009, 08:00
frech: Why do you have this line "invoke SendMessage,[hEdit],WM_SETTEXT,0,0"? That does not make sense. I think that will also cause a EN_CHANGE message to be sent, so you might end up with a second way around the loop doing things twice. I'm not sure how the edit box works internally, but I don't think it is a good idea to put that line in.
May I suggest instead that you put a message box and pop up a window for you to see when something is triggered. It may enlighten your way to see what is happening inside the loop. |
|||
![]() |
|
frech 17 Mar 2009, 08:13
Yeah, I put that line just to cause a reaction in case I can get the HIWORD and the LOWORD correctly. When I find that it works, I'll know I get the correct way to read those HIWORD and LOWORD. I tried using MessageBox instead, but I got the same result. That's why I think I have mistaken something and I can't get those parameters.
|
|||
![]() |
|
Tomasz Grysztar 17 Mar 2009, 08:36
revolution wrote: Ever heard of an emulator? I think with old Win3.1 and the Win32S extension one could find an old 286 machine with lots of ram/hdd and emulate. Although it would probably run like a snail into a gale force head wind. But then the emulator would emulate MOVZX/MOVSX aswell, so I think it's not related to the problem metioned here. ![]() |
|||
![]() |
|
revolution 17 Mar 2009, 08:56
Okay I just downloaded your code to see what you have done.
Code: cmp [wparam],IDM_NEW je ..controlla ... ..controlla: ; FIXME: metti controllo: c'è già un file modificato o no? mov eax, [wparam] .if ax,e,IDC_EDIT shr eax,16 .if ax,e,EN_CHANGE mov [NotSaved],1 .endif .endif cmp [NotSaved],1 je ..creanuovo jmp ..wmCOMMAND_COMMAND_EXIT_POINT Win32 docs wrote: WM_COMMAND You should only check the high word of wparam in the .wmcommand section. Code: .wmcommand: cmp word[wparam],IDM_NEW je ..somewhereElse cmp word[wparam+2],EN_CHANGE je ..controlla ... ..controlla: mov ax, word[wparam+0] .if ax,e,IDC_EDIT mov [NotSaved],1 .endif jmp ..wmCOMMAND_COMMAND_EXIT_POINT |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.