Graphical programs pausing at start [Very strange]

General FreeBASIC programming questions.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Graphical programs pausing at start [Very strange]

Post by Jawade »

I have a strange thing. A graphical program has a pause
of 1 second before it opens. But after I write to it,
the pause of 1 second is no more there.

Make a textfile with the name JEditGr3.bas:

Code: Select all

Main:
    ScreenRes 1120, 640, 32: Width 140, 40
    Color 0, -1: Cls
Sleep
Compile it with:

fbc" -b JEditGr3.bas -s gui

Make a textfile with the name vsetupr.bas:

Code: Select all

Main:
    Open "JEditGr3.exe" For Binary As #1
        Put #1, 1, "M"
    Close #1
System
Compile it with:

fbc" -b vsetupr.bas

Start now JEditGr3.exe and with me that takes longer than 1 second.

Start now vsetupr.exe and than again JEditGr3.exe and with me he
starts without pause of 1 second.

There are 2 things, the vsetupr.* needs setup in the name.
After rename JEditGr3.* the pause of 1 second is there again.
The pause comes also after several hours.

At mij 'old' computer with Windows7 there is no pause.
Some other people also do not have the pause.
Last edited by counting_pine on Jan 25, 2018 13:13, edited 1 time in total.
Reason: Clearer title; code blocks
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Very strange

Post by lizard »

Jawade wrote:At mij 'old' computer with Windows7 there is no pause.
Some other people also do not have the pause.
You found the answer yourself. Obviously it's a Windows-thing.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Very strange

Post by Jawade »

But very strange the pause isnt there on my other computer and also to other people's computer.
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Very strange

Post by Imortis »

@Jawade: What exactly is this supposed to accomplish? Why would you modify the program in this manner?
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Very strange

Post by Jawade »

I don't want thad second to wait. It is strange and unwanted. And other computers don't have it. The way with the *setup* I discovered when I made a install program for it. The second was away after installing, and after hours the second was there. And when I turned the setup again, the second was away again. But only if the name of then seup program had the name 'setup' in it.

In short: If I make JEditGr3.exe and start it, it takes 1 second before it starts.
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Very strange

Post by St_W »

Maybe some security software like virus scanners or ransomware protection tools (e.g. recent Acronis Backup solutions) causes that delay. Try to uninstall them and remove them completely (often there are separate removal tools provided for complete removal).
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Very strange

Post by Jawade »

The only software I have like that is Security Essentials. But I don't believe that kind of software is the cause. If I use the software with 'setup' in his name, the pause is away. It's really very strange. And several weeks ago it was always fast.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Very strange

Post by jj2007 »

Jawade wrote:only if the name of then seup program had the name 'setup' in it.
Looks familiar, it is "a Windows thing" indeed, but most probably your AV software uses that 'feature'.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Very strange

Post by Jawade »

But strange that after turns the setup program, it's fast. I don't think then to an AV program. If i want the pause, I wait several hours, or I rename the JEditFr3.exe. And if I dont want the pause, I turn the setup. But I don't want de pause never. I use it for a zoom window and 1 second is a long time if I call it any time.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Very strange

Post by Jawade »

The last development: What ever U do, the pause is now always there. I give up.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Very strange

Post by lizard »

Jawade wrote:What ever U do, the pause is now always there.
Seems it is a result of the internal time management of windows. As multi-threaded system it operates in "time-slices" where each process gets a slice of the time. But this changes with the number of processes in the background.

Thats why it's difficult to do measurement of execution times in windows. There is mostly a little difference. Because you never know whats happening in the time-slices in the background.

Try your program under DOS. There will always happen the same. Because DOS is not multithreaded.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Very strange

Post by Jawade »

Thanks, but I alway try it also under "DOS". No difference. Now it'starts always with the pause of 1 second. If I now no better, I think it's normal. I use it for a zoom window, but now I will try to make a DOS screen, with a shortcut for the font and screen settings.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Very strange

Post by lizard »

Jawade wrote:Thanks, but I alway try it also under "DOS". No difference. Now it'starts always with the pause of 1 second. If I now no better, I think it's normal. I use it for a zoom window, but now I will try to make a DOS screen, with a shortcut for the font and screen settings.
If you run the DOS-Shell inside Windows it's a normal thread. Only if you boot into pure DOS it's completely single-threaded.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Very strange

Post by Jawade »

It's not the only thing I have, and if I no use the window as popup so I do now, there is no
problem. The other problem is this:

Code: Select all

Dim a As Integer
Do
  For a = 0 To 255
    If MultiKey(a) Then ?a
  Next
Loop
If you start it, there is no response, til you pres a key. Also after hours, it givesback all the numbers, so it like I press aal the keys. If I no use MultiKey, there is also no problem. but its not normal.

I think it's a hardware problem, but how to proof it?
MJK
Posts: 179
Joined: Nov 08, 2005 17:14
Location: Dublin, Ireland
Contact:

Re: Very strange

Post by MJK »

Jawade wrote:I have a strange thing. A graphical program has a pause of 1 second before it opens. But after I write to it, the pause of 1 second is no more there.
The only software I have like that is Security Essentials. But I don't believe that kind of software is the cause.
As others have mentioned, it's most likely to be your antimalware/antivirus tools. What might be happening is:
- When the AV stuff detects an "unknown" executable, it scans the code - which takes that "1 second", and which might involve internet lookups also).
- "Unknown" might mean - a new file, a different filename, different size, different timestamp, or even a different checksum.
- This should mean that the delay occurs only on the very first execution of the file, after it was last compiled or changed.
- Your code to apply that "M" probably changes nothing - in which case a checksum of the file would not show changes. Maybe change it to some other char - just for a test. And observe if the "M" update changes the timestamp on the file.

Regarding SE, why not just temporarily disable your AV stuff, re-compile the EXEs, and then see if the first execution (after the compile, or after changing the EXE) has the pause. (And then, re-enable the AV utils!). It probably will not have the pause - assuming A-L-L your AV stuff is disabled! Or you might be able to configure the AV apps to ignore those specific EXEs.

If it's the AV apps, then that delay of several hours would be irrelevant: the 1-sec pause should occur on the first execution after the compile (or change), and that pause should apply whether that first execution was only a few seconds, or many years, after the previous compilation/change.

The link from JJ2007 discusses special treatment of executable filenames with terms: patch, setup, install, update.

- Mike
Post Reply