Page 1 of 2 12 LastLast
Results 1 to 40 of 54

Thread: VB6 which runs from Windows session log in "this app seems to not respond"

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    VB6 which runs from Windows session log in "this app seems to not respond"

    Seems like in some update in win7 and up, the time for an app to be flagged as "not responding" was shorted.

    Worst is that damn little window really HALT the app execution until the user do click in RETRY.

    I already tryed to disable window ghosting, and it disable the ability of moving "the non responding app" GUI from place, or minimize it, but it don't disables the damn little window halting the app and letting the user to close the process or retry.

    now why it is not responding in first place?

    it is because this app "kiosk management client", must run from session StartUp, and this app uses disk I/O if toyed it pick up WAV file from skin theme to play button/menú SFX (MCI ocx) and also write periodically the windows registry to let other app to know this app is alive, not hung or frozen.

    The problem is that when windows session start up, a huge ammount of disk I/O is being perform by all other ****** things, like AV, or AMD gaming evolve, or others APP, or the windows itself.

    Obvious this I/O resourse saturation happens in HDDs, is hardly seen in SSD.

    Also can happen when the gamer launch a big big game, and start toying with the app.

    Now, this didn't happen never in early versions of win7 or XP.

    It started like year 2014 or so. and we can't asks , use a non updated win7. Impossible.

    So, what the hell I can do?
    Last edited by flyguille; Mar 13th, 2017 at 12:31 PM.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Without knowing what your app is doing it is hard to say. Best guess is that there is something going on in your app that is taking a long time to execute and causing this message to appear.
    First step would be to determine what code in your app is at fault and then look for ways to correct the issue.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Technically, is doing nothing, just ping/pong protocol TCP/IP to the server, which is nothing.

    Writing a single key in the registry each 5 seconds or something like that.

    That is doing in background without user intervention.



    But, if the user click on the button, the skin theme order to open a sound wav file, so it needs to READ a tiny wav file to play as the button is pressed.

    now, for that it place the path/file in MCI32 iirc, Open method and play.Ç

    But as the PC is just starting , there is a lot of disk i/O activity by all others apps, is to say the HDD red led is solid lighted.

    And during that period, some users kown if touch the kiosk management litle windows , the windowd claiming the app don't respond is triggered.

    Ofcourse is not responding, the O.S. is delaying like 10 seconds the disk I/O for attend that app. As it previously to the click was in background (withouyt focus), iirc Windows threat it as low priority I/O or someting. And the app gets starving, of I/O.... and happens most cyber coffes in south america stil using old 500GB hdds if not worst on FX8350 8GB or better, but the disk are the worst.
    Last edited by flyguille; Mar 13th, 2017 at 12:54 PM.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    So I want is a way to disable that little windows feature, this app seen to not respond, or at least for the process?

    repeat: disabling windows ghosting don't disable that other function.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    I found this, it wasn't on google last time I searched or now I searched different.

    https://social.technet.microsoft.com...w7itprogeneral

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    done!, was the solution, and KNOW what?, now the app don't hung, just editing that key un current user. The app responds quickly include if HDD is saturated on session start up.

    Incredible, the WER (windows error reporting) is cloggin the APP!. And now it respond quickly, not micro-hungs, nothing!, is like, it just offload a lot of background work in WINDOWS!

    It is amazing, all others APP too!, works faster, no more oversaturated HDD, incredible the effect it has!. Just for that key setup! WOWWWWW!.

    just restarting restarting and testing, I can't believe it ! but it did magic!.

    now the app respond in half second, one second, two seconds MAX when all others apps in the startup are loading....

    and the key was there, just with value 0, not 1.
    Last edited by si_the_geek; Mar 18th, 2017 at 04:36 PM. Reason: removed profanity

  7. #7
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Interesting, I'll have to look into this as well.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DataMiser View Post
    Interesting, I'll have to look into this as well.
    I needs to test more, to see if it wasn't a false alarm in the first machine I tested the change. I am into it now.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    it was a false alarm, by some reason the machine tested don't do the problem, prior the test.

    But seems that everyone askin at microsoft, gets similar replies.

    there is others keys to test.... maybe the key "disable" will do it everything at all.

    atleast is this is not the typical ... go disable windows ghosting feature, which has nothing to do! with the other feature.

    Disabled
    REG_DWORD
    Possible values:
    0 - Enabled (default)
    1 - Disabled
    Enable or disable WER
    Last edited by flyguille; Mar 13th, 2017 at 03:07 PM.

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    DebugApplications\[ExeName] (replace "[ExeName]" with an actual name of an .exe file, for example, "notepad.exe")
    REG_DWORD
    Possible values:
    0 - Processes with an executable image name of [ExeName] do not require the user to choose Debug or Continue (default)
    1 - Processes with an executable image name of [ExeName] require the user to choose Debug or Continue
    DebugApplications\* ("*" is the literal value name)
    REG_DWORD
    Possible values:
    0 - All processes except ones specified explicitly in the setting DebugApplications\[ExeName] do not require the user to choose Debug or Continue (default)
    1 - All processes except ones specified explicitly in the setting DebugApplications\[ExeName] require the user to choose Debug or Continue

    this seems promising.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    oh no , those last one, I thikins it is the famous window when the app already crashed or so, but the "continue" ledme to thing can be the little ****** window.

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    another dead-end, WER is for reporting to Microsoft or to debug/close the app, and is not related or maybe it is, but there is no keys for controlling the "seen not responding" little window.

    I disable it all, and the "seens not responding windows appear if overload pc and toying the window so much".

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    and I thinks what is going on, Microsoft simply don't want the feature be disabled and that slower/heavier responsing apps from old days be in Win7, forcing programmer to handle faster the events, improve code, etc.

    But how? if it just waiting for the saturated disk i/o service!.

    A solution I can think, is to set the process to get higher priority about I/O too, it already has higher than normal in CPU usage, but not in I/O.

    Anyone already tested that solution?

  14. #14
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    If your app waits for anything synchronously without using polling on the UI thread (being that vb6 is generally always single threaded) - your window isn't responding to any windows messages in a timely manner. As far as windows is concerned - your app is frozen. It really has nothing to do with an app being old.

    The easiest way around this is to use an asynchronous method. Something like shellAndWait to another non-ui process, is the easiest fix.
    For something a little more complex you can use a multi-threading component like Krool's from the codebank, or if you're down with closed source, schmidt's vbRichClient also has a threading component.

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    If your app waits for anything synchronously without using polling on the UI thread (being that vb6 is generally always single threaded) - your window isn't responding to any windows messages in a timely manner. As far as windows is concerned - your app is frozen. It really has nothing to do with an app being old.

    The easiest way around this is to use an asynchronous method. Something like shellAndWait to another non-ui process, is the easiest fix.
    For something a little more complex you can use a multi-threading component like Krool's from the codebank, or if you're down with closed source, schmidt's vbRichClient also has a threading component.
    I already stated that the app is not doing large processes.

    The problem here is when the computer is starting up or big games are launched, overloading the HDD usage, it will prevent my app gets disk I/O quickly, so the app get delayed and delayed in background, EX.: I thinks a simple OPEN "filename" as#1 sentence, can be delayer for seconds and seconds if other major activities are in place, like just starting up (my app runs from the task scheduler session LogIn as trigger), or launching bigger games, like GTA V, BF1, etc.

    if the HDD is not overloaded my app runs just fine, quickly, and uses 0.5% of the cpu, or less, or 1.5% as peak in an average PC, mostly of that time is open file disk access.

    And this kind of problems don't show in the old XP, I suspect about the new feature of Windows to give more performance in the focused app, and the background apps to delay or lower the priority or something, except of course if hardware timer in use.

    Also note that actually it needs the user to click on the Windows to appear the "not responding little window", if the app is let alone, nothing happens, it simply works, as it shows a contract time count down, some customers claims that it shows skipping seconds, which I always known the image can be frozen if an opening Window is covering the app, or very old hardware.

    My app opens a file on a timer event, if the file is not present, it does nothing. Include looking for a file can be delayed.

    So, that is my theory of the problem.

    I also suspects about app frozen by delaying disk i/o because the easy way to trigger "app don't respond", is when it needs to play a WAV fije with MCI32.ocx

    The other thing which can be, is if the usual routine for writing the Windows registry can be delayed aswell. The app updates a key on a timer event, and also searchs for USB devices looking for the keys.

    anyone knows if windows registry access APP can hold the execution? or blocked in some way? my app runs elevated.
    Last edited by flyguille; Mar 14th, 2017 at 08:26 AM.

  16. #16
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Try this API when you start your app:

    Code:
    Public Declare Sub DisableProcessWindowsGhosting Lib "user32" ()

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by jpbro View Post
    Try this API when you start your app:

    Code:
    Public Declare Sub DisableProcessWindowsGhosting Lib "user32" ()
    that is not related to the Window "not respond" detection.

    That just disable the ability of minimizing or move the ghost Window generated if the original Window is not responding.

    But the alert feature saying "not responding" continue active.

    The bad thing, and I thikns is a Windows design problem, is that the alert is BLOCKING the execution, like a MsgBox does!, ideally if that little window runs apart, and if the app just start responding again, that little alert dissapear. But not, the fact that little alert is there, it blocks the app. and if the user don't respond to it or can't respond, the app will be taken as hung or crashed after a minute, and my software is designed to launch another instance of it automatically. Which is not good to have the problem at first place.
    Last edited by flyguille; Mar 14th, 2017 at 09:29 AM.

  18. #18
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    jpbro posted a good idea.

    I think you're beyond help, but for anyone else trying to solve "not respond" issues, feel free to read about Windows Ghosting.

    https://blogs.technet.microsoft.com/...-your-windows/

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    jpbro posted a good idea.

    I think you're beyond help, but for anyone else trying to solve "not respond" issues, feel free to read about Windows Ghosting.

    https://blogs.technet.microsoft.com/...-your-windows/
    yeah, more the same, that article is wrong, DisablePRocessWindowsGhosting is for NOT allow minimiza/move window when seems not responding, it don't disable the alert.

    I don't understand why the ppl are so confused about what DisablePRocessWindowsGhosting does.

    Just test it, programming a VB6 with an infinite loop on a click event. and note the differente with, or without it.
    Last edited by flyguille; Mar 14th, 2017 at 11:14 AM.

  20. #20
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    I tried a form in an infinite loop. When I call DisableProcessWindowsGhosting() I can't move, resize, minimize, etc... but I also don't get a ghosted/faded window, nor do I see "Not Responding" in the title bar.

    If I don't call DisableProcessWindowsGhosting() then I get the ghosted/faded window, and I can move, resize, minimize, but it also says "Not Responding" in the title bar.

    In neither case do I see the window that asks you to Retry, Switch To, etc... though? I'm testing on Windows 10.0.14393, tried compiling to both P-Code and Native code.
    Last edited by jpbro; Mar 14th, 2017 at 12:35 PM.

  21. #21
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Maybe all you can do is refactor your potentially busy code areas into "steps" and call them from a timer event?

    I do this in some areas of my code, and one other trick I found useful to keep performance up is to put a Do While Loop in the Timer event to call multiple steps for up to 1 or 2 seconds, then leave the loop and process the next step(s) on a subsequent Timer event. This also allows you to show animated "marquee" style windows so the user knows that the software is just busy working on something.

    For the Disk I/O you might want to read your WAV files in "chunks" of bytes (maybe 32k or 64k at a time?). When the whole file is in memory you can then play it.

  22. #22
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    verifying that DisableProcessWindowsGhosting() works as advertised on Win7 and Win10.
    No "Not Responding" message or Ghosted window.

  23. #23

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    verifying that DisableProcessWindowsGhosting() works as advertised on Win7 and Win10.
    No "Not Responding" message or Ghosted window.
    srly? my app already has that call on Form_Load... can't be.....

    Testing in an empty project.

    copy/past the declaration here

  24. #24

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    I have it as the first thing executed

    Public Declare Function DisableProcessWindowsGhosting lib "user32" () As Long

    then

    in form load evnet

    dim h as long

    h DisableProcessWindowsGhosting


    what is wrong?, also there is not previous on error goto, so, it must trigger an error if not found.

  25. #25
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    You also stated your app is "not doing large process" but then contradict yourself by saying you are using mci32 to play a sound.

    well unless you're doing the play using SND_ASYNC, it _is_ a large process as far as VB is concerned. If its not an ASYNC call, VB sits and waits until the call is completed, not responding to windows messages.

  26. #26

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by flyguille View Post
    I have it as the first thing executed

    Public Declare Function DisableProcessWindowsGhosting lib "user32" () As Long

    then

    in form load evnet

    dim h as long

    h DisableProcessWindowsGhosting


    what is wrong?, also there is not previous on error goto, so, it must trigger an error if not found.

    ok tested in a simple empty project, which has 2 buttons one for set the Disable ghosting, other for hung in an while true wend

    and it works, no ghosting and never it shows the "don't respond"

    So...., why my full feature app with the same function call code, does show the "not responding", and I know the function is taken in account because it don't show the usual window ghosting feature (grayed, appear title if not have, and allow to minimize)...

    So, it don't works if using sockets, or using some windows feature? what is detected a non responding, can be it is not the same process, but other process as not responding and the feature of "not responding" is targeted to the parent process?

    hmmmmm

  27. #27

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    You also stated your app is "not doing large process" but then contradict yourself by saying you are using mci32 to play a sound.

    well unless you're doing the play using SND_ASYNC, it _is_ a large process as far as VB is concerned. If its not an ASYNC call, VB sits and waits until the call is completed, not responding to windows messages.
    Mci32 is not syncrhonous when playing., I thinks it can be when synchronous when using the OPEN method, but not the PLAY method. Atleas don't runs in the same thread as the VB code.

  28. #28

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    You also stated your app is "not doing large process" but then contradict yourself by saying you are using mci32 to play a sound.

    well unless you're doing the play using SND_ASYNC, it _is_ a large process as far as VB is concerned. If its not an ASYNC call, VB sits and waits until the call is completed, not responding to windows messages.
    I just check , it is using MMControl, which uses .Command method with the commands like "Open" , "Play", etc.

    Stop, Close, Filename = file , Open , Play.

    I mentioned MCI32 because I remember to have to include those DLL in old XP system when distributing it.

    anyway the wavs are just half second, one whole second... or maybe less than half second.

  29. #29

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    well, just see the code, it is using WMI service for listing USBs, not reading registry keys, I thinks an old version was using the read registry but inefficient, and in some version i switched to WMI service, and is doing this also for controlling the hardware stock too, so it is looking for all kind of classes. Pufffff.....

    maybe this is the culprit.

    So maybe if this service is used, it ignores the DisableWindowGhosting, this can be a last theory.


    EDIT: this theory falls apart, it is managed to request one class per timer event, it can't be...

    anyone has experience with wmi?
    Last edited by flyguille; Mar 14th, 2017 at 12:48 PM.

  30. #30
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Do you use any ActiveX EXEs in your project, or perhaps some third-party components?

  31. #31

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by jpbro View Post
    Do you use any ActiveX EXEs in your project, or perhaps some third-party components?
    +


    it has activeX exe, but not at the moment of being able to trigger the "not responding "retry" "continue"", by example if printing it uses activeX EXE for file DCC transfer in background (no UI on that EXE).

    But I manage to get the alert before any printing or screenshot request (the other reason for having that activeX loaded).

    it also do Window captions listing, is to say, enum windows, and gets the names, for loging activity/anti-porn, but iirc, it is not related, also does processes enumeration, and uses an API to get the filename of each process. but that is done ... one time per like 8 seconds....

    maybe is the sum of every tasks which some time is delaying too much... but why? if task manager claim 0, 1 or 1.5% cpu usage...., has nosense.

    and only get stuck in heavy disk i/o background activity, relate to others apps loading up. Which is more related to hardware yeld, because with SSD hardly see the alert.

  32. #32
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Just to clarify things, you say the app "Technically, is doing nothing" but reading through this thread it seems to be doing

    • TCP/IP Pings
    • Registry Key update every 5 seconds
    • Opening a file by timer
    • searchs for USB devices
    • Enumerating windows
    • Process enumeration, including filename discovery every 8 seconds
    • WMI queries
    • play wav file via MCI

    Is it really doing all these things?

    That seems more than "nothing". I imagine some of these things might be heavily used during startup (registry access, process loading etc) that are going to impact your application's performance.

  33. #33

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by PlausiblyDamp View Post
    Just to clarify things, you say the app "Technically, is doing nothing" but reading through this thread it seems to be doing

    • TCP/IP Pings
    • Registry Key update every 5 seconds
    • Opening a file by timer
    • searchs for USB devices
    • Enumerating windows
    • Process enumeration, including filename discovery every 8 seconds
    • WMI queries
    • play wav file via MCI

    Is it really doing all these things?

    That seems more than "nothing". I imagine some of these things might be heavily used during startup (registry access, process loading etc) that are going to impact your application's performance.
    technically it just two normal Timers, and in the TIMER event is a system TickCount read.

    now, each task is perform every X ammount of time passed.

    So, on a normal load, if passed 8000 miliseconds, a process enumeration is updated.

    if passed by example 1000 miliseconds, windows captions are enumerated and captions listed, then is applied anti porn rules or just sent it to server if needed.

    if the user click a button , it is played a little SFX. Which the easy way to trigger "the not respond alert", is to click on the window, if done in a button it will play SFX wav. But others click maybe don't produce any sound, depends on the skin script.

    the open a file ONLY if it exists, by example the VIRTUAL PRINTER generate a file which reports here it a print job for you to move it to the server. But if not printing, it don't open anything, but checking if exists it must run a directory find, right?, so accessing disk anyway.

    then ofcourse it maintain a TCP connection, with backgroun ping/pong if inactivity long enough.

    WMI queries, yes, but I already checked it is one quieried class per Timer event. So it is doing it the long way, maybe it completes all the classes with in one whole minute.

    I don't see anything overloading.


    But I now see this:

    If this app, is in background, and loading a big game Windows simple don't execute it for a while, like 10 seconds of not being executed, the next time the app will be attend by Windows, it will read TickCount, determine it passes 10 seconds... and all the task will run within the same Timer_Timer event!. And that maybe is clogging the app only when Windows start up, or when big games are launched.




    ADDED: but nothing of this is not telling why DisableProcessWindowGhosting IS IGNORED, it has effect, because no grayed title window ghosting, but the not responding message alert.
    Last edited by flyguille; Mar 14th, 2017 at 02:20 PM.

  34. #34
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    It takes 0% cpu for an app to "wait" on an I/O call.


    Check this thread on how to solve your Async Play issues.

    http://www.vbforums.com/showthread.p...th-Wait-False)
    Last edited by DEXWERX; Mar 14th, 2017 at 02:26 PM.

  35. #35

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    It takes 0% cpu for an app to "wait" on an I/O call.


    Check this thread on how to solve your Async Play issues.

    http://www.vbforums.com/showthread.p...th-Wait-False)
    In that thread, he has problems because he wanted to play it four times, so wating for play completion, I don't do that, I just STOP any previous play, and open / play again. So, SFX are not overlapping or something, also is a single instance of MMControl, so not sound overlapping capabilities. It is just tiny sounds, don't expect it to give problems.

  36. #36
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by flyguille View Post
    In that thread, he has problems because he wanted to play it four times, so wating for play completion, I don't do that, I just STOP any previous play, and open / play again. So, SFX are not overlapping or something, also is a single instance of MMControl, so not sound overlapping capabilities. It is just tiny sounds, don't expect it to give problems.
    If the drive is busy - It doesn't matter how small the files are, it's going to cause your app to hang.

    You set .Wait to false to use the MMControl asynchronously, and you can Loop/Sleep/DoEvents while waiting for the file to open or play.
    You can use the Done Event, to trigger when you can proceed out of your DoEvents Loop. This allows you to not have to change your flow control.

    Good luck!

  37. #37

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    If the drive is busy - It doesn't matter how small the files are, it's going to cause your app to hang.

    You set .Wait to false to use the MMControl asynchronously, and you can Loop/Sleep/DoEvents while waiting for the file to open or play.
    You can use the Done Event, to trigger when you can proceed out of your DoEvents Loop. This allows you to not have to change your flow control.

    Good luck!
    and how the hell previously you known the hard disk activity level? to skip the task at all is beter than wait, but how you will know?

  38. #38
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    if you do it async, it doesnt matter if the drive is busy or not. either way the app doesn't "hang".

    you can use an mmtimer or QPC and set a timeout on your wait loop, if you want to cancel the operation.

  39. #39

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    Quote Originally Posted by DEXWERX View Post
    if you do it async, it doesnt matter if the drive is busy or not. either way the app doesn't "hang".

    you can use an mmtimer or QPC and set a timeout on your wait loop, if you want to cancel the operation.
    can you point an example of that method?.

  40. #40
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 which runs from Windows session log in "this app seems to not respond"

    I'm sure you can refactor this nicely, but here's a draft.

    Code:
    Option Explicit
    
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Private m_Busy As Boolean
    
    Private Sub Form_Load()
        Show
        
        ' Set properties needed by MCI to open.
        MMControl1.Wait = False ' Async
        MMControl1.DeviceType = "WaveAudio"
        MMControl1.FileName = "C:\WINDOWS\Media\Windows XP Startup.wav"
    
        ' Open the MCI WaveAudio device.
        m_Busy = True
        MMControl1.Notify = True
        MMControl1.Command = "Open"
        Dim Start As Single: Start = Timer
        Do
            DoEvents
            Sleep 1
            If Timer - Start > 0.2 Then Exit Do ' timeout
        Loop While m_Busy
        If Not m_Busy Then MMControl1.Command = "Play"
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        MMControl1.Command = "Close"
    End Sub
    
    Private Sub MMControl1_Done(NotifyCode As Integer)
        m_Busy = False
    End Sub

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width