Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Force VFP to open on Specific Monitor
Message
From
20/12/2022 10:11:12
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Installation, Setup and Configuration
Miscellaneous
Thread ID:
01685537
Message ID:
01685549
Views:
48
>Any easy way to set VFP to open on a specific Monitor (usually 2nd)?

Works for me, but I have a little class which saves the position and size of _screen into an .ini file on quit, and restores them on startup. This suffices for startup:
_Screen.Newobject("oPos","srposition","libs\ctls.vcx","","top,left,height,width")
and here's the class
**************************************************
*-- Class:        srposition (q:\rad\apvfp\byo\libs\ctls.vcx)
*-- ParentClass:  custom
*-- BaseClass:    custom
*-- Time Stamp:   04/07/06 07:26:08 PM
*
#INCLUDE "q:\sopstver\db\vfp9\foxpro.h"
*
DEFINE CLASS srposition AS custom
	cproplist = "top,left"
	Name = "srposition"
	inisection = .F.

	PROCEDURE save1
		LPARAMETERS cProp
		IF PEMSTATUS(this.Parent, cProp, 0)
			DO prof_w WITH this.parent, cProp, GETPEM(this.Parent, cProp)
		ENDIF
	ENDPROC

	PROCEDURE load1
		Lparameters tcProp
		uDefault=GetPem(This.Parent,tcProp)
		uValue=prof_r(This.Parent, tcProp,uDefault, Vartype(uDefault))
		Store uValue to ("this.parent."+tcProp)
	ENDPROC

	PROCEDURE Destroy
		*-- parent may be absent if I'm in development
		If Type("this.parent.name")="C"
			For i=1 To Getwordcount(This.cproplist,",")
				lcProp=Getwordnum(This.cproplist,i,",")
				This.save1(lcProp)
			Endfor
		Endif
	ENDPROC

	PROCEDURE Init
		Lparameters tcPropList
		If Pcount()>0
			this.cproplist=tcProplist
		endif
		this.inisection=this.Parent.Name
		Local i
		For i=1 to GetWordCount(this.cproplist,",")
			lcProp=GetWordNum(this.cproplist,i,",")
			this.load1(lcProp)
		endfor
	ENDPROC
ENDDEFINE
Prof_r and prof_w are my functions to write a profile string, you can easily substitute your own, or use some other type of storage instead. I'm passing the parent object as the first parameter and then converting that into a sys(1272) pathname in there, as a section name.
The include file is... probably not used at all, didn't check.
I guess this can be made simpler, but I just left it as it was as soon as it started doing what I needed.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform