Optimize Notes startup for different screen resolutions

I was finding it difficult to optimize my corporate homepage for different screen resolutions, so I created four separate framesets, each optimized to a different resolution, from 640x480 to 1280x1024.

Here is how I determined the resolution. The user32 dynamic link library has accessor functions available that allow to you efficiently retrieve that information. By putting that functionality into the homepage's database script post-open event, I am able to determine the screen resolution of the PC each time it opens the database. I am writing that value to an environment variable. Each time I open the database, via the post-open event, I am testing whether the current resolution is changed from the last time that the environment variable was written. Every time someone opens this database, the current resolution is written to this environment variable.

I created another frameset as a host to one of the four framesets mentioned above, to be determined at runtime via a computed formula based upon the dynamic value representing the screen resolution. This host is a one-frame frameset, populated with the computed value listed below. This is the database's default frameset as defined within the database properties.

Database script code:

 Type RECT
 x1 As Long
 y1 As Long
 x2 As Long
 y2 As Long
End Type

Declare Function GetDesktopWindow Lib 
"User32" () As Long Declare Function 
GetWindowRect Lib "User32" (Byval 
hWnd As Long, rectangle As Rect) As Long

And within the PostOpen event:
Dim session As New NotesSession
currentRes = getResolution.FormLoad()
  tempRes = session .
  If (tempRes <> currentRes) And 
(tempRes <> "") Then
   Messagebox "Notes has detected a 
change in your screen 
resolution.  The next time you start the 
Corporate Intranet, the homepage will 
be adjusted to optimize your new resolution 
setting.", 0 + 64, "Screen 
Resolution Change" 
  Elseif tempRes = "" And currentRes 
<> "800x600" Then
   Messagebox "Your screen resolution 
has been detected 
as " & currentRes & ". Your intranet will
 be optimized for this display setting 
and will be used the next time that you login. 
 For this session, the default 
of 800x600 will be used.", 0 + 64,
 "Screen resolution settings" 
  Elseif  tempRes = "" And currentRes =
 "800x600" Then
   Messagebox "Your screen resolution
 has been detected 
as " & currentRes & ". This is the default 
resolution setting for the Corporate 
Intranet as well, therefore no changes 
need to be applied.", 0 + 64, "Screen 
resolution settings" 
  End If
  Call session.SetEnvironmentVar
( "currentRes", currentRes )   
Add this function:
Function FormLoad() As String
 Dim workspace As New NotesUIWorkspace
 Dim R As Rect
 Dim hWnd As Long
 Dim RetVal As Long
 Dim GetScreenResolution As String
 hWnd = GetDesktopWindow ()
 RetVal = GetWindowRect(hWnd, R)
 GetScreenResolution = (R.x2 - R.x1) 
& "x" & (R.y2 - R.y1)
 FormLoad = GetScreenResolution
End Function

Finally, the code that goes within the default frameset to determine which frameset to actually display (I have named the framesets with the resolution that they represent):

temp := @Environment("currentRes");
@If(temp = "640x480";"640x480";
@If(temp = "800x600";"800x600";@If(temp 
= "1024x768";"1024x768";@If(temp = 
= "1280x1024";"1280x1024";"800x600")))))

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Andrew Young. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

This was first published in October 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.