Manage Learn to apply best practices and optimize your operations.

Don't Forget You Can Cross Compile

Don't forget you can get code that you have written in Visual Basic and compile
it in Lotus Notes. In 95 % of case this works just fine.. Lotusscript does not
support the byte or Boolean data types but in most case you can substitute
string and integer types .. So if you are really stuck on something that you
are pretty sure you can do with windows/OLE or DDE or ODBC but can't find any
"good" code to help you don't forget to check out the VB web sites , There is
heaps of them around... Heres an example of some winapi code I wrote in Visual
basic , that cross compiles with Lotusscript perfectlly...
' This code emulates the task list on a windows 95/98 machine , the list that
appears
'when you press CTRL+ALT+DEL.. It even tells you if an application is not
'responding. ( Works in Win95/98 ).. And Additionally list the handle to the
window.

' Put this code in the declarations of a button

Const WM_CLOSE = &H10
Const GW_CHILD = 5
Const GW_HWNDNEXT = 2
Const GWL_STYLE = (-16)
Const GW_OWNER = 4
Const WS_POPUP = &H80000000
Const WS_SYSMENU = &H80000
Const WS_BORDER = &H800000
Const WS_POPUPWINDOW = (WS_POPUP Or WS_BORDER Or WS_SYSMENU)
Const WS_VISIBLE = &H10000000
Const WM_NULL = &H0
Const SMTO_ABORTIFHUNG = &H2

Declare Function CloseHandle Lib "kernel32" (Byval hObject As Long) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (Byval hwnd As Long,
lpdwProcessId As Long) As Long
Declare Function IsWindowVisible Lib "user32" (Byval hwnd As Long) As Long
Declare Function GetParent Lib "user32" (Byval hwnd As Long) As Long
Declare Function GetWindow Lib "user32" (Byval hwnd As Long, _
Byval wCmd As Long) As Long
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(Byval hwnd As Long, Byval lpString As String, Byval cch As Long) _
As Long
Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (Byval uAction As Long, Byval uParam As Long, Byval
lpvParam As Any, Byval fuWinIni As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(Byval hwnd As Long, Byval nIndex As Long) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (Byval hwnd As
Long, Byval wMsg As Long, Byval wParam As Long, lParam As Long) As Long
Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA"
(Byval hwnd As Long, Byval msg As Long, Byval wParam As Long, Byval lParam As
Long, Byval fuFlags As Long, Byval uTimeout As Long, lpdwResult As Long) As Long
Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA"
(Byval hwnd As Long, Byval msg As Long, Byval wParam As Long, Byval lParam As
Long) As Long


'Put this code in the click event of a button...


Dim sTitle As String, hwnd As Long
Dim NameLength As Long
Dim WindowName As String
Dim ReturnString As String
Dim i As Integer
Dim Color As String
Dim dwResult As Long
Dim fResponding As Long
Dim Message As String

i = 1

' Get first top-level window
hwnd = GetWindow(GetDesktopWindow(), GW_CHILD)

ReturnString = ""
Do While hwnd <> 0

WindowName = Space(255)
NameLength = GetWindowText(hwnd, WindowName, 255)
sTitle = Left(WindowName, NameLength)

If Trim(sTitle) <> "" And IsWindowVisible(hwnd) And GetWindow(hwnd,
GW_OWNER) = 0 Then

' Check if this windows controlling thread is responding
fResponding = SendMessageTimeout(hwnd, WM_NULL, 0, 0,
SMTO_ABORTIFHUNG, 5000, dwResult)
If fResponding = 0 Then
Message = " - [ Not Responding ]"
Else
Message = ""
End If

ReturnString = ReturnString + sTitle + Message + " - handle " +
Cstr(hwnd) + Chr(10)
i = i + 1
End If ' Get next child

hwnd = GetWindow(hwnd, GW_HWNDNEXT)
Loop

Msgbox ReturnString

This was last published in November 2000

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • 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 ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close