Das Notes Forum
Domino 9 und frühere Versionen => ND6: Administration & Userprobleme => Thema gestartet von: Alexis am 26.01.04 - 14:24:41
-
Hallo Forum,
kann man beeinflussen, dass ein Anhang z.B. ein Word-Dokument nicht im Hintergrung geöffnet wird (LN im Vordergrund) sondern direkt unter der Oberfläche von Word? Mit PDF klappt das ja automatisch, warum also nicht bei Word, Excel und Co.?
Alexis
-
wie sieht das denn bei dir aus? kannst du mal nen Screenshot posten?
Wie startest du dei Anhänge?
-
Hallo Thomas,
das Starten des Attachments geht simpel über Autolaunch "First Attachment in der betreffenden Form.
Nach einem Doppelklick auf ein Dokument in einer View geht Word auf, das Dokument wird geladen, anschließend verschwindet Word vom Vordergrund und LotusNotes kommt wieder in den Vordergrund mit besagter View.
In der Taskleiste von Windows ist Word natürlich zu sehen und kann auch von dort per Klick in den Vordergrund geholt werden. Aber das ist doch wohl nicht ganz im Sinne des Erfinders.
Alexis
-
Ahhh, jetzt verstehe ich.
Ich fürchte, da kann man nix machen, zumindest dann nicht, wenn du die Methode nicht verändern willst, wie das das Dokument geöffnet wird.
Alternativ könntest du die Anhänge per LotusScript starten. Dazu kannst du die Shell-Funktion verwenden. Dieser wiederum kannst du sagen, ob das geöffnete Fenster den Fokus haben soll, oder nicht.
Mehr dazu in der Designer Hilfe oder frag noch mal nach...
-
Hallo Thomas & Forum,
die Lösung mit der Shell-Funktion ist für mich Halblaien soweit ok, wie ich die URL ermitteln kann:
result = Shell("C:\Program Files\Microsoft Office\Office\EXCEL.EXE" + " " + "C:\Z4", 1)
Als Ersatz für "Autolaunch first Attachment" fehlt mir aber die Syntax der Shell. Zum Verständnis: Das File, das ich öffnen will, ist in einem RT-Feld der Form abgelgt und soll per Doppelklick in der View geöffnet werden.
Kann mir jemand auf die Sprünge helfen.
Alexis
-
Hallo Alexis,
habe im Moment das gleiche Problem - was mir nur nicht klar ist wieso Notes beim Öffnen des Anhangs über die Maskeigenschaft Auto-Start das PDF im Vordergrund öffnet und die Worddatei im Hintergrund.
Die Lösung über shell zu starten ist ja nicht gerade elegant, da dann Office immer im selben Verzeichnis installiert sein muss...
Gruss
Martin
-
Habe in Eknoris Schatzkiste folgendes Script gefunden was bei mir auch funktioniert (bzw. sich gleich verhält wie die Masken Eigenschaft).
Ich selber habe ja keine Ahnung von Script - vermutlich kann uns aber der Profis hier sagen wie man in das untenstehende Script den Focus auf Winword in den Vordergrund schaltet.
Gruss
Martin
PS: Eigentlich sind wir ja hier im falschen Forum - ist ja eigentlich Entwicklung...
GLOBAL DECLARATION
Declare Function ShellExecuteAny Lib "shell32.dll" Alias "ShellExecuteA" _
(Byval hwnd As Long, Byval lpOperation As String, Byval lpFile As String, _
Byval lpParameters As Any, Byval lpDirectory As Any, Byval nShowCmd As Long) _
As Long
Declare Function GetDesktopWindow& Lib "user32" ()
Const SW_SHOWNORMAL = 10
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Dim acl As NotesACL
Dim entry As NotesACLEntry
Dim session As New NotesSession
Dim db As NotesDatabase
Set uidoc = Source
Set db = session.CurrentDatabase
Set acl = db.ACL
Set entry = acl.GetEntry( session.CommonUserName )
If entry Is Nothing Then
Set entry = acl.GetEntry( session.UserName )
End If
If entry.IsRoleEnabled( "[Autover]" ) Then
If Source.InPreviewPane Or Source.EditMode Then Exit Sub
Dim Ret As Long
Set note = uidoc.DOcument
Set rtitem = note.getfirstItem( "Body" )
If rtitem Is Nothing Then
Exit Sub
End If
objarr = rtitem.EmbeddedObjects
tempdir = "c:\temp"
If Isarray(objarr) Then
Forall o In objarr
file = o.Source
o.ExtractFile( tempdir & "\" & file )
FileToOpen = tempdir & "\" & file
Ret = ShellExecuteAny(GetDesktopWindow, "open", FileToOpen, Byval 0&, Byval 0&, SW_SHOWNORMAL)
End Forall
End If
End If
End Sub
----------------------------
Und hier habe ich noch eine Beschreibung gefunden - wenn ich die richtig vestehe dann sollte es eigentlich funktionieren...
cr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Print", DocName, "", "", SW_SHOWNORMAL)
...
Scr_hDC = Handle für das Fenster
"Print" = die Anweisung, was zu tun ist (nämlich Drucken)... und ach was, schau dir mal den Auszug aus einer API Help an, was das im Einzelnen für Parameter sind...:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
· hwnd
Specifies a parent window. This window receives any message boxes that an application produces. For example, an application may report an error by producing a message box.
· lpOperation
Pointer to a null-terminated string that specifies the operation to perform. The following operation strings are valid:
“open”
The function opens the file specified by lpFile. The file can be an executable file or a document file. The file can be a folder to open.
“print”
The function prints the file specified by lpFile. The file should be a document file. If the file is an executable file, the function opens the file, as if “open” had been specified.
“explore”
The function explores the folder specified by lpFile.
The lpOperation parameter can be NULL. In that case, the function opens the file specified by lpFile.
· lpFile
Pointer to a null-terminated string that specifies the file to open or print or the folder to open or explore. The function can open an executable file or a document file. The function can print a document file.
· lpParameters
If lpFile specifies an executable file, lpParameters is a pointer to a null-terminated string that specifies parameters to be passed to the application.
If lpFile specifies a document file, lpParameters should be NULL.
· lpDirectory
Pointer to a null-terminated string that specifies the default directory.
· nShowCmd
If lpFile specifies an executable file, nShowCmd specifies how the application is to be shown when it is opened. This parameter can be one of the following values:
SW_HIDE
Hides the window and activates another window.
SW_MAXIMIZE
Maximizes the specified window.
SW_MINIMIZE
Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE
Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW
Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT
Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window.
SW_SHOWMAXIMIZED
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE
Displays the window as a minimized window. The active window remains active.
SW_SHOWNA
Displays the window in its current state. The active window remains active.
SW_SHOWNOACTIVATE
Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL
Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
If lpFile specifies a document file, nShowCmd should be zero
-
....und es geht doch - sogar über mehrere Wege:
Der einfachste ist es doch die Maskeneigenschaft Auto Launch (Auto-Start) zu verwenden und dann folgenden Code einzubauen:
----------------------------------------------------------------------------
....here's some code I found/put together to send an Alt+tab keyboard command to switch to the auto launched window.
DECLARTIONS
Declare Sub keybd_event Lib "user32.dll" (Byval bVk As Integer, Byval bScan As Integer, Byval dwFlags As Integer,Byval dwExtraInfo As Integer)
Const VK_LMENU = &hA4
Const VK_TAB = &h09
Declare Function GetActiveWindow Lib "user32" () As Long
Declare Function SetActiveWindow Lib "user32.dll" (Byval hwnd As Long) As Long
Dim nwin As Long
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
nwin = GetActiveWindow
End Sub
Sub Terminate
If GetActiveWindow = 0 Then
Call SetActiveWindow(nwin)
switchwindow
End If
End Sub
Sub switchwindow
key=VK_LMENU
keybd_event key,0,0,0
key=VK_TAB
keybd_event key,0,0,0
keybd_event key,0,2,0
key=VK_LMENU
keybd_event key,0,2,0
End Sub
------------------------------------
2. Möglichkeit:
Declarations:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (Byval hwnd As Long, Byval lpOperation As String, Byval lpFile As String, Byval lpParameters As String, Byval lpDirectory As String, Byval nShowCmd As Long) As Long
Declare Function GetActiveWindow Lib "user32" () As Long
Declare Function ShowWindow Lib "user32" (Byval hwnd As Long, Byval nCmdShow As Long) As Long
Const SW_MAXIMIZE = 3
Const SW_MINIMIZE = 6
Const SW_RESTORE = 9
Und dann im Code:
action = "open"
xFile := "C:\Temp\WordDoc.doc"
'- Notes- Fenster- Auslesen, bevor die Anwendung gestartet wird
wHandle = GetActiveWindow()
'- Anwendung starten
ok = ShellExecute( 0, action, xFile, 0 , 0 , 3 )
'- Notes- Fenster minimieren, damit die aufgerufene Applikation in den Vordergrund kommt
Call ShowWindow( wHandle , SW_MINIMIZE )
-
Hallo MartinG, hallo Forum!
ich verstehe zwar keine Zeile von dem Script, aber es klappt vorzüglich! Ich benutze übrigens die erste Variante.
Vielen Dank MartinG, super Zuarbeit!
Alexis