Make a copy of \clipper5\include\std.ch as mystd.ch
Edit mystd.ch and add the line:
#translate inkey(0) => scrsaver()
Create a scrsaver() function that does whatever it should, but exits on INKEY().
FUNCTION scrsaver
LOCAL oldscr:=SAVESCREEN(0,0,24,79),i:=0,key:=0
CLEAR
DO WHILE key=0
@ 0,i SAY CHR(0)
key:=INKEY(1)
@ 0,i SAY " "
IF ++i>79
i:=0
ENDIF
ENDDO
RETURN key
Compile this as normal.
Re-compile all your source code with a /umystd.ch switch
Compile getsys.prg with a /umystd.ch switch and explicitly link it into your application.
This will catch all uses of INKEY(0), including the GET system. If you want to trap the MENU TO system, then you will need to write a replacement system and add it into mystd.ch as
#command SET MESSAGE TOwhere ss_setmess(), ss_prompt() and ss_menu() are your new functions.=> ss_setmess( ) #command SET MESSAGE TO => ss_setmess(0) #command @ ,
PROMPT [MESSAGE ] ; => ss_prompt( ,
, , ) #command MENU TO => :=ss_menu( )
Click here for my versions of these three functions. You are free to use these, provided you leave my copyright header in the code. Of course, you may need to comment out some bits that require the rest of my library to work, but that's part of the joy of using someone else's code, isn't it?
C++ (Usually MFC)
No code so far, but I've a screensaver you may like. It's written for Win 3.1, but does work with W95. It's called the Physicist's Desk because
Have fun.
A CRecordset SQL count(*) class
Sometimes all you want to know is how many records match certain criteria, without returning them all. In the normal CRecordset classes, you have to get all the records and then see how many there are (usually by scrolling through them all first). In SQL, you use "select count(*) where...". This class does the SQL for you in a CRecordset wrapper. It also helps you see what's going on inside and therefore how you might tweak it further. (I put it on Code Project as they have a much larger audience!)
Frequently Asked Questions
Not a full list, but a gradually-incresing set of questions I've answered, normally on UseNet.
If you're going to do a lot of adding & deleting, then you can add an extra field to your table which indicates whether the record is "alive" or "dead". Then, instead of deleting, you set the flag to "dead". When adding, you find a "dead" record & overwrite it. If there isn't a "dead" record, then add a new one.
When you do CRecSet->Open(), it will create a SELECT query using all the field names in DoFieldExchange or DoBulkFieldExchange. If you've changed a field name in the database but not in here, that would cause this error message.
If you then add the class via classwizard, it should work.
e.g. for method 2:
sql="delete from map";
TRY
{
db.ExecuteSQL(sql);
}
CATCH(CDBException, e)
{
AfxMessageBox("Failed to clear map: "+e->m_strError);
}
END_CATCH
Other files that get corrupted and can safely be deleted are *.aps, *.ncb and *.opt

Back to the home page