Don't Forget You Can Cross Compile

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"

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

(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 first published in November 2000

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.