Dynamically set dialog box position/size w/WIN API

Code to adjust the position and, if you need, the size of the dialogbox using WIN API.

My client was having a problem with the position of the dialogbox (notesuiworkspace method). There was a field on the dialogbox (a dialogbox field). When the user clicked the "arrow" to bring up the dialogbox, half of the information was hidden because of the top of the screen. So here is some code to adjust the position and, if you need, the size of the dialogbox using WIN API.

 Declarations Section Of Form To Be Loaded In Dialogbox: Declare Function FindWindow Lib "user32" Alias "FindWindowA" (Byval lpClassName&, Byval lpWindowName$) As Long Declare Function SetWindowPos Lib "user32" (Byval hwnd As Long, Byval hWndInsertAfter As Long, Byval x As Long, Byval y As Long, Byval cx As Long,Byval cy As Long, Byval wFlags As Long) As Long Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Const SWP_NOSIZE = &H1 Const SWP_NOMOVE = &H2 Const SWP_NOACTIVATE = &H10 Const SWP_SHOWWINDOW = &H40 'PostRecalc of Dialogbox Form Sub Postrecalc(Source As Notesuidocument) Dim myhWnd% 'class name and title of dialog box 'Algorithm - Step 1 --> get window handle myhWnd = FindWindow(0, "Specify a Material Number and Batch Number") ' Parms 3 and 4 are x and y, ' Parms 5 and 6 are window width and height 'Parm 7 is constant Hex value for what you want to do with active window 'Algorithm - Step 2 --> Set window position by window handle SetWindowPos myhWnd, -1, 165, 15, 725, 300, SWP_SHOWWINDOW End Sub

Dig Deeper on Domino Resources - Part 4



  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...