Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PEMEditor and Buffer Overrun problems
Message
De
02/10/2009 09:35:21
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01427076
Message ID:
01427295
Vues:
54
Hi,

>Hi Lim,
>
>Yes, send me this code, please. I worked with ProDataHandler only once and to work with it I uninstalled PEMEditor at that time and used the regular VFP environment.
>

* Test whether PemEditor is installed
PROCEDURE lIsPemEditorInstalled
LOCAL lResult, nArea

nArea = SELECT(0)

USE (_FOXCODE) IN 0 AGAIN SHARED ALIAS MODFOXCODE
SELECT MODFOXCODE
LOCATE FOR (MODFOXCODE.TYPE = [M]) AND (ALLTRIM(MODFOXCODE.ABBREV) = [24460]) AND ;
	("PEMEDITOR.APP" $ UPPER(DATA))
lResult = FOUND()

* Close table
USE IN SELECT([MODFOXCODE])
SELECT (nArea)
RETURN lResult
* Dis/Enable Pem Editor by deleting or restoring the corresponding FoxCode records
Note:
1. Depends on where you have placed PemEditor, change the path to EditPropertyDialog.H and StartPEMEditor.PRG accordingly
2. Convert all calls to uPop() to MessageBox()
3. uSetPemEditor(!lIsPemEditorInstalled()) should toggle PemEditor installed or removed
#include "i:\Vfp9\Prj\Utl\3rdTools\PEM editor\Source\EditPropertyDialog.H"
PROCEDURE uSetPemEditor(lEnable)
LOCAL nArea, cSetDeleted, nLen, nAbbrev, nFound, nRec, nCount

nArea = SELECT(0)
cSetDeleted = SET("Deleted")
nLen = 4
DIMENSION aAbbrev(nLen)
aAbbrev[1] = [24460]
aAbbrev[2] = [EDIT PROPERTY/METHOD...]
aAbbrev[3] = UPPER(ccLOC_MENU_NEW_PROPERTY)
aAbbrev[4] = UPPER(ccLOC_MENU_NEW_METHOD)
USE (_FOXCODE) IN 0 AGAIN SHARED ALIAS WORKING ORDER 1
SELECT WORKING
IF lEnable
	IF [O] = TYPE([_oPEMEditor])
		uPop([Pem Editor is already enabled!], "W")
	ELSE

		* If more than 1 set of PemEditor's entries are found deleted in
		* FoxCode, RECALL only the lastest
		SET ORDER TO
		SET DELETED OFF
		nFound = 0
		nCount = 0
		FOR nAbbrev = 1 TO nLen
			nRec = 0
			GO TOP
			LOCATE FOR (aAbbrev[nAbbrev] = ALLTRIM(WORKING.ABBREV)) AND ;
				("PEMEDITOR.APP" $ UPPER(DATA))
			DO WHILE !EOF() AND FOUND()
				nFound = 1 + nFound
				IF DELETED()
					nRec = RECNO()
				ENDIF
				SKIP 1
				LOCATE FOR (aAbbrev[nAbbrev] = ALLTRIM(WORKING.ABBREV)) AND ;
					("PEMEDITOR.APP" $ UPPER(DATA)) REST
			ENDDO
			IF !EMPTY(nRec)
				GO RECORD nRec
				RECALL
				nCount = 1 + nCount
			ENDIF
		NEXT
		IF EMPTY(nFound)

			* PemEditor's FoxCode record not found
			uPop([Pem Editor is not installed!], "E")
		ELSE
			IF EMPTY(nCount)

				* PemEditor is already enabled
				uPop([Pem Editor is already enabled!], "W")
			ELSE
				IF [O] <> TYPE([_oPEMEditor])

					* Launch the pemeditor
					DO i:\Vfp9\Prj\Utl\3rdTools\PEM editor\StartPEMEditor.PRG
					
					* Tab dock PemEditor to Property window on the left
					DOCK NAME _oPEMEditor POSITION 4 WINDOW Properties
				ENDIF
				uPop([Pem Editor is now enabled!])
			ENDIF
		ENDIF
	ENDIF
ELSE
	IF [O] = TYPE([_oPEMEditor])
		RELEASE _oPEMEditor
	ENDIF
	SET DELETED ON
	nCount = 0
	FOR nAbbrev = 1 TO nLen
		IF SEEK([M] + aAbbrev[nAbbrev]) AND ("PEMEDITOR.APP" $ UPPER(DATA))
			nCount = 1 + nCount
			DELETE
		ENDIF
	NEXT
	IF EMPTY(nCount)

		* PemEditor is already Disabled
		uPop([Pem Editor is already disabled!], "W")
	ELSE
		uPop([Pem Editor is now disabled!])
	ENDIF
ENDIF
USE IN SELECT([WORKING])
SELECT (nArea)
SET DELETED &cSetDeleted
>BTW, I was thinking - what would happen if you try to convert VPMDataHandler into prg and both Dev and Pro to prg as well? Would PEMEditor still choke on this class?
>
I hate VPMDataHandler.vcx
That is my last statement in my reply to ProMatrix support in the end.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform