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

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close