Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Making it clear/Making it better

 
Post new topic   Reply to topic    Bay Six Software Forum Index -> WMLiberty DLL
View previous topic :: View next topic  
Author Message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 728

PostPosted: Jan 29th, 2007, 10:20pm    Post subject: Making it clear/Making it better Reply with quote

It comes up every once in a while, the question about using only SCAN and not WAIT in any program that uses WMLiberty.

It is my experience, and confirmed by others, that WAIT just does not work properly wirh a callback in effect. As it stands now, LB seems to become "confused" or "lost" after returning from a callback function called while WAITing. LB stops processing events. The program stops responding and the process must be killed from Task Manager (i.e. Ctrl+Alt+Del).

Some people have stated that when they use SCAN with WMLiberty they get warnings that pop up saying something like "Protection Violation" but the program countinues to function nevertheless. I cannot remember the last time that has happened to me; maybe not since I first developed WMLiberty while debugging my code. Maybe it's my setup. I keep a copy of WMLiberty in my System folder (\Windows\system32 on XP). I don't think I'm using a more stable version of WMLiberty than what I have released. In fact, I believe I remember downloading it from my site after my last re-install of XP.

The following may or may not make a difference in an enhanced program's stability--they are just what I do.

When I starting writing programs using WMLiberty, I always used an idling loop at the top level--outside of any SUB or FUNCTION. I always try to avoid GOTOs at all cost, but LB's loops are known to leave reminants on the stack if not exited properly. So I'm pretty muck stuck with GOTO as my only option. Over the last couple of years or so, I've started placing my idling loop inside a SUB I name "DoEvents" a la VB. I place this SUB near the top of the program if not ahead of all other SUBs and FUNCTIONs. (For a demo I usually place the callback function first because that's the "meaty" part.)

Here is what the DoEvents SUB looks like.
Code:
Sub DoEvents
[DoEventsLoop]
    Scan
    CallDLL #kernel32, "Sleep", 50 As Long, ret As Void
    GoTo [DoEventsLoop]
End Sub


My original reasoning for doing this was that I could call DoEvents from anywhere in a program like VB programs use the command of the same name. It's a sort of replacement for WAIT that seems to be safer or more stable. However, it's probably not safe to rely on it as much as some VBers do. It wouldn't surprise me if every call adds to the stack. But it seems that calls left on the stack do not affect a program as much as loops left on the stack. Open SUB calls are possibly cleaned up when the calling body goes out of scope. Only Carl would know for sure.

What is the reason for even bringing this up? Well, for years I've developed some loosely defined "suggestions" for writing a WMLiberty-enhanced program, mostly from trial-and-error. These suggestions are spread out over a number of newsletter articles and forum posts and are not part of the documentation for WMLiberty. I think it about time WMLiberty users put our heads together and come up with a protocol or set of rules that must be followed to use the DLL successfully.

I would like you users to relate your experiences and opinions. Do you have trouble writing programs that use WMLiberty? Do you experience problems using programs that use WMLiberty that others do not? Do you see any fundamental flaws in the concept of WMLiberty? If the conclusion is that WMLiberty is flawed, then that knowledge will certainly help with developing Version 2.0.

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
BASICwebmaster
Guest





PostPosted: Feb 8th, 2007, 5:17pm    Post subject: Re: Making it clear/Making it better Reply with quote

The only time I have trouble with WMLiberty is when the code is sloppy. One thing that might help, I suppose, would be some sort of template program for using WMLiberty. I've never experienced any abnormal errors... nothing that hasn't been reported, anyway.

The flaws, IMHO, are not in WMLiberty, but, as Alyce metioned in another location on this forum, in the fact that the very idea is over the heads of some. Using WMLiberty requires at least a basic knowledge of Win32 programming. At the very least, one should know what Windows messages are, and how they operate. I wrote an article on the matter some time ago, and I think I may submit it for inclusion on LBPE.
Back to top
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 728

PostPosted: Feb 10th, 2007, 11:09pm    Post subject: Re: Making it clear/Making it better Reply with quote

Hi Bill,

I tend to agree with you.

I was developing a program to make using WMLiberty easier--ViviFire. VF has been on hold for quite some time, though. I'm considering restarting development. It will probably be a large rewrite.

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Bay Six Software Forum Index -> WMLiberty DLL All times are GMT
Page 1 of 1
Jump to:  
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



Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group