flat assembler
Message board for the users of flat assembler.

Index > Windows > efficient macro or simalar loop.

Author
Thread Post new topic Reply to topic
jacko221



Joined: 12 Nov 2005
Posts: 22
jacko221 22 Nov 2005, 09:05
im probably annoying you guys with my posts, so if i am, im sorry. Well here is my story... i can't find an efficient loop, i have tried using .while/.until & .if/.endif but these make the CPU go straight to 100%. I sappose the program i made was poor and badly written but all i want it too do is too search for this particular window and kill it and if anyone is curious, its not for a crappy worm. Here is the code...


Code:
format PE GUI 

include "C:\fasmw164\INCLUDE\win32ax.inc"

.data
tmWindowName db 'Game Emulator',0

.code
start: 

start1:
push tmWindowName
push NULL 
call [FindWindow]
         .if eax,be,NULL ;around here is makeing it very slow
          jmp start1
          .endif
jmp start2


start2:
invoke SendMessage, eax, WM_CLOSE, NULL, NULL
jmp start1

.end start 

    


All help and comments is greatly appreciated.

Thanks, Jack
Post 22 Nov 2005, 09:05
View user's profile Send private message Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22 24 Nov 2005, 06:11
If you want it to search for a particular window and kill it why are you using a loop?
Shouldn't you only have to find the window once and kill it? Your continually looking for it.
If you want your current code to not use up so much CPU then add a delay in it. Use the Sleep api in kernel32.dll and add a delay to your infinite loop.
Post 24 Nov 2005, 06:11
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20292
Location: In your JS exploiting you and your system
revolution 24 Nov 2005, 07:52
To add to r22's post try this:
Code:
format PE GUI  

include "C:\fasmw164\INCLUDE\win32ax.inc" 

.data 
tmWindowName db 'Game Emulator',0 

.code 
start:  

start1: 
invoke Sleep,100   ;<--- this line added
push tmWindowName 
push NULL  
call [FindWindow] 
         .if eax,be,NULL ;around here is makeing it very slow 
          jmp start1 
          .endif 
jmp start2 


start2: 
invoke SendMessage, eax, WM_CLOSE, NULL, NULL 
jmp start1     
Post 24 Nov 2005, 07:52
View user's profile Send private message Visit poster's website 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.