Author Topic: SC_MAXIMIZE current process windows  (Read 1297 times)

Vortex

  • Member
  • *****
  • Posts: 2577
Re: SC_MAXIMIZE current process windows
« Reply #45 on: July 20, 2021, 07:21:45 PM »
Hi bomz,

You can try the command timeout :

Quote
If you are writing a batch file and you don’t want to continue until somebody presses a key, you can do it really easy with the timeout command.

https://www.howtogeek.com/196873/how-to-add-a-timeout-or-pause-in-a-batch-file/

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/timeout

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #46 on: July 20, 2021, 09:30:26 PM »
Cool. I don't know about such command. Thanks.
Still understand how SleepEx work

jj2007

  • Member
  • *****
  • Posts: 11526
  • Assembler is fun ;-)
    • MasmBasic
Re: SC_MAXIMIZE current process windows
« Reply #47 on: July 20, 2021, 10:04:46 PM »
Never heard of timeout before - and I remember lots of discussions how to wait x seconds in a batch file. Now I searched a little bit and even found the source code, see attachment :tongue:

Usage: timeout /T=1234 for a 1234 milliseconds delay (no args: one second default delay)

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #48 on: July 20, 2021, 10:50:10 PM »
I also remmember very many such disputes. but can't find any examples in my archive.
searching internet can't find any examle of sleepex with console

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #49 on: July 21, 2021, 08:50:28 AM »
Code: [Select]
invoke CreateFile,addr ConIn,GENERIC_READ,FILE_SHARE_READ OR FILE_SHARE_WRITE,\
0,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,0 ;FILE_FLAG_NO_BUFFERING
mov ebx,eax

invoke ReadFileEx,ebx,addr buffer,1,addr OverLap,0;addr EWCallBack
invoke SleepEx,5000,TRUE
invoke ExitProcess,0

invoke CreateEvent,NULL,FALSE,FALSE,NULL
mov OverLap.hEvent,eax
invoke ReadFile,ebx,addr buffer,1,addr _rb,addr OverLap
.WHILE TRUE
invoke WaitForSingleObject,OverLap.hEvent,0
.if eax != WAIT_OBJECT_0
invoke ExitProcess,0
.endif

.ENDW



any idea how make string lenth code shorter?
Code: [Select]
mov ecx, -1
lea edi, string
xor eax,eax
repne scasb
not ecx
dec ecx
« Last Edit: July 21, 2021, 04:13:44 PM by bomz »

daydreamer

  • Member
  • *****
  • Posts: 1682
  • building nextdoor
Re: SC_MAXIMIZE current process windows
« Reply #50 on: July 21, 2021, 06:00:19 PM »
Movsx ecx,-1 (use bytesize constant instead)
Or
Xor ecx,ecx Dec ecx

Mov Al,[string+ecx]
Test Al,Al

SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

jj2007

  • Member
  • *****
  • Posts: 11526
  • Assembler is fun ;-)
    • MasmBasic
Re: SC_MAXIMIZE current process windows
« Reply #51 on: July 21, 2021, 06:24:18 PM »
Movsx ecx,-1 (use bytesize constant instead)

Do you occasionally test your attempts to code before posting them?

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #52 on: July 22, 2021, 01:03:57 AM »
any optimize critics to commandline parametre?
Code: [Select]
.386

.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib

.code
start:
invoke GetCommandLine
mov bl, ' '
cmp byte ptr[eax],'"'
jne @F
inc eax
mov bl, '"'
@@:
;inc eax
cmp byte ptr[eax],bl
je found
cmp byte ptr[eax],0
jz NoParam
inc eax
jmp short @B
found:
cmp bl,' '
je @F
mov bl,' '
jmp short @B
@@:
inc eax
cmp byte ptr [eax], ' '
jne No_Shell
inc eax
No_Shell:
cmp byte ptr[eax],0
jz NoParam
mov ebx, eax

invoke MessageBox,0,ebx,0,0

NoParam:
invoke ExitProcess,0
end start

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #53 on: July 27, 2021, 08:22:51 PM »
Quote
Richter's book says, "I've worked quite a lot with escaped I / O, and I'll be the first to tell you that escaped I / O is terrible and should be avoided."
Win32 overrides I / O completion routines or WaitForMultipleObjects?
it is about ReadFileEx and SleepEx

Code: [Select]
invoke CreateFile,addr ConIn,GENERIC_READ,FILE_SHARE_READ OR FILE_SHARE_WRITE,\
0,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,0 ;FILE_FLAG_NO_BUFFERING
mov ebx,eax
invoke ReadFile,ebx,addr buffer,1,addr _rb,addr OverLap
.WHILE TRUE
invoke WaitForSingleObject,OverLap.hEvent,0
.if eax != WAIT_OBJECT_0
invoke ExitProcess,0
.endif

.ENDW

Using IOCP and ReadFileEx

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #54 on: July 28, 2021, 09:50:27 PM »
could anyone give an example how asynchronously read from file and write to another when they are located on different physical disks?

TouEnMasm

  • Member
  • *****
  • Posts: 1733
    • EditMasm
Re: SC_MAXIMIZE current process windows
« Reply #55 on: July 28, 2021, 10:57:00 PM »
Not a real question.
Just use full  path for the various files and use readfile witefile with the correct options.
The two functions are abble to do manythings.
most of the functions are in fileapi.h and where you know.
Fa is a musical note to play with CL

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 8436
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: SC_MAXIMIZE current process windows
« Reply #56 on: July 29, 2021, 12:43:55 AM »
bomz,

2 threads, each one reading a different file.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #57 on: July 29, 2021, 07:49:23 AM »
bomz,

2 threads, each one reading a different file.
!

bomz

  • Member
  • **
  • Posts: 55
Re: SC_MAXIMIZE current process windows
« Reply #58 on: July 30, 2021, 10:30:15 AM »
anybody knows how enumerate tray icons including hiding icon in system tray x64 system?

Biterider

  • Member
  • ****
  • Posts: 709
  • ObjAsm Developer
    • ObjAsm
Re: SC_MAXIMIZE current process windows
« Reply #59 on: July 30, 2021, 03:29:15 PM »