Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11775
| From | James Martin <james@northwoodlumber.com> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Save ShellWindow size position and reset for opening |
| Date | 2018-07-19 10:37 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <piq7na$msg$1@dont-email.me> (permalink) |
| References | <d8b57156-b369-426e-8b99-b2665daa7efa@googlegroups.com> <d2f1d0e7-e8f9-43f0-b9ab-9e8a03e3c7be@googlegroups.com> <a7eaedbd-1e5d-4c37-b624-d4907480fe83@googlegroups.com> |
I always saved my screen position and size in an ini file. That way if a
person has 2 monitors, shuts down the the program on the added monitor,
and tries to start the program when he has only one monitor, he can edit
the ini file to start the program where he wants. This can happen when
you use a laptop.
James
On 07/18/2018 11:14 PM, Ramazan wrote:
> On Thursday, 19 July 2018 00:25:10 UTC+3, Leo_Bond wrote:
>> Hi, Ramazan.
>> Try this:
>>
>> in the Close() method of your window:
>> local oBB as BoundingBox
>> oBB:=self:WindowArea // assuming SELF is your window
>>
>> You may want to save oBB:Top, oBB:Left and so on values to the Registry, ini or a table.
>> While starting your program call SetWindowPos(...) with these values as params. In fact you need Top, Left, Width and Height params.
>> Z-order and flags may be used at your own will and need.
>> HTH
>
> It will be auto in this way, I'will try later on, thanks for sugestion.
>
> Actually, belove code is working.
>
> METHOD SaveScreenSizePos() CLASS SShellWindow
>
> LOCAL lpRect is _winRECT
> LOCAL wTop, wLeft as int
>
> LOCAL sScrLeft as STRING
> LOCAL sScrTop as STRING
> LOCAL sScrWidth as STRING
> LOCAL sScrHeight as STRING
>
> LOCAL sTotStr as STRING
> LOCAL oASReg as Class_HKLM
>
> oASReg := Class_HKLM{}
> oASReg:Working_Subkey := "SOFTWARE\AgriSoft_Int\OK7Setings"
>
> sScrWidth := NTrim(SysObject():Size:Width)
> sScrHeight:= NTrim(SysObject():Size:Height)
>
> GetWindowRect( SysObject():Handle(), @lpRect )
> wTop := Max( lpRect.top, 0 )
> wLeft := Max( lpRect.Left,0 )
>
> sScrTop := NTrim(wTop)
> sScrLeft := NTrim(wLeft)
>
> sTotStr := sScrLeft + "," + sScrTop + "," + sScrWidth + "," + sScrHeight
> oASReg:WriteString( "", "OKScrPos", sTotStr )
>
> RETURN nil
> METHOD ReSetShellPosition() CLASS SShellWindow
>
> LOCAL sSLeft as STRING
> LOCAL sSTop as STRING
> LOCAL sSWidth as STRING
> LOCAL sSHeight as STRING
>
> LOCAL sTotStr as STRING
> LOCAL oASReg as Class_HKLM
>
> oASReg := Class_HKLM{}
> oASReg:Working_Subkey := "SOFTWARE\AgriSoft_Int\OK7Setings"
> sTotStr := oASReg:GetString( "", "OKScrPos" )
>
> IF !Empty( sTotStr )
> sSLeft := SubStr( sTotStr, 1, At(",", sTotStr) - 1 )
> ScrLeft := Val( sSLeft )
> sTotStr := SubStr( sTotStr, At(",", sTotStr) + 1, -1 )
>
> sSTop := SubStr( sTotStr, 1, At(",", sTotStr) - 1 )
> ScrTop := Val( sSTop )
> sTotStr := SubStr(sTotStr, At( ",", sTotStr) + 1, -1 )
>
> sSWidth := SubStr( sTotStr, 1, At(",", sTotStr) - 1 )
> ScrWidth := Val(sSWidth)
> sTotStr := SubStr( sTotStr, At(",", sTotStr) + 1, -1 )
>
> sSHeight := sTotStr
> ScrHeight := Val( sSHeight )
>
> SetWindowPos( self:Handle(), null_ptr, ScrLeft, ScrTop, ScrWidth, ScrHeight, SWP_SHOWWINDOW )
> ENDIF
>
> RETURN nil
>
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Save ShellWindow size position and reset for opening Ramazan YETİŞİR <ryetisir@gmail.com> - 2018-07-18 09:09 -0700
Re: Save ShellWindow size position and reset for opening JohnMartens <martens@tennishulp.info> - 2018-07-18 18:44 +0200
Re: Save ShellWindow size position and reset for opening Ramazan YETİŞİR <ryetisir@gmail.com> - 2018-07-18 09:58 -0700
Re: Save ShellWindow size position and reset for opening Ramazan YETİŞİR <ryetisir@gmail.com> - 2018-07-18 10:49 -0700
Re: Save ShellWindow size position and reset for opening JohnMartens <martens@tennishulp.info> - 2018-07-18 21:55 +0200
Re: Save ShellWindow size position and reset for opening Ramazan <ryetisir@gmail.com> - 2018-07-18 20:09 -0700
Re: Save ShellWindow size position and reset for opening Leo_Bond <l.bond@bk.ru> - 2018-07-18 14:25 -0700
Re: Save ShellWindow size position and reset for opening Ramazan <ryetisir@gmail.com> - 2018-07-18 20:14 -0700
Re: Save ShellWindow size position and reset for opening James Martin <james@northwoodlumber.com> - 2018-07-19 10:37 -0400
Re: Save ShellWindow size position and reset for opening JohnMartens <martens@tennishulp.info> - 2018-07-19 17:01 +0200
csiph-web