Information générale
Catégorie:
Fonctions Windows API
Titre:
Calling Color Picker in form
I am using the following to call the Color Picker
oDlg = Createobject("GetColorEx")
= oDlg.Getcolor(255)
DEFINE CLASS GetColorEx AS form
*Left = 100 && Set Dialog Position by positioning the form
*Top = 100 && Set Dialog Position
AutoCenter = .T.
Name = "GetColorEx"
DoCreate = .T.
Visible = .F.
lUserCancel = .F.
ADD OBJECT oCDC AS OleControl WITH ;
OleClass = "MsComDlg.CommonDialog"
PROCEDURE oCDC.Init
This.Flags = 2+1
This.CancelError = .T.
ENDPROC
PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
IF nError = 1429
This.lUserCancel = .T.
ENDIF
ENDPROC
PROCEDURE GetColor(tnInitColor)
LOCAL lnColor
IF PCOUNT() > 0
Thisform.oCDC.Color = tnInitColor
ENDIF
Thisform.oCDC.ShowColor()
IF Thisform.lUserCancel
lnColor = -1
ELSE
lnColor = Thisform.oCDC.Color
ENDIF
RETURN lnColor
ENDPROC
ENDDEFINE
This sits in a PRG that is called from the menu. I have not touched the PRG in over a year. Everything worked fine until several weeks ago. It still comes up, but when the form is closed, the mouse no longer works in VFP. My menu hot keys still work and when I use a menu hot key to bring up a form, I can type in the form but not use the mouse (except inside a combo). If I run the above PRG from the Command Window, everything works fine.
If I move the EXE of my app to another machine, I have the same failure issues.
I am suspicious that the Common Dialog on my machine has developed a problem. Can I just restore the common dialog DLL/EXE from a backup?
Any thoughts?
Tim
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement