RPR EnsureNotCompletelyOffscreen
From CockosWiki
(Difference between revisions)
(→Examples) |
(→C++) |
||
Line 12: | Line 12: | ||
==Examples== | ==Examples== | ||
===C++=== | ===C++=== | ||
- | <source lang=cpp> | + | <source lang=cpp highlight=13> |
+ | void RestoreWindowPos(HWND hwnd, const char* cKey, bool bRestoreSize) | ||
+ | { | ||
+ | char str[256]; | ||
+ | GetPrivateProfileString(SWS_INI, cKey, "unknown", str, 256,get_ini_file()); | ||
+ | LineParser lp(false); | ||
+ | if (!lp.parse(str) && lp.getnumtokens() == 4) | ||
+ | { | ||
+ | RECT r; | ||
+ | r.left = lp.gettoken_int(0); | ||
+ | r.top = lp.gettoken_int(1); | ||
+ | r.right = lp.gettoken_int(0) + lp.gettoken_int(2); | ||
+ | r.bottom = lp.gettoken_int(1) + lp.gettoken_int(3); | ||
+ | EnsureNotCompletelyOffscreen(&r); | ||
+ | if (bRestoreSize) | ||
+ | SetWindowPos(hwnd, NULL, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOZORDER); | ||
+ | else | ||
+ | SetWindowPos(hwnd, NULL, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); | ||
+ | } | ||
+ | } | ||
</source> | </source> | ||
+ | |||
===Perl=== | ===Perl=== | ||
<source lang=perl> | <source lang=perl> |
Latest revision as of 22:14, 11 February 2010
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR EnsureNotCompletelyOffscreen
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR EnsureNotCompletelyOffscreen
Contents |
EnsureNotCompletelyOffscreen()
void EnsureNotCompletelyOffscreen(RECT* r)
Call with a saved window rect for your window and it'll correct any positioning info.
Parameters
RECT* r
Returns
Nothing
Examples
C++
void RestoreWindowPos(HWND hwnd, const char* cKey, bool bRestoreSize) { char str[256]; GetPrivateProfileString(SWS_INI, cKey, "unknown", str, 256,get_ini_file()); LineParser lp(false); if (!lp.parse(str) && lp.getnumtokens() == 4) { RECT r; r.left = lp.gettoken_int(0); r.top = lp.gettoken_int(1); r.right = lp.gettoken_int(0) + lp.gettoken_int(2); r.bottom = lp.gettoken_int(1) + lp.gettoken_int(3); EnsureNotCompletelyOffscreen(&r); if (bRestoreSize) SetWindowPos(hwnd, NULL, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOZORDER); else SetWindowPos(hwnd, NULL, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } }
Perl
Python
See Also
Screen Update Functions: UpdateTimeline UpdateItemInProject EnsureNotCompletelyOffscreen
Stuff
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR EnsureNotCompletelyOffscreen
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR EnsureNotCompletelyOffscreen