Lotus Domino R5 C Builder 6 Таблица цветов О фреймах

Здесь собраны различные скрипты для Lotus Domino R5, которыми мне приходилось пользоваться на практике, с использованием Notes API, Win API, и просто на LS.

Содержание:
1. Создание реплики из копии базы.
2. Получение в виде элементов дизайна.
3. Вскрытие дизайна.
4. Удаление документов без окурков.
5. Удаление "окурков".
6. Спрятать /Показать кнопку "Пуск" в Windows.
7. Еще один диалог выбора файлов.
8. Програмно выдавать команду на консоль сервера.
9. Копировать роли из ACL указанной в диалоге базы, в текущую базу.
10. Выгрузка ACL в текстовый файл.
11. Копировать всю ACL из текущей базы в указанную в диалоге.
12. Смерть ошибкам сохранений при одновременном редактировании документа.
13. Диалог выбора папок/файлов.
14. Переключение раскладки клавиатуры.

Lotus Domino R5.
Приведенный ниже скрипт делает реплику из копии базы.


Dim session As New NotesSession
Dim db As NotesDatabase
Dim dest As NotesDatabase
Set db = New NotesDatabase( "","c:\lotus\notes\data\proba1.ntf" )
Set dest =New NotesDatabase( "","c:\lotus\notes\data\proba2.ntf" )
Call SwitchReplID(db.server,db.filepath,"",dest.Filepath)

Данный скрипт можно вставить в действие какого-либо вида, при этом в Declarations необходимо прописать следующее:

%INCLUDE "switchRepl.lss"

Файл switchRepl можно скачать здесь , после распаковки, вставить в лотусовый рабочий каталог.

Вернуться к содержанию


Lotus Domino R5.
Скрипт, позволяющий получить в виде элементы дизайна.

Sub Click(Source As Button)
Dim view As NotesView
Dim note As NotesDocument
Dim count As Integer
Dim results() As Variant
Dim db As NotesDatabase
Dim session As New NotesSession
Set db = session.CurrentDatabase
Set tempView = db.views(0)
Set designViewTemplateNote = db.getDocumentByUnid( tempView.universalID)
Set designViewNote = designViewTemplateNote.copyToDatabase(db)
designViewNote.replaceItemValue "$FormulaClass", Cstr("Ваше значение")
designViewNote.save True, True
End Sub


Данный скрипт можно вставить в действие какого-либо вида.
В строке designViewNote.replaceItemValue "$FormulaClass", Cstr("Ваше значение") в место слов "Ваше значение" необходимо вставит одно из значений приведенных в таблице:

Значение
Отображение
1
Документы
2
Документ "О базе данных"
4
Формы и субформы
8
Общие виды, общие папки, навигаторы
16
Иконки
64
ACL
256
Документ "Работа с базой данных"
512
Библиотека скриптов, общая программа БД, общие агенты
1024
Общие поля
4096
Личные виды, личные папки, личные агенты

Вернуться к содержанию


Lotus Domino R5.
Change address 000000BC from the hexadecimal code 20 to 00.



Здесь можно скачать HIEW, - програмку просмотра, затем кидаеш иконку базы на exe-шник и меняеш.

Вернуться к содержанию


Lotus Domino R5.
Удаление документов без окурков.


Declare Function W32_NSFNoteDelete Lib "nnotes.dll" Alias "NSFNoteDelete" _
( Byval hDb As Long, Byval NoteID As Long, Byval UpdateFlags As Integer ) As Integer
Declare Sub W32_OSPathNetConstruct Lib "nnotes.dll"
Alias "OSPathNetConstruct" _
(Byval portName As String, Byval ServerName As String, Byval FileName As String, Byval retPathName As String)
Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval dbName As String, hdb As Long ) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval hdb As Long ) As Integer

Sub Initialize
'######### NOTES STANDARD DEFINITIONS #############
Dim ses As New notessession ' one and only session
Dim ndb As notesdatabase ' current DB
Dim doc As notesdocument ' current document being processed:
Set ndb=ses.CurrentDatabase
Set doc = ndb.Unprocesseddocuments.getFirstDocument

Const MAXPATH=256
Const UPDATE_NOSTUB = &h0200
Dim path As String, noteid As Long, dbPath As String*MAXPATH, hdb As Long
dbPath = String$(MAXPATH, Chr(0))
noteID = Val("&h" &doc.Noteid)

W32_OSPathNetConstruct "",ndb.Server, ndb.FilePath, dbPath
W32_NSFDbOpen dbPath, hdb
If hdb=0 Then Exit Sub
Print "deleting... note= " ¬eid
W32_NSFNoteDelete hDb, noteid, UPDATE_NOSTUB
W32_NSFDbClose hdb

End Sub

Вернуться к содержанию


Lotus Domino R5.
Удаление "окурков" (deletion stubs) из текущей базы.


' (Declarations)
' --- custom user-defined type for storing deletion stub information
Type DELETION_STUB
NoteID As String
NoteClass As String
DBID As String
End Type
' --- Notes C API declares and constants (translated from the header files)
Type TIMEDATE
Innards(1) As Long
End Type

Type OID
FileDBID As TIMEDATE
Note As TIMEDATE
Sequence As Long
SequenceTime As TIMEDATE
End Type

Declare Sub W32OSPathNetConstruct Lib "nnotes" Alias "OSPathNetConstruct" ( _
Byval portName As Lmbcs String, _
Byval ServerName As Lmbcs String, _
Byval FileName As String, _
Byval retPathName As String _
)

Declare Function W32NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" ( _
Byval PathName As Lmbcs String, _
rethDb As Long _
) As Integer
Declare Function W32NSFDbClose Lib "nnotes" Alias "NSFDbClose" ( _
Byval hDb As Long _
) As Integer
Declare Sub W32TimeConstant Lib "nnotes" Alias "TimeConstant" ( _
Byval TimeConstantType As Integer, _
td As TIMEDATE _
)

Declare Function W32NSFDbGetModifiedNoteTable Lib "nnotes" Alias "NSFDbGetModifiedNoteTable" ( _
Byval hDb As Long, _
Byval NoteClassMask As Integer, _
Byval Innards1 As Long, _
Byval Innards2 As Long, _
retUntil As TIMEDATE, _
rethTable As Long _
) As Integer

Declare Function W32IDEntries Lib "nnotes" Alias "IDEntries" ( _
Byval hTable As Long _
) As Long

Declare Function W32IDScan Lib "nnotes" Alias "IDScan" ( _
Byval hTable As Long, _
Byval fFirst As Integer, _
retID As Long _
) As Integer

Declare Function W32IDDestroyTable Lib "nnotes" Alias "IDDestroyTable" ( _
Byval hTable As Long _
) As Integer

Declare Function W32OSLoadString Lib "nnotes" Alias "OSLoadString" (Byval hModule As Long, _
Byval StringCode As Integer, _
Byval retBuffer As Lmbcs String, _
Byval BufferLength As Integer _
) As Integer

Declare Function W32NSFDbGetNoteInfo Lib "nnotes" Alias "NSFDbGetNoteInfo" ( _
Byval hDb As Long, _
Byval NoteID As Long, _
retNoteOID As OID, _
retModified As TIMEDATE, _
retNoteClass As Integer _
) As Integer

Const NOERROR = 0
Const NULLHANDLE = 0&
Const MAXPATH = 256
Const TIMEDATE_WILDCARD = 2
Const NOTE_CLASS_ALL = &H7fff
Const RRV_DELETED = &H80000000&
Const PKG_NSF = &H200
Const ERR_NOTE_DELETED = PKG_NSF + 37

' --- note classifications
Const NOTE_CLASS_DOCUMENT = &H0001
Const NOTE_CLASS_INFO = &H0002
Const NOTE_CLASS_FORM = &H0004
Const NOTE_CLASS_VIEW = &H0008
Const NOTE_CLASS_ICON = &H0010
Const NOTE_CLASS_DESIGN = &H0020
Const NOTE_CLASS_ACL = &H0040
Const NOTE_CLASS_HELP_INDEX = &H0080
Const NOTE_CLASS_HELP = &H0100
Const NOTE_CLASS_FILTER = &H0200
Const NOTE_CLASS_FIELD = &H0400
Const NOTE_CLASS_REPLFORMULA = &H0800
Const NOTE_CLASS_PRIVATE = &H1000


Declare Function W32_NSFNoteDelete Lib "nnotes.dll" Alias "NSFNoteDelete" _
( Byval hDb As Long, Byval NoteID As Long, Byval UpdateFlags As Integer ) As Integer
Declare Sub W32_OSPathNetConstruct Lib "nnotes.dll" Alias "OSPathNetConstruct" _
(Byval portName As String, Byval ServerName As String, Byval FileName As String, Byval retPathName As String)
Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval dbName As String, hdb As Long ) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval hdb As Long ) As Integer

Sub Click(Source As Button)
Dim s As New NotesSession
Dim sPath As String
Dim hDb As Long
Dim iStatus As Integer
Dim stubs() As DELETION_STUB
' --- build an API-friendly path to the current database (i.e., !!)
sPath = String$( MAXPATH, 0 )
W32OSPathNetConstruct "", s.CurrentDatabase.Server, s.CurrentDatabase.FilePath, sPath
sPath = Left$( sPath, Instr(1, sPath, Chr$(0)) - 1 )
' --- open the database
iStatus = W32NSFDbOpen( sPath, hDb )
If iStatus <> NOERROR Then
' --- display any errors returned from C API call
Msgbox GetCAPIErrorMsg( iStatus ), 48, "Notes C API Error"
Else
' --- generate an array of deletion stubs
DumpDeletionStubs hDb, stubs
' --- close the database
Dim ses As New notessession ' one and only session
Dim ndb As notesdatabase ' current DB
Dim doc As notesdocument ' current document being processed:
Set ndb=ses.CurrentDatabase
Const UPDATE_NOSTUB = &h0200
dbPath = String$(MAXPATH, Chr(0))
W32NSFDbClose hDb
' --- print out all the stubs to the status bar
Forall note In stubs
noteID = Val("&h" &note.Noteid)
W32_OSPathNetConstruct "",ndb.Server, ndb.FilePath, dbPath
W32_NSFDbOpen dbPath, hdb
If hdb=0 Then Exit Sub
W32_NSFNoteDelete hDb, noteid, UPDATE_NOSTUB
W32_NSFDbClose hdb
Print "Deletion stub found: Note ID = " + note.NoteID + ", Note class = " + note.NoteClass
End Forall
End If
End Sub

Sub DumpDeletionStubs( hDb As Long, stubs() As DELETION_STUB )
%REM
DumpDeletionStubs - This Sub takes a C API handle to a database and dynamically builds an array of DELETION_STUB
types containing information about all the deletion stubs in the database.
%END REM
Dim hTable As Long, NoteID As Long, DeletedNoteID As Long, ct As Long
Dim iStatus As Integer, bFlag As Integer, iNoteClass As Integer
Dim tdStart As TIMEDATE, tdEnd As TIMEDATE, tdModified As TIMEDATE
Dim NoteOID As OID
' --- get all notes modified since the database was created (including deletion stubs)
W32TimeConstant TIMEDATE_WILDCARD, tdStart
' --- get an ID table of all the notes in the database
iStatus = W32NSFDbGetModifiedNoteTable( hDb, NOTE_CLASS_ALL, tdStart.Innards(0), tdStart.Innards(1), tdEnd, hTable )
If iStatus <> NOERROR Then
Msgbox GetCAPIErrorMsg( iStatus ), 48, "Notes C API Error"
Else
ct = 0
bFlag = True
' --- scan all notes in the ID table
Do While W32IDScan( hTable, bFlag, NoteID )
' --- test for deleted flag bit
If ( NoteID And RRV_DELETED ) Then
' --- clear flag bit so we won't get an error indicating an invalid note
DeletedNoteID = NoteID And ( Not RRV_DELETED )
' --- get the information we need about the note
iStatus = W32NSFDbGetNoteInfo( hDb, DeletedNoteID, NoteOID, tdModified, iNoteClass )
' --- check to see that this note is in fact a deletion stub
If iStatus = ERR_NOTE_DELETED Then
' populate the array of DELETION_STUBs
Redim Preserve stubs( ct )
stubs( ct ).NoteID = Hex$( DeletedNoteID )
stubs( ct ).DBID = Hex$( NoteOID.FileDBID.Innards(1) ) + ":" + Hex$( NoteOID.FileDBID.Innards(0) )
stubs( ct ).NoteClass = GetNoteClass( iNoteClass )
ct = ct + 1
Elseif iStatus <> NOERROR Then
' --- print out any errors that may occur while we're scanning the ID table
Print GetCAPIErrorMsg( iStatus ) + " (" + Hex$( DeletedNoteID ) + ")"
End If
End If
' --- tell W32IDScan we're not looking for the first note any longer
bFlag = False
Loop
' --- free the ID table from memory
W32IDDestroyTable hTable
End If
End Sub

Function GetCAPIErrorMsg( iStatus As Integer ) As String
%REM
GetCAPIErrorMsg - This function takes a status code returned from a C API call, retrieves the corresponding
error message from Notes' internal string tables, and returns the string to the caller.
%END REM
Dim iLen As Integer
Dim sBuffer As String
' --- initialize a buffer of adequate length to accept the error string
sBuffer = String$( 256, 0 )
' --- get the API error message from the internal Notes/Domino string tables
iLen = W32OSLoadString( NULLHANDLE, iStatus, sBuffer, Len( sBuffer ) - 1 )
If iLen > 0 Then
' --- remove any trailing characters from the string and return it to the caller
GetCAPIErrorMsg = Left$( sBuffer, Instr( 1, sBuffer, Chr$(0) ) - 1 )
Else
' --- couldn't locate the error message in the string tables
GetCAPIErrorMsg = "Unknown error"
End If
End Function

Function GetNoteClass( iNoteClass As Integer ) As String
%REM
GetNoteClass - This function takes a note type and returns a text string representing the note class type to the caller.
%END REM
Dim sNoteType As String
Select Case iNoteClass
Case NOTE_CLASS_DOCUMENT
sNoteType = "Document"
Case NOTE_CLASS_INFO
sNoteType = "Help-about"
Case NOTE_CLASS_FORM
sNoteType = "Form"
Case NOTE_CLASS_VIEW
sNoteType = "View"
Case NOTE_CLASS_ICON
sNoteType = "Icon"
Case NOTE_CLASS_DESIGN
sNoteType = "Design collection"
Case NOTE_CLASS_ACL
sNoteType = "ACL"
Case NOTE_CLASS_HELP_INDEX
sNoteType = "Help index"
Case NOTE_CLASS_HELP
sNoteType = "Help-using"
Case NOTE_CLASS_FILTER
sNoteType = "Filter"
Case NOTE_CLASS_FIELD
sNoteType = "Field"
Case NOTE_CLASS_REPLFORMULA
sNoteType = "Replication formula"
Case NOTE_CLASS_PRIVATE
sNoteType = "Private design"
Case Else
sNoteType = "Unknown"
End Select
GetNoteClass = sNoteType
End Function

Вернуться к содержанию


Lotus Domino R5.
Спрятать/Показать кнопку "Пуск" в Windows

Declare Function ShowWindow Lib "user32" (Byval hwnd As Long, Byval nCmdShow As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (Byval lpClassName As String, Byval lpWindowName As String) As Long
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (Byval hWnd1 As Long, Byval hWnd2 As Long, Byval lpsz1 As String, Byval lpsz2 As String) As Long

Sub Command1_Click()
'спрятать кнопку "Пуск"
OurParent& = FindWindow("Shell_TrayWnd", "")
OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)
ShowWindow OurHandle&, 0
End Sub

Sub Command2_Click()
'показать кнопку "Пуск"
OurParent& = FindWindow("Shell_TrayWnd", "")
OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)
ShowWindow OurHandle&, 5
End Sub

Вернуться к содержанию


Lotus Domino R5.
Еще один диалог выбора файлов

Declare Function NEMGetFileWin32 Lib "nnotesws" Alias "NEMGetFile" ( wUnk As Integer, Byval szFileName As Lmbcs String, Byval szFilter As Lmbcs String, Byval szTitle As Lmbcs String ) As Integer 

Sub Click(Source As Button)
Dim cs As New NotesSession
Dim Platform$
Platform$ = cs.Platform
Dim szFileName As String*256
Dim szTitle As String
Dim szFilter As String
szFilename = Chr(0)
szTitle = "Выбор файла"
szFilter = "Notes Databases|*.NSF|" & _
"Notes Templates|*.NTF|" & _
"Программы|*.EXE|" & _
"Text Files|*.TXT|" & _
"Все файлы|*.*|" 'Use this format for ANY file type
Print Platform$
GetFile% = NEMGetFileWin32( 0, szFileName, szFilter, szTitle)
If GetFile% <> 0 Then
Messagebox szFileName
End If
End Sub

Вернуться к содержанию


Lotus Domino R5.
Програмно выдавать команду на консоль сервера

Declare Sub OSMemFree Lib "nnotes.dll" (Byval hBuffer As Long)
'return string instead of long for LS type checking
Declare Function OSLockObject Lib "nnotes.dll" (Byval hBuffer As Long) As String
Declare Sub OSUnlockObject Lib "nnotes.dll" (Byval hBuffer As Long)
Declare Function NSFRemoteConsole Lib "nnotes.dll" (Byval ServerName As String, Byval ConsoleCommand As String, rethBuffer As Long) As Long

Sub Initialize
Dim hBuf As Long
Dim pBuf As String
Dim result As Long
Dim data As Variant
result = NSFRemoteConsole("Имя сервера","строка команды", hBuf)
pBuf = OSLockObject(hBuf)
print pBuf ' Выводит результат команды
Call OSUnlockObject(hBuf)
Call OSMemFree(hBuf)
End Sub

Вернуться к содержанию


Lotus Domino R5.
Копировать роли из ACL указанной в диалоге базы, в текущую базу.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
ser=Inputbox$("Введите имя сервера")
dbs=Inputbox$("Введите имя базы")
Set db = New NotesDatabase( ser, dbs )
If db.Title="" Then
ak=Msgbox( "Не найдена база, повторите попытку!", ,"Внимание")
Exit Sub
End If
Set db1 = session.CurrentDatabase
Set acl = db.ACL
Set acl1 = db1.ACL
Forall r In acl.Roles
per1=Msgbox( "Добавить роль - "+Cstr(r) +" - в текущую базу?",1, "Внимание")
If per1=1 Then
Call acl1.AddRole( r )
End If
End Forall
Call acl1.Save

Вернуться к содержанию


Lotus Domino R5.
Выгрузка ACL в текстовый файл.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim parentACL As NotesACL
Dim entry As NotesACLEntry
Dim mas(5)
Dim mas1(6)
mas(0)="UNSPECIFIED"
mas(1)="PERSON"
mas(2)="SERVER"
mas(3)="MIXED_GROUP"
mas(4)="PERSON_GROUP"
mas(5)="SERVER_GROUP"

mas1(0)="NOACCESS"
mas1(1)="DEPOSITOR"
mas1(2)="READER"
mas1(3)="AUTHOR"
mas1(4)="EDITOR"
mas1(5)="DESIGNER"
mas1(6)="MANAGER"
Stop
Set db = session.CurrentDatabase
Set acl = db.ACL
Set entry = acl.GetFirstEntry
fileNum% = Freefile()
fileName$ = "c:\acl.txt"
Open fileName$ For Output As fileNum%
While Not ( entry Is Nothing )
per=entry.Name
per3=entry.Level
per4=entry.UserType
Set notesName = New NotesName( per )
per=notesName.Abbreviated
per1=entry.Roles
per2=""
For r=0 To Ubound(per1)
per2=per2+"-"+per1(r)
Next
Write #fileNum%, Cstr(per)+" *{"+mas(per4)+"}*"+" *{"+mas1(per3)+"}
* "+per2
Set entry = acl.GetNextEntry( entry )
Wend
Close fileNum%

Вернуться к содержанию


Lotus Domino R5.
Копировать всю ACL из текущей базы в указанную в диалоге.

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim entry As NotesACLEntry
ser=Inputbox$("Введите имя сервера")
dbs=Inputbox$("Введите имя базы")
Set db = New NotesDatabase( ser, dbs )
If db.Title="" Then
ak=Msgbox( "Не найдена база, повторите попытку!", ,"Внимание")
Exit Sub
End If
Set db1 = session.CurrentDatabase
Set acl = db.ACL
Set acl1 = db1.ACL
Forall r In acl1.Roles
fl="0"
Forall r2 In acl.Roles
If r2=r Then
fl="1"
End If

End Forall
If fl<>"1" Then
Call acl.AddRole( r )
End If
End Forall
Call acl.Save
Dim mas(5)
Dim mas1(6)
mas(0)="UNSPECIFIED"
mas(1)="PERSON"
mas(2)="SERVER"
mas(3)="MIXED_GROUP"
mas(4)="PERSON_GROUP"
mas(5)="SERVER_GROUP"

mas1(0)="NOACCESS"
mas1(1)="DEPOSITOR"
mas1(2)="READER"
mas1(3)="AUTHOR"
mas1(4)="EDITOR"
mas1(5)="DESIGNER"
mas1(6)="MANAGER"

Set entry = acl1.GetFirstEntry
While Not ( entry Is Nothing )
per=entry.Name
Set notesName = New NotesName( per )
per=notesName.Abbreviated
Set entry1 = acl.GetEntry( per )
If entry1 Is Nothing Then
Set entry1= acl.CreateACLEntry ( per, entry.Level )
End If
entry1.Level =entry.Level
entry1.UserType = entry.UserType
per1=entry.Roles
If per1(0)<>"" Then
For r1=0 To Ubound(per1)
Call entry1.EnableRole( per1(r1) )
Next
End If
entry1.CanCreateDocuments = entry.CanCreateDocuments
entry1.CanDeleteDocuments =entry.CanDeleteDocuments
entry1.CanCreateLSOrJavaAgent=entry.CanCreateLSOrJavaAgent
entry1.CanCreatePersonalAgent =entry.CanCreatePersonalAgent
entry1.CanCreatePersonalFolder =entry.CanCreatePersonalFolder
entry1.CanCreateSharedFolder =entry.CanCreateSharedFolder
entry1.CanReplicateOrCopyDocuments =entry.CanReplicateOrCopyDocuments
entry1.IsPublicWriter=entry.IsPublicWriter
entry1.IsPublicReader=entry.IsPublicReader
Call acl.Save
Set entry = acl1.GetNextEntry( entry )

Wend
End Sub

Вернуться к содержанию


Lotus Domino R5.
Смерть ошибкам сохранений при одновременном редактировании документа.

Данный скрипт запрещает пользователю сохранить документ, если другой пользователь одновременно с первым редактировал документ и сохранил его.
В принципе если доработать скрипт, то можно не запрещать сохранение, а объединять изменения двух одновременных редакций, без ошибок сохранений.

(Declaration)
Dim Gper

Sub Postopen(Source As Notesuidocument)
Gper="0"
End Sub

Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument, doc1 As NotesDocument
Dim db As NotesDatabase
Dim unid As String
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Unid = doc.UniversalID
Set db = doc.ParentDatabase
mas=doc.GetItemValue("$Revisions")
per=mas(Ubound(mas))
Delete doc
Set doc1 = db.GetDocumentByUNID( Unid )
mas1=doc1.GetItemValue("$Revisions")
per1=mas1(Ubound(mas1))
If per<>per1 And Gper="0" Then
mes="Во время редактирования документ был пересохранен другим
пользователем"+Chr(13)+"Необходимо выйти из документа без сохранения, и повторно
отредактировать документ"
ss=Messagebox( mes,0,"Внимание")
Continue=False
Exit Sub
End If
Gper="1"
End Sub

Вернуться к содержанию


Lotus Domino R5.
Диалог выбора папок/файлов.

Еще один стандартный диалог выбора папок, файлов.

(Declaration)
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Const BIF_RETURNONLYFSDIRS = &H1
Const BIF_BROWSEINCLUDEFILES = &H1 Or &H4000
Const BIF_BROWSEFORCOMPUTER = &H1000
Const BIF_BROWSEFORPRINTER = &H2000
Const MAX_PATH = 260
Declare Sub CoTaskMemFree Lib "ole32.dll" (Byval hMem As Long)
Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (Byval lpString1 As String,
Byval lpString2 As String) As Long
Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Declare Function SHGetPathFromIDList Lib "shell32" (Byval pidList As Long, Byval
lpBuffer As String) As Long

Function fBrowseForFolder(hWndOwner As Long, sPrompt As String, WhatBr) As String
Dim iNull As Integer
Dim lpIDList As Long
Dim lResult As Long
Dim sPath As String
Dim udtBI As BrowseInfo
udtBI.hWndOwner = hWndOwner
udtBI.lpszTitle = lstrcat(sPrompt, "Выберите папку")
udtBI.ulFlags = WhatBr
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath =String$(MAX_PATH, 0)
lResult = SHGetPathFromIDList(lpIDList, sPath)
Call CoTaskMemFree(lpIDList)
iNull = Instr(sPath, Chr(0))
If iNull Then sPath = Left$(sPath, iNull - 1)
End If
fBrowseForFolder = sPath
End Function

Sub Click(Source As Button)
Dim hWnd As Long
'вместо входящего параметра BIF_RETURNONLYFSDIRS можно использовать одну из
'BIF-констант, описанных в Declarations)
path = fBrowseForFolder(hWnd, "", BIF_RETURNONLYFSDIRS)
End Sub

Вернуться к содержанию


Lotus Domino R5.
Переключение раскладки клавиатуры.

Скрипт можно вставить как в кнопку, так и в событие формы или базы.

(Declaration)
Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" (Byval pwszKLID As String, Byval flags As Long) As Integer
Private Const KLF_ACTIVATE = 1

Sub Click(Source As Button)
SetLanguage ("R")
' SetLanguage ("E")
End Sub

Sub SetLanguage(Byval s As String)
Select Case Ucase(Left(s, 1))
Case "R"
LoadKeyboardLayout "00000419", KLF_ACTIVATE
Case "U"
LoadKeyboardLayout "00000422", KLF_ACTIVATE
Case "E"
LoadKeyboardLayout "00000409", KLF_ACTIVATE
Case Else
End Select
End Sub

Вернуться к содержанию



Главная
Фотоальбом
Юмор
Раскрутка
Гостевая
Форум