We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

idle function and event in pb6.5

sandeep_patel
on
Medium Priority
1,105 Views
Last Modified: 2013-12-26
hi friends,

I m facing very strange behaviour of pb.I m working with pb6.5 (build 444) on windows2000 (service pack 4 installed). I created one test application in which only one window object is there. And following scripts i have written in the application

OPEN EVENT:
open(w_idle_test)
idle(5)

IDLE EVENT:
halt close

now running the application it opens window w_idle_test and starts timer for the idle event to fire.so after 5 seconds it should close the application if the appln is idle.
But it's not happening !!!! B'coz my mouse is on the window. If i will remove my mouse from the window area to anywhere else, it will execute the idle event after 5 seconds idle time. It's really strange. It took 2 hours to find out the reason and accedently i come to know about the reason. Is It Bug ? OR any configuration settings in windows2000.
Comment
Watch Question

Hi,
I have checked with my application ,it works fine.
check the followings,these may reset your time:

A mouse movement or mouse click in any window of the application
¨      Any keyboard activity when a window of the PowerBuilder application is current
¨      A mouse click or any mouse movement over the icon when a PowerBuilder application is minimized
¨      Any keyboard activity when the PowerBuilder application is minimized and is current (its name is highlighted)
¨      Any retrieval on a visible DataWindow that causes the edit control to be painted

Author

Commented:
hi sandhiyaa,
i checked all these things as it is given in the pb help. For the testing i have created a new appln and only window in that apln. no code anywhere else except application open event and idle event...but it's not working....if u want a test pbl i can send u and u can check...but remember i m working on pb6.5 (build 444) and windows2000. have u tested on the same ?

thanks for reply,
Sandeep,

I have a small question.. will not the line
 idle(5)
be executed after you close your main window w_idle_test ??
And as soon as you close w_idle_test, you will be exited out of the App... so there's no chance that Idle event will be fired...
 Try calling Idle() before you open the window..

idle(5)
open(w_idle_test)

Regards,
VIkas
Well,,
I was just confused, The Idle(5) will be executed in your case also..
--vikas
I remember we used to work on PB version 6.5.1 .... May be there's some problem with pb6.5
-Vikas
CERTIFIED EXPERT

Commented:
Hello Sandeep,

Could you not use Sleep WIN API. ?

Sleep( )
This function tells the OS to ignore the current thread for X number of milliseconds.  The screen will not be redrawn while this API call is active.   This is the same as running a for-next loop from within PowerBuilder.

Global External Function:
SUBROUTINE Sleep(ulong milli) LIBRARY "Kernel32.dll"

Script:
ulong l_delay
l_delay = 2000
Sleep(l_delay)

Regards-
I guess Sleep will not work as required........
You can try puting some control like a groupbox on the window, and see if the problem persists.

Regards,
Vikas
i too use PB6.5,but windows 98
send me the pble let, me check

Commented:
Hi,

try this:

1. In your application OPEN even just open your window

OPEN EVENT:
open(w_idle_test)

IDLE EVENT:
halt close

2. In your window w_idle_test ACTIVATE event set idle function

ACTIVATE EVENT:
idle(5)



Hope it helps
berX

Author

Commented:
hello friends,
i did all the stuffs that all u told....

actually my requirement is that if the application is idle for the certain period, it should popup the login screen, so no one can do anything without entering the password of the currnet logged in user...it's like screen saver password....user don't want to use default lock computer facility of the windows2000 :)

so namasi i don't want to use sleep function here...

but i found that the problem is with windows2000 OS.
i done the same with pb6.5, pb7.0 and pb9.0...
same problem is still there...in my office i tested on two different computers having same windows2000 OS.

but at my home i have windows2000 with pb7.0..and there it's working fine....no any problem...

so is there any OS or system configuration required for this ????

it's urgent.....

thanks for any help that can solve my problem...

-sandeep

CERTIFIED EXPERT

Commented:
I misunderstood the question initially. I tried the same under windows 2000 (service pack 3) using PB 8. Works irrespective where the mouse is.
Don't rellay have an idea what may be the cause...
It may be something to do with some process/service running on you two servers..
Try stopping the services/processes one by one...
Or try putting code ( may be a messagebox or write something.. may be current time.. to a file) in the mouse related/Activate event and see if they are being fired continuously when the mouse pointer is over your app window.

Regards,
VIkas
CERTIFIED EXPERT

Commented:
Sandeep,
VIkas's suggestion is very good. Perhaps you want to run the pb trace and see if there any continuous activities. Your home PC, Work PC run same version of Windows right (inluding service pack). Have you tried with a simple app to test.?

regards-

Author

Commented:
hi vikas,
your suggestion is really fine...i wrote the code in the activate event and mousemove event of window to create log file with date and time in it.

integer li_FileNum

li_FileNum = FileOpen("C:\idle.txt", StreamMode!, Write!, LockWrite!, Append!)
filewrite(li_filenum,'~r~nmouse:'+String(today(),'dd/mm/yyyy hh:mm:ss'))
fileclose(li_filenum)

though my mouse is not moving this code is being executed continously...following is the content of file for the reference

activate:03/04/2004
mouse:03/04/2004 12:35:24
mouse:03/04/2004 12:35:25
mouse:03/04/2004 12:35:25
mouse:03/04/2004 12:35:25
mouse:03/04/2004 12:35:25
mouse:03/04/2004 12:35:25
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:27
mouse:03/04/2004 12:35:30
mouse:03/04/2004 12:35:30
mouse:03/04/2004 12:35:30
mouse:03/04/2004 12:35:30
mouse:03/04/2004 12:35:30

so it's sure that something is working in background...by the time if you or anyone found any hint u can post...thanks again to u all for then help. meanwhile i m checking the root cause...

-sandeep
Hi sandeep,

Just also try printing the ypos, xpos and flag argument.. and see if they change at all..
Also go through the mouse setting and see if you find something strange there...
Try to make it same as what is there on your Home PC..

Regard,
Vikas D

Author

Commented:
thanks vikas,
atleast i got the root cause of the problem

yup, it is due to the service pccntmon.exe !!!!

if the service is running, in the background something is happening with mouse. Following is the output if the service is running....

activate:04/04/2004
mouse:04/04/2004 09:43:41  X-827  Y-320  flags-0
mouse:04/04/2004 09:43:41  X-827  Y-320  flags-0
mouse:04/04/2004 09:43:41  X-827  Y-320  flags-0
mouse:04/04/2004 09:43:43  X-827  Y-320  flags-0
mouse:04/04/2004 09:43:45  X-827  Y-320  flags-0
mouse:04/04/2004 09:43:48  X-827  Y-320  flags-0
mouse:04/04/2004 09:43:53  X-827  Y-320  flags-0
mouse:04/04/2004 09:43:58  X-827  Y-320  flags-0

time to fire idle event is 5 seconds and see mousemove event is fired without any change in x-pos,y-pos or flags !!!!

once i stop the service it's working fine...but i can't stop this service

what else we can try ?

Great  !!!!!!!

You can submit a bug at trendmicro...... :).. Or try getting the latest version of it ......
May be this process is sending mouse events to all the active window ?? Whay would it do that ?
Else we may need to think of a work-around... to simulate the idle function.

-Vikas

CERTIFIED EXPERT

Commented:
Wow, Learnt something new today.

See this link. There is a removal utility.
http://www.2-spyware.com/file-pccntmon-exe.html


Hi sandeep,

Just being curious, did you find any fix for this...?

Vikas

Author

Commented:
Hi Vikas,

I reported the bug to sybase...also i send them the sample application....but they r not giving quick response....they have not assigned the higher priority for the bug....so i m waiting for the solution from them....

Right now i had cancelled to give such facility to user :(

Wait and Watch

Thanks sandeep !

Have u also tried putting it up with trendmicro... It seems to be their app that is creating the problem...

--Vikas

Author

Commented:
hi,
still the problem is not solved...and i don't think sybase will give any solution so u can do whatever u like....

-sandeep
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.