Initial commit
This commit is contained in:
BIN
WordTest/.vs/WordTest/v16/.suo
Normal file
BIN
WordTest/.vs/WordTest/v16/.suo
Normal file
Binary file not shown.
25
WordTest/WordTest.sln
Normal file
25
WordTest/WordTest.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30309.148
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WordTest", "WordTest\WordTest.vbproj", "{B53C02F6-389A-4E81-89C2-766AADBC861D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B53C02F6-389A-4E81-89C2-766AADBC861D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B53C02F6-389A-4E81-89C2-766AADBC861D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B53C02F6-389A-4E81-89C2-766AADBC861D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B53C02F6-389A-4E81-89C2-766AADBC861D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {44CBA83D-4ADA-4CF3-874B-FAEBC9EE5715}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
30
WordTest/WordTest/App.config
Normal file
30
WordTest/WordTest/App.config
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="WordTest.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<WordTest.My.MySettings>
|
||||
<setting name="Dokumentname" serializeAs="String">
|
||||
<value>h:\tssettings\edoka\dokument_%.docx</value>
|
||||
</setting>
|
||||
<setting name="Vorlage" serializeAs="String">
|
||||
<value>h:\tssettings\office\ts\test_vorlage.docx</value>
|
||||
</setting>
|
||||
<setting name="AddinFile" serializeAs="String">
|
||||
<value>h:\tssettings\office\ts\tkbmakros.dotm</value>
|
||||
</setting>
|
||||
<setting name="WordStartDelay" serializeAs="String">
|
||||
<value>400</value>
|
||||
</setting>
|
||||
<setting name="WordMenu" serializeAs="String">
|
||||
<value>h:\tssettings\office\ts\menu\edoka_1.dotm</value>
|
||||
</setting>
|
||||
</WordTest.My.MySettings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
474
WordTest/WordTest/ApplicationFileWatcher.vb
Normal file
474
WordTest/WordTest/ApplicationFileWatcher.vb
Normal file
@@ -0,0 +1,474 @@
|
||||
Imports System
|
||||
Imports System.Text
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Threading
|
||||
Imports System.IO
|
||||
|
||||
Public Class ApplicationFileWatcher
|
||||
|
||||
#Region "Deklarationen"
|
||||
Private m_isActive As Boolean
|
||||
Public Event DocumentClosed()
|
||||
|
||||
Private m_Filename As String
|
||||
Property Filename() As String
|
||||
Get
|
||||
Return m_Filename
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_Filename = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ApplicationType As Integer
|
||||
Property ApplicationType()
|
||||
Get
|
||||
Return m_ApplicationType
|
||||
End Get
|
||||
Set(ByVal Value)
|
||||
m_ApplicationType = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Applicationname As String
|
||||
Property Appname() As String
|
||||
Get
|
||||
Return m_Applicationname
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_Applicationname = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_WindowNameDC As String
|
||||
Property WindowNameDC() As String
|
||||
Get
|
||||
Return m_WindowNameDC
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_WindowNameDC = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private m_WindowName As String
|
||||
Property WindowName() As String
|
||||
Get
|
||||
Return m_WindowName
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_WindowName = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'Rel. Office 2010
|
||||
Private m_WindowNameKomp As String
|
||||
Property WindowNameKompatibilitaet() As String
|
||||
Get
|
||||
Return m_WindowNameKomp
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
m_WindowNameKomp = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_WindowNamePreview As String
|
||||
Property WindowNamePreview() As String
|
||||
Get
|
||||
Return m_WindowNamePreview
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_WindowNamePreview = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Const STRING_BUFFER_LENGTH As Integer = 255
|
||||
Dim WindowArray As New ArrayList()
|
||||
Dim WithEvents MyTimer As New System.Timers.Timer(1000)
|
||||
|
||||
Dim Office2016Names As New List(Of String)
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Öffentliche Methoden"
|
||||
Public Sub New()
|
||||
End Sub
|
||||
|
||||
Public Sub New(ByVal typ As Integer, ByVal DocFileName As String)
|
||||
MyBase.new()
|
||||
End Sub
|
||||
|
||||
Public Sub Dispose()
|
||||
Me.WindowArray = Nothing
|
||||
End Sub
|
||||
|
||||
Public Sub Start()
|
||||
AddHandler MyTimer.Elapsed, AddressOf TimerFired
|
||||
SetWindowName()
|
||||
MyTimer.Start()
|
||||
End Sub
|
||||
|
||||
Public Sub Stopp()
|
||||
Me.MyTimer.Stop()
|
||||
End Sub
|
||||
|
||||
Public Sub BringWindowToTop()
|
||||
Dim i As Integer
|
||||
SetWindowName()
|
||||
i = Win32API.FindWindow(vbNullString, Me.WindowName)
|
||||
|
||||
If i <> 0 Then
|
||||
i = Win32API.SetForegroundWindow(i)
|
||||
i = Win32API.ShowWindow(i, Win32API.SW_RESTORE)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function doc_is_active() As Boolean
|
||||
'Dim I As Integer
|
||||
'Search_List()
|
||||
'For I = 0 To Me.WindowArray.Count - 1
|
||||
' If Me.WindowArray.Item(I) = Me.WindowName Then doc_is_active = True
|
||||
'Next
|
||||
Dim I As Integer
|
||||
Me.WindowArray.Clear()
|
||||
Search_List()
|
||||
If Globals.UseOffice2016 = False Then
|
||||
For I = 0 To Me.WindowArray.Count - 1
|
||||
If Me.WindowArray.Item(I) = Me.WindowName Then doc_is_active = True
|
||||
Next
|
||||
End If
|
||||
If Globals.UseOffice2016 = True Then
|
||||
For I = 0 To Me.WindowArray.Count - 1
|
||||
For x As Integer = 0 To Me.Office2016Names.Count - 1
|
||||
If Me.WindowArray.Item(I).ToString <> "" And Me.WindowArray.Item(I) = Me.Office2016Names.Item(x) Then
|
||||
doc_is_active = True
|
||||
Try
|
||||
Catch EX As Exception
|
||||
End Try
|
||||
End If
|
||||
|
||||
Next
|
||||
next
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Private Methoden"
|
||||
|
||||
Public Sub SetWindowName()
|
||||
'Select Case Me.ApplicationType
|
||||
' Case 1 'Word
|
||||
' Me.WindowName = Me.Filename + " - Microsoft Word"
|
||||
' Me.WindowNameKompatibilitaet = Me.Filename + " [Kompatibilitätsmodus] - Microsoft Word"
|
||||
' Me.WindowNamePreview = Me.Filename + " (Seitenansicht) - Microsoft Word"
|
||||
' Me.WindowNameDC = Me.Filename + " - DC"
|
||||
' Case 2 'Excel
|
||||
' Me.WindowName = "Microsoft Excel - " & Me.Filename
|
||||
' Me.WindowNameKompatibilitaet = "Microsoft Excel - " & Me.Filename + " [Kompatibilitätsmodus]"
|
||||
' Me.WindowNamePreview = "Microsoft Excel - " & Me.Filename
|
||||
' Me.WindowNameDC = Me.Filename + ""
|
||||
' Case 3
|
||||
' Me.WindowName = Me.Filename + " - Adobe Reader"
|
||||
' Me.WindowNameKompatibilitaet = Me.Filename + " - Adobe Reader"
|
||||
' Me.WindowNamePreview = Me.Filename + " - Adobe Reader"
|
||||
' Me.WindowNameDC = Me.Filename + ""
|
||||
' Case 4
|
||||
' Me.WindowName = Me.WindowName
|
||||
' Me.WindowNamePreview = Me.WindowNamePreview
|
||||
' Me.WindowNameDC = Me.Filename + ""
|
||||
' Case Else
|
||||
' 'MsgBox("Hallo")
|
||||
'End Select
|
||||
If Globals.office2010WatchFiles.Rows.Count = 0 Then
|
||||
|
||||
Globals.office2010WatchFiles.Columns.Add("Applikation")
|
||||
Globals.office2010WatchFiles.Columns.Add("WindowName")
|
||||
|
||||
Dim r As DataRow = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] - Word"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] [Kompatibilitätsmodus] - Word"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] (Seitenansicht) - Wordd"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename]"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] [Kompatibilitätsmodus]"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] (Seitenansicht)"
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] - Kompatibilitätsmodus - Word"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] - [Kompatibilitätsmodus]"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] - [Kompatibilitätsmodus] - Word"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] - Kompatibilitätsmodus"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
|
||||
r = Globals.office2010WatchFiles.NewRow
|
||||
r(0) = "Word"
|
||||
r(1) = "[Filename] - Kompatibilitätsmodus - Word"
|
||||
Globals.office2010WatchFiles.Rows.Add(r)
|
||||
|
||||
End If
|
||||
If Globals.UseOffice2016 = False Then
|
||||
Select Case Me.ApplicationType
|
||||
Case 1 'Word
|
||||
Me.WindowName = Me.Filename + " - Microsoft Word"
|
||||
Me.WindowNameKompatibilitaet = Me.Filename + " [Kompatibilitätsmodus] - Microsoft Word"
|
||||
Me.WindowNamePreview = Me.Filename + " (Seitenansicht) - Microsoft Word"
|
||||
Me.WindowNameDC = Me.Filename + " - DC"
|
||||
Case 2 'Excel
|
||||
Me.WindowName = "Microsoft Excel - " & Me.Filename
|
||||
Me.WindowNameKompatibilitaet = "Microsoft Excel - " & Me.Filename + " [Kompatibilitätsmodus]"
|
||||
Me.WindowNameKompatibilitaet = Me.Filename + " [Kompatibilitätsmodus] - Excel"
|
||||
Me.WindowNamePreview = "Microsoft Excel - " & Me.Filename
|
||||
Me.WindowNameDC = Me.Filename + ""
|
||||
Case 3
|
||||
Me.WindowName = Me.Filename + " - Adobe Reader"
|
||||
Me.WindowNameKompatibilitaet = Me.Filename + " - Adobe Reader"
|
||||
Me.WindowNamePreview = Me.Filename + " - Adobe Reader"
|
||||
Me.WindowNameDC = Me.Filename + ""
|
||||
Case 4
|
||||
Me.WindowName = Me.WindowName
|
||||
Me.WindowNamePreview = Me.WindowNamePreview
|
||||
Me.WindowNameDC = Me.Filename + ""
|
||||
Case Else
|
||||
'MsgBox("Hallo")
|
||||
End Select
|
||||
End If
|
||||
If Globals.UseOffice2016 = True Then
|
||||
For Each r As DataRow In Globals.Office2010WatchFIles.Rows
|
||||
Select Case ApplicationType
|
||||
Case 1 'word
|
||||
If r("applikation") = "Word" Then
|
||||
'If r.Item(0) = 1 Then Me.WindowName = r.Item("WindowName").ToString.Replace("[Filename]", Me.Filename)
|
||||
Me.Office2016Names.Add(r.Item("WindowName").ToString.Replace("[Filename]", Me.Filename))
|
||||
End If
|
||||
Case 2 'Excel
|
||||
If r("applikation") = "Excel" Then
|
||||
'If r.Item(0) = 10 Then Me.WindowName = r.Item("WindowName").ToString.Replace("[Filename]", Me.Filename)
|
||||
Me.Office2016Names.Add(r.Item("WindowName").ToString.Replace("[Filename]", Me.Filename))
|
||||
End If
|
||||
Case 3 'Acrobat
|
||||
If r("applikation") = "Adobe" Then
|
||||
'If r.Item(0) = 20 Then Me.WindowName = r.Item("WindowName").ToString.Replace("[Filename]", Me.Filename)
|
||||
Me.Office2016Names.Add(r.Item("WindowName").ToString.Replace("[Filename]", Me.Filename))
|
||||
End If
|
||||
Case Else
|
||||
Me.Office2016Names.Add(r.Item("WindowName").ToString.Replace("[Filename]", Me.Filename))
|
||||
End Select
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Public Function getWindowName() As String
|
||||
Return Me.WindowName
|
||||
End Function
|
||||
|
||||
'Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles MyTimer.Elapsed
|
||||
' MyTimer.Stop()
|
||||
' 'Dim sW As New StreamWriter("D:\TRACE.LOG", True)
|
||||
' 'sW.WriteLine(Now)
|
||||
' Dim DocFound As Boolean = False
|
||||
' Dim i As Integer
|
||||
' Dim zz As Integer = 0
|
||||
' 'While zz < 3 And DocFound = False
|
||||
' Me.WindowArray.Clear()
|
||||
' Search_List()
|
||||
' For i = 0 To Me.WindowArray.Count - 1
|
||||
' 'sW.WriteLine(Me.WindowName + ":" + Me.WindowArray.Item(i))
|
||||
' 'If Me.WindowArray.Item(i) = Me.WindowName Then MsgBox("Ist aktiv")
|
||||
' If Me.WindowArray.Item(i) = Me.WindowName Then DocFound = True
|
||||
' If Me.WindowArray.Item(i) = Me.WindowNamePreview Then DocFound = True
|
||||
' If Me.WindowArray.Item(i) = Me.WindowNameDC Then DocFound = True
|
||||
' If Me.WindowArray.Item(i) = Me.WindowNameKompatibilitaet Then DocFound = True
|
||||
' Next
|
||||
' 'zz = zz + 1
|
||||
' ' Thread.Sleep(300)
|
||||
' ' 'End While
|
||||
' ' Thread.Sleep(300)
|
||||
' If Not DocFound Then
|
||||
' Dim fn As String = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "~$" + Microsoft.VisualBasic.Right(Me.Filename, Len(Me.Filename) - 2)
|
||||
' Dim fc As New FileInfo(fn)
|
||||
' If fc.Exists Then DocFound = True
|
||||
' If Not DocFound Then
|
||||
' ' sW.WriteLine("Stop:" + Me.WindowName)
|
||||
' MyTimer.Stop()
|
||||
' RaiseEvent DocumentClosed()
|
||||
' Else
|
||||
' MyTimer.Start()
|
||||
' End If
|
||||
' Else
|
||||
' MyTimer.Start()
|
||||
' End If
|
||||
' DocFound = Nothing
|
||||
' ' sW.WriteLine(Now)
|
||||
' ' sW.Flush()
|
||||
' ' sW.Close()
|
||||
'End Sub
|
||||
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles MyTimer.Elapsed
|
||||
MyTimer.Stop()
|
||||
Dim DocFound As Boolean = False
|
||||
Dim i As Integer
|
||||
Dim zz As Integer = 0
|
||||
Me.WindowArray.Clear()
|
||||
Search_List()
|
||||
Try
|
||||
If Globals.Office2016Debug = True Then FileOpen(7, "h:\office2016Windowlist.txt", OpenMode.Append)
|
||||
Catch EX As Exception
|
||||
End Try
|
||||
|
||||
Try
|
||||
For i = 0 To Me.WindowArray.Count - 1
|
||||
If Globals.UseOffice2016 = False Then
|
||||
If Me.WindowArray.Item(i) = Me.WindowName Then DocFound = True
|
||||
If Me.WindowArray.Item(i) = Me.WindowNamePreview Then DocFound = True
|
||||
If Me.WindowArray.Item(i) = Me.WindowNameDC Then DocFound = True
|
||||
If Me.WindowArray.Item(i) = Me.WindowNameKompatibilitaet Then DocFound = True
|
||||
End If
|
||||
If Globals.Office2016Debug = True Then
|
||||
WriteLine(7, "EDOKA:-----------------------------------------------")
|
||||
End If
|
||||
|
||||
If Globals.UseOffice2016 = True Then
|
||||
For x As Integer = 0 To Me.Office2016Names.Count - 1
|
||||
If Globals.Office2016Debug = True Then
|
||||
WriteLine(7, "EDOKA:" + Me.Office2016Names.Item(x).ToString + " - " + Me.Office2016Names.Count.ToString)
|
||||
End If
|
||||
If Me.WindowArray.Item(i).ToString <> "" And Me.WindowArray.Item(i) = Me.Office2016Names.Item(x) Then
|
||||
DocFound = True
|
||||
If Globals.Office2016Debug = True Then
|
||||
WriteLine(7, "--->DocFound:" + Me.WindowArray.Item(i).ToString + "/" + Me.Office2016Names.Item(x))
|
||||
End If
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If DocFound Then Exit For
|
||||
End If
|
||||
Try
|
||||
If Globals.Office2016Debug = True Then
|
||||
WriteLine(7, Me.WindowArray.Item(i))
|
||||
End If
|
||||
Catch
|
||||
End Try
|
||||
Next
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
If DocFound Then
|
||||
write_log("Dok in Win-List")
|
||||
End If
|
||||
|
||||
If Globals.Office2016Debug = True Then
|
||||
Try
|
||||
For i = 1 To 100000
|
||||
Application.DoEvents()
|
||||
Next
|
||||
FileClose(7)
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End If
|
||||
If Not DocFound Then
|
||||
Dim fn As String = "h:\tssettings\edoka\" + "~$" + Microsoft.VisualBasic.Right(Me.Filename, Len(Me.Filename) - 2)
|
||||
Dim fc As New FileInfo(fn)
|
||||
If fc.Exists Then DocFound = True
|
||||
If Not DocFound Then
|
||||
' sW.WriteLine("Stop:" + Me.WindowName)
|
||||
MyTimer.Stop()
|
||||
GC.Collect()
|
||||
GC.WaitForPendingFinalizers()
|
||||
GC.Collect()
|
||||
|
||||
GC.WaitForPendingFinalizers()
|
||||
RaiseEvent DocumentClosed()
|
||||
Else
|
||||
MyTimer.Start()
|
||||
End If
|
||||
Else
|
||||
MyTimer.Start()
|
||||
End If
|
||||
DocFound = Nothing
|
||||
End Sub
|
||||
Private Sub Search_List()
|
||||
Win32API.EnumWindowsDllImport(New Win32API.EnumWindowsCallback(AddressOf _
|
||||
FillActiveWindowsList), 0)
|
||||
End Sub
|
||||
|
||||
Function FillActiveWindowsList(ByVal hWnd As Integer, ByVal lParam As Integer) As Boolean
|
||||
Dim windowText As New StringBuilder(STRING_BUFFER_LENGTH)
|
||||
Win32API.GetWindowText(hWnd, windowText, STRING_BUFFER_LENGTH)
|
||||
If ProcessIsActiveWindow(hWnd) Then
|
||||
Me.WindowArray.Add(windowText.ToString)
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Function ProcessIsActiveWindow(ByVal hWnd As Integer) As Boolean
|
||||
Dim windowText As New StringBuilder(STRING_BUFFER_LENGTH)
|
||||
Dim windowIsOwned As Boolean
|
||||
Dim windowStyle As Integer
|
||||
Win32API.GetWindowText(hWnd, windowText, STRING_BUFFER_LENGTH)
|
||||
windowIsOwned = Win32API.GetWindow(hWnd, Win32API.GW_OWNER) <> 0
|
||||
windowStyle = Win32API.GetWindowLong(hWnd, Win32API.GWL_EXSTYLE)
|
||||
Return True
|
||||
|
||||
If Not Win32API.IsWindowVisible(hWnd) Then
|
||||
Return False
|
||||
End If
|
||||
If windowText.ToString.Equals("") Then
|
||||
Return False
|
||||
End If
|
||||
If Win32API.GetParent(hWnd) <> 0 Then
|
||||
Return False
|
||||
End If
|
||||
If (windowStyle And Win32API.WS_EX_TOOLWINDOW) <> 0 And Not windowIsOwned Then
|
||||
Return False
|
||||
End If
|
||||
If (windowStyle And Win32API.WS_EX_APPWINDOW) = 0 And windowIsOwned Then
|
||||
Return False
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
Private Sub Close_Log()
|
||||
FileClose(1)
|
||||
End Sub
|
||||
Private Sub Write_Log(ByVal sin As String)
|
||||
open_log()
|
||||
WriteLine(1, Now.ToShortDateString + ":" + Now.ToShortTimeString + " - " + Me.Filename + " : " + sin)
|
||||
Close_Log()
|
||||
End Sub
|
||||
|
||||
|
||||
Sub open_log()
|
||||
FileOpen(1, "h:\tssettings\wordtest_log.txt", OpenMode.Append)
|
||||
End Sub
|
||||
End Class
|
||||
74
WordTest/WordTest/Form1.Designer.vb
generated
Normal file
74
WordTest/WordTest/Form1.Designer.vb
generated
Normal file
@@ -0,0 +1,74 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class Form1
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Wird vom Windows Form-Designer benötigt.
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
||||
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
||||
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.Button2 = New System.Windows.Forms.Button()
|
||||
Me.Button3 = New System.Windows.Forms.Button()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Button1
|
||||
'
|
||||
Me.Button1.Location = New System.Drawing.Point(12, 12)
|
||||
Me.Button1.Name = "Button1"
|
||||
Me.Button1.Size = New System.Drawing.Size(75, 23)
|
||||
Me.Button1.TabIndex = 0
|
||||
Me.Button1.Text = "Start"
|
||||
Me.Button1.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Button2
|
||||
'
|
||||
Me.Button2.Location = New System.Drawing.Point(121, 12)
|
||||
Me.Button2.Name = "Button2"
|
||||
Me.Button2.Size = New System.Drawing.Size(146, 23)
|
||||
Me.Button2.TabIndex = 1
|
||||
Me.Button2.Text = "Log Prozesslist"
|
||||
Me.Button2.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Button3
|
||||
'
|
||||
Me.Button3.Location = New System.Drawing.Point(390, 12)
|
||||
Me.Button3.Name = "Button3"
|
||||
Me.Button3.Size = New System.Drawing.Size(75, 23)
|
||||
Me.Button3.TabIndex = 2
|
||||
Me.Button3.Text = "Button3"
|
||||
Me.Button3.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(800, 450)
|
||||
Me.Controls.Add(Me.Button3)
|
||||
Me.Controls.Add(Me.Button2)
|
||||
Me.Controls.Add(Me.Button1)
|
||||
Me.Name = "Form1"
|
||||
Me.Text = "Form1"
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
Friend WithEvents Button1 As Button
|
||||
Friend WithEvents Button2 As Button
|
||||
Friend WithEvents Button3 As Button
|
||||
End Class
|
||||
120
WordTest/WordTest/Form1.resx
Normal file
120
WordTest/WordTest/Form1.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
153
WordTest/WordTest/Form1.vb
Normal file
153
WordTest/WordTest/Form1.vb
Normal file
@@ -0,0 +1,153 @@
|
||||
Imports System
|
||||
Imports System.Text
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Threading
|
||||
Imports System.IO
|
||||
Public Class Form1
|
||||
Dim w As wordlib
|
||||
Dim CreateDocument As Boolean = True
|
||||
Dim Dokumentname As String
|
||||
Dim Dokument_To_Create As String
|
||||
Dim i As Integer = 0
|
||||
Const STRING_BUFFER_LENGTH As Integer = 255
|
||||
Dim WindowArray As New ArrayList()
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
w = New wordlib
|
||||
Dokument_Bearbeiten(Me.CreateDocument)
|
||||
End Sub
|
||||
|
||||
Private Sub Dokument_Bearbeiten(ByVal neu As Boolean)
|
||||
i = i + 1
|
||||
|
||||
Dokumentname = My.Settings.Dokumentname
|
||||
Dokumentname = Dokumentname.Replace("%", i.ToString)
|
||||
Write_Log("Gestartet")
|
||||
w.dokumentID = i.ToString
|
||||
w.DokumentName = Dokumentname
|
||||
w.CreateDoc = True
|
||||
If w.Create_Dokument_Before_Fill(Dokumentname) = False Then
|
||||
MsgBox("Dokument konnte nicht erstellt werden.")
|
||||
End If
|
||||
w.Dokument_Vervollstaendigen()
|
||||
Try
|
||||
Words.Remove(w.DokumentName)
|
||||
Catch
|
||||
|
||||
End Try
|
||||
Write_Log("In Word-Collection")
|
||||
Words.Add(w, w.DokumentName)
|
||||
Try
|
||||
Dim r As Process
|
||||
Dim Ret As Int32
|
||||
Dim hWndMain As IntPtr
|
||||
|
||||
Dim MyProcesses() As Process =
|
||||
Process.GetProcessesByName(
|
||||
Process.GetCurrentProcess().ProcessName)
|
||||
|
||||
|
||||
For Each r In MyProcesses
|
||||
|
||||
If (r.Id = Process.GetCurrentProcess().Id) Then
|
||||
Globals.Apphandle = r.MainWindowHandle()
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
'rel 4.03
|
||||
Win32API.ShowWindow(Globals.Apphandle, Win32API.SW_Minimze)
|
||||
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Close_Log()
|
||||
FileClose(1)
|
||||
End Sub
|
||||
Private Sub Write_Log(ByVal sin As String)
|
||||
open_log()
|
||||
WriteLine(1, Now.ToShortDateString + ":" + Now.ToShortTimeString + " - " + Dokumentname + " : " + sin)
|
||||
Close_Log()
|
||||
End Sub
|
||||
|
||||
|
||||
Sub open_log()
|
||||
FileOpen(1, "h:\tssettings\wordtest_log.txt", OpenMode.Append)
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
WindowArray.Clear()
|
||||
Search_List()
|
||||
FileOpen(2, "h:\tssettings\windowsarray.txt", OpenMode.Append)
|
||||
For i = 0 To WindowArray.Count - 1
|
||||
WriteLine(2, WindowArray.Item(i))
|
||||
Next
|
||||
FileClose(2)
|
||||
End Sub
|
||||
|
||||
Private Sub Search_List()
|
||||
Win32API.EnumWindowsDllImport(New Win32API.EnumWindowsCallback(AddressOf _
|
||||
FillActiveWindowsList), 0)
|
||||
End Sub
|
||||
|
||||
Function FillActiveWindowsList(ByVal hWnd As Integer, ByVal lParam As Integer) As Boolean
|
||||
Dim windowText As New StringBuilder(STRING_BUFFER_LENGTH)
|
||||
Win32API.GetWindowText(hWnd, windowText, STRING_BUFFER_LENGTH)
|
||||
If ProcessIsActiveWindow(hWnd) Then
|
||||
Me.WindowArray.Add(windowText.ToString)
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Function ProcessIsActiveWindow(ByVal hWnd As Integer) As Boolean
|
||||
Dim windowText As New StringBuilder(STRING_BUFFER_LENGTH)
|
||||
Dim windowIsOwned As Boolean
|
||||
Dim windowStyle As Integer
|
||||
Win32API.GetWindowText(hWnd, windowText, STRING_BUFFER_LENGTH)
|
||||
windowIsOwned = Win32API.GetWindow(hWnd, Win32API.GW_OWNER) <> 0
|
||||
windowStyle = Win32API.GetWindowLong(hWnd, Win32API.GWL_EXSTYLE)
|
||||
Return True
|
||||
|
||||
If Not Win32API.IsWindowVisible(hWnd) Then
|
||||
Return False
|
||||
End If
|
||||
If windowText.ToString.Equals("") Then
|
||||
Return False
|
||||
End If
|
||||
If Win32API.GetParent(hWnd) <> 0 Then
|
||||
Return False
|
||||
End If
|
||||
If (windowStyle And Win32API.WS_EX_TOOLWINDOW) <> 0 And Not windowIsOwned Then
|
||||
Return False
|
||||
End If
|
||||
If (windowStyle And Win32API.WS_EX_APPWINDOW) = 0 And windowIsOwned Then
|
||||
Return False
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Dim WithEvents MyTimer As New System.Timers.Timer(100)
|
||||
Dim timerstartet As Boolean = False
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
If timerstartet Then
|
||||
MyTimer.Stop()
|
||||
timerstartet = False
|
||||
Exit Sub
|
||||
End If
|
||||
MyTimer.Start()
|
||||
timerstartet = True
|
||||
End Sub
|
||||
|
||||
Sub xx() Handles MyTimer.Elapsed
|
||||
For ii As Long = 1 To 100000000
|
||||
ii = ii
|
||||
|
||||
Next
|
||||
Application.DoEvents()
|
||||
End Sub
|
||||
End Class
|
||||
8
WordTest/WordTest/Globals.vb
Normal file
8
WordTest/WordTest/Globals.vb
Normal file
@@ -0,0 +1,8 @@
|
||||
Module Globals
|
||||
|
||||
Public Apphandle As Int32
|
||||
Public Words As New Collection()
|
||||
Public UseOffice2016 As Boolean = True
|
||||
Public Office2016Debug As Boolean = False
|
||||
Public office2010WatchFiles As New DataTable
|
||||
End Module
|
||||
38
WordTest/WordTest/My Project/Application.Designer.vb
generated
Normal file
38
WordTest/WordTest/My Project/Application.Designer.vb
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
|
||||
' or if you encounter build errors in this file, go to the Project Designer
|
||||
' (go to Project Properties or double-click the My Project node in
|
||||
' Solution Explorer), and make changes on the Application tab.
|
||||
'
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Public Sub New()
|
||||
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
||||
Me.IsSingleInstance = false
|
||||
Me.EnableVisualStyles = true
|
||||
Me.SaveMySettingsOnExit = true
|
||||
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
|
||||
End Sub
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.WordTest.Form1
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
11
WordTest/WordTest/My Project/Application.myapp
Normal file
11
WordTest/WordTest/My Project/Application.myapp
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>Form1</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>0</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
35
WordTest/WordTest/My Project/AssemblyInfo.vb
Normal file
35
WordTest/WordTest/My Project/AssemblyInfo.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
' die einer Assembly zugeordnet sind.
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("WordTest")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("WordTest")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("406380aa-0353-4709-b1b9-13cad2dbffba")>
|
||||
|
||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
'
|
||||
' Hauptversion
|
||||
' Nebenversion
|
||||
' Buildnummer
|
||||
' Revision
|
||||
'
|
||||
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
' indem Sie "*" wie unten gezeigt eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
62
WordTest/WordTest/My Project/Resources.Designer.vb
generated
Normal file
62
WordTest/WordTest/My Project/Resources.Designer.vb
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("WordTest.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
WordTest/WordTest/My Project/Resources.resx
Normal file
117
WordTest/WordTest/My Project/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
133
WordTest/WordTest/My Project/Settings.Designer.vb
generated
Normal file
133
WordTest/WordTest/My Project/Settings.Designer.vb
generated
Normal file
@@ -0,0 +1,133 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Automatische My.Settings-Speicherfunktion"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("h:\tssettings\edoka\dokument_%.docx")> _
|
||||
Public Property Dokumentname() As String
|
||||
Get
|
||||
Return CType(Me("Dokumentname"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("Dokumentname") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("h:\tssettings\office\ts\test_vorlage.docx")> _
|
||||
Public Property Vorlage() As String
|
||||
Get
|
||||
Return CType(Me("Vorlage"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("Vorlage") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("h:\tssettings\office\ts\tkbmakros.dotm")> _
|
||||
Public Property AddinFile() As String
|
||||
Get
|
||||
Return CType(Me("AddinFile"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("AddinFile") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("400")> _
|
||||
Public Property WordStartDelay() As String
|
||||
Get
|
||||
Return CType(Me("WordStartDelay"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("WordStartDelay") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("h:\tssettings\office\ts\menu\edoka_1.dotm")> _
|
||||
Public Property WordMenu() As String
|
||||
Get
|
||||
Return CType(Me("WordMenu"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("WordMenu") = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.WordTest.My.MySettings
|
||||
Get
|
||||
Return Global.WordTest.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
21
WordTest/WordTest/My Project/Settings.settings
Normal file
21
WordTest/WordTest/My Project/Settings.settings
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Dokumentname" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">h:\tssettings\edoka\dokument_%.docx</Value>
|
||||
</Setting>
|
||||
<Setting Name="Vorlage" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">h:\tssettings\office\ts\test_vorlage.docx</Value>
|
||||
</Setting>
|
||||
<Setting Name="AddinFile" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">h:\tssettings\office\ts\tkbmakros.dotm</Value>
|
||||
</Setting>
|
||||
<Setting Name="WordStartDelay" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">400</Value>
|
||||
</Setting>
|
||||
<Setting Name="WordMenu" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">h:\tssettings\office\ts\menu\edoka_1.dotm</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
159
WordTest/WordTest/WinAPI32.vb
Normal file
159
WordTest/WordTest/WinAPI32.vb
Normal file
@@ -0,0 +1,159 @@
|
||||
Option Strict On
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text
|
||||
|
||||
' Class to wrap up Windows 32 API constants and functions.
|
||||
Public Class Win32API
|
||||
<StructLayout(LayoutKind.Sequential)>
|
||||
Public Structure OSVersionInfo
|
||||
Public OSVersionInfoSize As Integer
|
||||
Public majorVersion As Integer
|
||||
Public minorVersion As Integer
|
||||
Public buildNumber As Integer
|
||||
Public platformId As Integer
|
||||
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)>
|
||||
Public versionString As String
|
||||
End Structure
|
||||
|
||||
<StructLayout(LayoutKind.Sequential)>
|
||||
Public Structure SECURITY_ATTRIBUTES
|
||||
Public nLength As Integer
|
||||
Public lpSecurityDescriptor As Integer
|
||||
Public bInheritHandle As Integer
|
||||
End Structure
|
||||
|
||||
Public Const GWL_EXSTYLE As Integer = (-20)
|
||||
Public Const SW_Maximize As Integer = 3
|
||||
Public Const SW_Minimze As Integer = 2
|
||||
Public Const GW_OWNER As Integer = 4
|
||||
Public Const SW_RESTORE As Integer = 9
|
||||
Public Const SW_SHOW As Integer = 5
|
||||
Public Const WS_EX_TOOLWINDOW As Integer = &H80
|
||||
Public Const WS_EX_APPWINDOW As Integer = &H40000
|
||||
Private Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr,
|
||||
ByRef lpdwProcessId As Integer) As Integer
|
||||
End Function
|
||||
|
||||
|
||||
Public Declare Function CreateDirectory Lib "kernel32" _
|
||||
Alias "CreateDirectoryA" (ByVal lpPathName As String,
|
||||
ByVal lpSecurityAttributes _
|
||||
As SECURITY_ATTRIBUTES) As Boolean
|
||||
|
||||
|
||||
Public Delegate Function EnumWindowsCallback(ByVal hWnd As Integer,
|
||||
ByVal lParam As Integer) As Boolean
|
||||
|
||||
Public Declare Function EnumWindows Lib "user32.dll" _
|
||||
Alias "EnumWindows" (ByVal callback As EnumWindowsCallback,
|
||||
ByVal lParam As Integer) As Integer
|
||||
|
||||
<DllImport("user32.dll", EntryPoint:="EnumWindows", SetLastError:=True,
|
||||
CharSet:=CharSet.Ansi, ExactSpelling:=True,
|
||||
CallingConvention:=CallingConvention.StdCall)>
|
||||
Public Shared Function EnumWindowsDllImport(ByVal callback As EnumWindowsCallback,
|
||||
ByVal lParam As Integer) As Integer
|
||||
End Function
|
||||
|
||||
Public Declare Auto Function FindWindow Lib "user32.dll" _
|
||||
Alias "FindWindow" (ByVal lpClassName As String,
|
||||
ByVal lpWindowName As String) As Integer
|
||||
|
||||
Public Declare Auto Function FindWindowAny Lib "user32.dll" _
|
||||
Alias "FindWindow" (ByVal lpClassName As Integer,
|
||||
ByVal lpWindowName As Integer) As Integer
|
||||
|
||||
Public Declare Auto Function FindWindowNullClassName Lib "user32.dll" _
|
||||
Alias "FindWindow" (ByVal lpClassName As Integer,
|
||||
ByVal lpWindowName As String) As Integer
|
||||
|
||||
Public Declare Auto Function FindWindowNullWindowCaption Lib "user32.dll" _
|
||||
Alias "FindWindow" (ByVal lpClassName As String,
|
||||
ByVal lpWindowName As Integer) As Integer
|
||||
|
||||
Public Declare Function GetActiveWindow Lib "user32.dll" () As IntPtr
|
||||
|
||||
Public Declare Function GetClassName Lib "user32.dll" _
|
||||
Alias "GetClassNameA" (ByVal hwnd As Integer,
|
||||
ByVal lpClassName As String,
|
||||
ByVal cch As Integer) As Integer
|
||||
|
||||
Public Declare Function GetDiskFreeSpace Lib "kernel32" _
|
||||
Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String,
|
||||
ByRef lpSectorsPerCluster As Integer,
|
||||
ByRef lpBytesPerSector As Integer,
|
||||
ByRef lpNumberOfFreeClusters As Integer,
|
||||
ByRef lpTotalNumberOfClusters As Integer) As Integer
|
||||
|
||||
|
||||
Public Declare Function GetDiskFreeSpaceEx Lib "kernel32" _
|
||||
Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String,
|
||||
ByRef lpFreeBytesAvailableToCaller As Integer,
|
||||
ByRef lpTotalNumberOfBytes As Integer,
|
||||
ByRef lpTotalNumberOfFreeBytes As UInt32) As Integer
|
||||
|
||||
Public Declare Function GetDriveType Lib "kernel32" _
|
||||
Alias "GetDriveTypeA" (ByVal nDrive As String) As Integer
|
||||
|
||||
Public Declare Function GetParent Lib "user32.dll" _
|
||||
Alias "GetParent" (ByVal hwnd As Integer) As Integer
|
||||
|
||||
|
||||
Declare Ansi Function GetVersionEx Lib "kernel32.dll" _
|
||||
Alias "GetVersionExA" (ByRef osvi As OSVersionInfo) As Boolean
|
||||
|
||||
Public Declare Function GetWindow Lib "user32.dll" _
|
||||
Alias "GetWindow" (ByVal hwnd As Integer,
|
||||
ByVal wCmd As Integer) As Integer
|
||||
|
||||
Public Declare Function GetWindowLong Lib "user32.dll" _
|
||||
Alias "GetWindowLongA" (ByVal hwnd As Integer,
|
||||
ByVal nIndex As Integer) As Integer
|
||||
|
||||
Public Declare Sub GetWindowText Lib "user32.dll" _
|
||||
Alias "GetWindowTextA" (ByVal hWnd As Integer,
|
||||
ByVal lpString As StringBuilder,
|
||||
ByVal nMaxCount As Integer)
|
||||
|
||||
Public Declare Function IsIconic Lib "user32.dll" _
|
||||
Alias "IsIconic" (ByVal hwnd As Integer) As Boolean
|
||||
|
||||
Public Declare Function IsPwrHibernateAllowed Lib "Powrprof.dll" _
|
||||
Alias "IsPwrHibernateAllowed" () As Integer
|
||||
|
||||
Public Declare Function IsWindowVisible Lib "user32.dll" _
|
||||
Alias "IsWindowVisible" (ByVal hwnd As Integer) As Boolean
|
||||
|
||||
Public Declare Function SetForegroundWindow Lib "user32.dll" _
|
||||
Alias "SetForegroundWindow" (ByVal hwnd As Integer) As Integer
|
||||
|
||||
Public Declare Function SetActiveWindow Lib "user32.dll" _
|
||||
Alias "SetActiveWindow" (ByVal hwnd As Integer) As Integer
|
||||
|
||||
|
||||
Public Declare Function SetSuspendState Lib "Powrprof.dll" _
|
||||
Alias "SetSuspendState" (ByVal Hibernate As Integer,
|
||||
ByVal ForceCritical As Integer,
|
||||
ByVal DisableWakeEvent As Integer) As Integer
|
||||
|
||||
Public Declare Function ShowWindow Lib "user32.dll" _
|
||||
Alias "ShowWindow" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
|
||||
|
||||
Declare Function SwapMouseButton Lib "user32.dll" _
|
||||
Alias "SwapMouseButton" (ByVal bSwap As Integer) As Integer
|
||||
|
||||
Public Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Long
|
||||
|
||||
'Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
|
||||
|
||||
'Public Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long
|
||||
'Public Const SB_VERT As Long = 1
|
||||
'Public Const SB_HORZ As Long = 0
|
||||
|
||||
Public Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As System.IntPtr
|
||||
|
||||
Public Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hWnd As Integer, ByRef lpRect As Rectangle) As Long
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
183
WordTest/WordTest/WordTest.vbproj
Normal file
183
WordTest/WordTest/WordTest.vbproj
Normal file
@@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B53C02F6-389A-4E81-89C2-766AADBC861D}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>WordTest.My.MyApplication</StartupObject>
|
||||
<RootNamespace>WordTest</RootNamespace>
|
||||
<AssemblyName>WordTest</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>WordTest.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>WordTest.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Interop.ARSOLELib">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.ARSOLELib.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.DC">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.DC.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.Excel">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.Excel.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.IDVMakros">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.IDVMakros.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.Office">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.Office.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.OWC">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.OWC.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.SHDocVw">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.SHDocVw.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.VBIDE">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Interop.VBIDE.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Microsoft.mshtml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\..\..\client\EDOKA\bin\Microsoft.Office.Interop.Word.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="msdatasrc, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\..\..\client\EDOKA\bin\msdatasrc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MW6.SDK">
|
||||
<HintPath>..\..\..\client\EDOKA\bin\MW6.SDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ApplicationFileWatcher.vb" />
|
||||
<Compile Include="Form1.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.vb">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Globals.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="WinAPI32.vb" />
|
||||
<Compile Include="wordlib.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="frmProgress.resx" />
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
BIN
WordTest/WordTest/bin/Debug/MW6.SDK.dll
Normal file
BIN
WordTest/WordTest/bin/Debug/MW6.SDK.dll
Normal file
Binary file not shown.
BIN
WordTest/WordTest/bin/Debug/WordTest.exe
Normal file
BIN
WordTest/WordTest/bin/Debug/WordTest.exe
Normal file
Binary file not shown.
30
WordTest/WordTest/bin/Debug/WordTest.exe.config
Normal file
30
WordTest/WordTest/bin/Debug/WordTest.exe.config
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="WordTest.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<WordTest.My.MySettings>
|
||||
<setting name="Dokumentname" serializeAs="String">
|
||||
<value>h:\tssettings\edoka\dokument_%.docx</value>
|
||||
</setting>
|
||||
<setting name="Vorlage" serializeAs="String">
|
||||
<value>h:\tssettings\office\ts\test_vorlage.docx</value>
|
||||
</setting>
|
||||
<setting name="AddinFile" serializeAs="String">
|
||||
<value>h:\tssettings\office\ts\tkbmakros.dotm</value>
|
||||
</setting>
|
||||
<setting name="WordStartDelay" serializeAs="String">
|
||||
<value>400</value>
|
||||
</setting>
|
||||
<setting name="WordMenu" serializeAs="String">
|
||||
<value>h:\tssettings\office\ts\menu\edoka_1.dotm</value>
|
||||
</setting>
|
||||
</WordTest.My.MySettings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
BIN
WordTest/WordTest/bin/Debug/WordTest.pdb
Normal file
BIN
WordTest/WordTest/bin/Debug/WordTest.pdb
Normal file
Binary file not shown.
26
WordTest/WordTest/bin/Debug/WordTest.xml
Normal file
26
WordTest/WordTest/bin/Debug/WordTest.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
WordTest
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:WordTest.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WordTest.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WordTest.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
BIN
WordTest/WordTest/bin/Debug/WordTest.zip
Normal file
BIN
WordTest/WordTest/bin/Debug/WordTest.zip
Normal file
Binary file not shown.
120
WordTest/WordTest/frmProgress.resx
Normal file
120
WordTest/WordTest/frmProgress.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,7 @@
|
||||
' <autogenerated/>
|
||||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
<Assembly: Global.System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6", FrameworkDisplayName:=".NET Framework 4.6")>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
WordTest/WordTest/obj/Debug/WordTest.Form1.resources
Normal file
BIN
WordTest/WordTest/obj/Debug/WordTest.Form1.resources
Normal file
Binary file not shown.
BIN
WordTest/WordTest/obj/Debug/WordTest.Resources.resources
Normal file
BIN
WordTest/WordTest/obj/Debug/WordTest.Resources.resources
Normal file
Binary file not shown.
BIN
WordTest/WordTest/obj/Debug/WordTest.exe
Normal file
BIN
WordTest/WordTest/obj/Debug/WordTest.exe
Normal file
Binary file not shown.
BIN
WordTest/WordTest/obj/Debug/WordTest.frmProgress.resources
Normal file
BIN
WordTest/WordTest/obj/Debug/WordTest.frmProgress.resources
Normal file
Binary file not shown.
BIN
WordTest/WordTest/obj/Debug/WordTest.pdb
Normal file
BIN
WordTest/WordTest/obj/Debug/WordTest.pdb
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
d1d89e1f712738864c371e915e46206514bf1a9e
|
||||
@@ -0,0 +1,15 @@
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.Form1.resources
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.frmProgress.resources
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.Resources.resources
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.vbproj.GenerateResource.cache
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.vbproj.CoreCompileInputs.cache
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\bin\Debug\WordTest.exe.config
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\bin\Debug\WordTest.exe
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\bin\Debug\WordTest.pdb
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\bin\Debug\WordTest.xml
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\bin\Debug\MW6.SDK.dll
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.vbproj.CopyComplete
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.exe
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.xml
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.pdb
|
||||
E:\Software-Projekte\EDOKA\tools\WordTest\WordTest\obj\Debug\WordTest.vbprojAssemblyReference.cache
|
||||
Binary file not shown.
Binary file not shown.
26
WordTest/WordTest/obj/Debug/WordTest.xml
Normal file
26
WordTest/WordTest/obj/Debug/WordTest.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
WordTest
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:WordTest.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WordTest.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WordTest.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
402
WordTest/WordTest/wordlib.vb
Normal file
402
WordTest/WordTest/wordlib.vb
Normal file
@@ -0,0 +1,402 @@
|
||||
Imports Word
|
||||
Imports MW6.SDK.DataMatrix
|
||||
Imports System.Threading
|
||||
Imports System.Runtime.Remoting
|
||||
|
||||
Public Class wordlib
|
||||
Public dokumentID As String
|
||||
Public DokumentName As String
|
||||
Public CreateDoc As Boolean = False
|
||||
|
||||
Dim Dokument_To_Create As String
|
||||
Dim Dokument_Temp As String
|
||||
Dim WordnewInstance As Boolean
|
||||
Dim Isprotected As Boolean = False
|
||||
Dim Dokument_Saved As Boolean = True
|
||||
Private WithEvents objWord As Microsoft.Office.Interop.Word.Application
|
||||
Private WithEvents docWord As Microsoft.Office.Interop.Word.Document
|
||||
Private WithEvents WordWatch As New ApplicationFileWatcher()
|
||||
Dim Save_DateTime As DateTime
|
||||
Dim Excel_Dokument As Boolean
|
||||
Dim DocReadonly As Boolean
|
||||
Dim Word_Active As Boolean
|
||||
Dim objWatcher As New System.IO.FileSystemWatcher()
|
||||
Dim objResult As System.IO.WaitForChangedResult
|
||||
|
||||
Public Function Create_Dokument_Before_Fill(dokumentname As String)
|
||||
Dokument_Temp = dokumentname
|
||||
Copy_Vorlage()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function Copy_Vorlage()
|
||||
If System.IO.File.Exists(DokumentName) Then System.IO.File.Delete(DokumentName)
|
||||
System.IO.File.Copy(My.Settings.Vorlage, DokumentName)
|
||||
Me.DokumentName = DokumentName
|
||||
StartWord()
|
||||
Dim s As String
|
||||
Rename(DokumentName, DokumentName)
|
||||
objWord.Documents.Open(DokumentName)
|
||||
If objWord.ActiveDocument.CompatibilityMode = 14 Then
|
||||
objWord.ActiveDocument.SaveAs2(DokumentName, CompatibilityMode:=14, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocument)
|
||||
End If
|
||||
docWord = objWord.ActiveDocument
|
||||
Threading.Thread.CurrentThread.Sleep(400)
|
||||
objWord.NormalTemplate.Saved = True
|
||||
End Function
|
||||
|
||||
Public Sub Dokument_Vervollstaendigen()
|
||||
If docWord.ProtectionType <> Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection Then
|
||||
docWord.Unprotect(Password:="Australia")
|
||||
IsProtected = True
|
||||
End If
|
||||
objWord.Visible = False
|
||||
objWord.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize
|
||||
objWord.ScreenUpdating = True
|
||||
If Isprotected Then
|
||||
Try
|
||||
docWord.Protect(Type:=Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyFormFields, NoReset:=True, Password:="Australia")
|
||||
Catch
|
||||
End Try
|
||||
End If
|
||||
|
||||
Dim A As Integer
|
||||
A = 0
|
||||
|
||||
While A < 2
|
||||
Try
|
||||
objWord.Visible = True
|
||||
objWord.Activate()
|
||||
A = 2
|
||||
Catch
|
||||
Try
|
||||
Thread.Sleep(500)
|
||||
objWord.Visible = True
|
||||
objWord.Activate()
|
||||
A = 2
|
||||
Catch
|
||||
If MsgBox("Word-Fehler", vbYesNo) = MsgBoxResult.Yes Then
|
||||
A = 1
|
||||
Else
|
||||
docWord.Close(False)
|
||||
docWord = Nothing
|
||||
objWord = Nothing
|
||||
A = 3
|
||||
Throw New Exception("Fehler Dokumenthandling")
|
||||
End If
|
||||
End Try
|
||||
End Try
|
||||
End While
|
||||
|
||||
objWord.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMaximize
|
||||
If objWord.ActiveWindow.View.SplitSpecial = Microsoft.Office.Interop.Word.WdSpecialPane.wdPaneNone Then
|
||||
objWord.ActiveWindow.ActivePane.View.Type = Microsoft.Office.Interop.Word.WdViewType.wdPrintView
|
||||
Else
|
||||
objWord.ActiveWindow.View.Type = Microsoft.Office.Interop.Word.WdViewType.wdPrintView
|
||||
End If
|
||||
objWord.Visible = True
|
||||
|
||||
Try
|
||||
' Rel 4.0 Fensterhandling Problem
|
||||
' Handle verweis auf Prozess EDOKA...
|
||||
Dim p As Process
|
||||
Dim Ret As Int32
|
||||
Dim hWndMain As IntPtr
|
||||
|
||||
Dim MyProcesses() As Process =
|
||||
Process.GetProcessesByName(
|
||||
Process.GetCurrentProcess().ProcessName)
|
||||
|
||||
|
||||
For Each p In MyProcesses
|
||||
|
||||
If (p.Id = Process.GetCurrentProcess().Id) Then
|
||||
Globals.Apphandle = p.MainWindowHandle()
|
||||
End If
|
||||
|
||||
Next
|
||||
Win32API.ShowWindow(Globals.Apphandle, Win32API.SW_Minimze)
|
||||
'Else
|
||||
' Try
|
||||
' WordWatch.ApplicationType = 1
|
||||
' WordWatch.SetWindowName()
|
||||
' Wordhandle = Win32API.FindWindow(vbNullString, objWord.ActiveDocument.Name + " - Word")
|
||||
' If Wordhandle = 0 Then
|
||||
' Wordhandle = Win32API.FindWindow(vbNullString, objWord.ActiveDocument.Name + " [Kompatibilitätsmodus] - Word")
|
||||
' End If
|
||||
' Catch
|
||||
' End Try
|
||||
'End If
|
||||
Catch
|
||||
End Try
|
||||
|
||||
Dim dn As String = objWord.ActiveDocument.FullName
|
||||
|
||||
Dim extensionnew As String = System.IO.Path.GetExtension(objWord.ActiveDocument.FullName)
|
||||
Threading.Thread.CurrentThread.Sleep(500)
|
||||
extensionnew = LCase(extensionnew)
|
||||
Dim i As Integer = objWord.ActiveDocument.CompatibilityMode()
|
||||
If objWord.ActiveDocument.CompatibilityMode = 14 Then
|
||||
Select Case extensionnew
|
||||
Case ".docx"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, CompatibilityMode:=14, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocument)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case ".docm"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, CompatibilityMode:=14, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocumentMacroEnabled)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case ".dotx"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLTemplate, CompatibilityMode:=14)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case ".dotm"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLTemplateMacroEnabled, CompatibilityMode:=14)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case Else
|
||||
End Select
|
||||
Else
|
||||
Select Case extensionnew
|
||||
Case ".docx"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, CompatibilityMode:=11, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocument)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case ".docm"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, CompatibilityMode:=11, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocumentMacroEnabled)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case ".dotx"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLTemplate, CompatibilityMode:=11)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case ".dotm"
|
||||
Try
|
||||
objWord.ActiveDocument.SaveAs2(dn, FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLTemplateMacroEnabled, CompatibilityMode:=11)
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Bei der Dokumenterstellung ist folgender Fehler aufgetreten: " + ex.Message)
|
||||
End Try
|
||||
Case Else
|
||||
End Select
|
||||
End If
|
||||
docWord.Save()
|
||||
|
||||
objWord.NormalTemplate.Saved = True
|
||||
docWord = objWord.ActiveDocument
|
||||
Thread.CurrentThread.Sleep(300)
|
||||
Me.Dokument_Saved = False
|
||||
If objWord.ActiveWindow.View.SplitSpecial = Microsoft.Office.Interop.Word.WdSpecialPane.wdPaneNone Then
|
||||
objWord.ActiveWindow.ActivePane.View.Type = Microsoft.Office.Interop.Word.WdViewType.wdPrintView
|
||||
Else
|
||||
objWord.ActiveWindow.View.Type = Microsoft.Office.Interop.Word.WdViewType.wdPrintView
|
||||
End If
|
||||
control_word
|
||||
End Sub
|
||||
|
||||
Private Sub Control_Word()
|
||||
|
||||
Me.Dokument_Saved = False
|
||||
'FileWatcher()
|
||||
' Init_ObjWatcher()
|
||||
WATCHFILE()
|
||||
Write_Log("Wachfile gestartet")
|
||||
End Sub
|
||||
|
||||
Private Function WATCHFILE()
|
||||
|
||||
'Wordwatch - Überprüfung auf geöffnete
|
||||
If Not Me.DocReadonly Then Save_DateTime = System.IO.File.GetLastWriteTime(Me.DokumentName)
|
||||
WordWatch.Filename = System.IO.Path.GetFileNameWithoutExtension(Me.DokumentName) + ".docx"
|
||||
WordWatch.ApplicationType = 1
|
||||
Disable_Enable_MenuFunctions(False)
|
||||
objWord.Visible = True
|
||||
objWord.Activate()
|
||||
|
||||
Word_Active = True
|
||||
|
||||
Dim ChkCount As Integer = 0
|
||||
Dim tmpdokfound As Boolean = False
|
||||
WordWatch.SetWindowName()
|
||||
While WordWatch.doc_is_active = False And ChkCount < 5
|
||||
Application.DoEvents()
|
||||
ChkCount = ChkCount + 1
|
||||
End While
|
||||
If ChkCount > 4 Then
|
||||
MsgBox("Die Überwachung des Office-Dokuments ist fehlgeschlagen. Bitte erstellen Sie das Dokument neu.")
|
||||
Throw New Exception("Fehler Dokumenthandling")
|
||||
|
||||
End If
|
||||
|
||||
|
||||
WordWatch.Start()
|
||||
Dim hnd As Integer
|
||||
|
||||
Try
|
||||
hnd = Win32API.FindWindow(vbNullString, WordWatch.WindowName)
|
||||
Catch
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Sub Disable_Enable_MenuFunctions(ByVal Enable As Boolean)
|
||||
|
||||
On Error Resume Next
|
||||
Dim cmdctrl As Object
|
||||
Dim i As Integer
|
||||
On Error Resume Next
|
||||
handle_word_2010(Enable)
|
||||
Exit Sub
|
||||
End Sub
|
||||
|
||||
Private Sub handle_word_2010(ByVal enable As Boolean)
|
||||
If enable = True Then Exit Sub
|
||||
If objWord.ActiveDocument.ProtectionType <> Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection Then
|
||||
objWord.ActiveDocument.Unprotect("Australia")
|
||||
Dim addinfile As String = My.Settings.WordMenu
|
||||
If addinfile <> "" Then objWord.AddIns.Add(addinfile)
|
||||
|
||||
objWord.ActiveDocument.Protect(Type:=Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyFormFields, NoReset:=True, Password:="Australia")
|
||||
Exit Sub
|
||||
Else
|
||||
Dim addinfile As String = My.Settings.WordMenu
|
||||
If addinfile <> "" Then objWord.AddIns.Add(addinfile)
|
||||
Exit Sub
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function StartWord()
|
||||
|
||||
Try
|
||||
objWord = CreateObject("Word.Application")
|
||||
Me.WordnewInstance = True
|
||||
Catch
|
||||
Try
|
||||
objWord = CreateObject("Word.Application")
|
||||
objWord.Application.Options.SaveInterval = 0
|
||||
Me.WordnewInstance = True
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
Finally
|
||||
objWord.Visible = False
|
||||
End Try
|
||||
Try
|
||||
Dim addinfile As String = My.Settings.AddinFile
|
||||
Thread.Sleep(My.Settings.WordStartDelay)
|
||||
If addinfile <> "" Then objWord.AddIns.Add(addinfile)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Dim finished As Boolean = False
|
||||
Private Sub Finishing() Handles WordWatch.DocumentClosed
|
||||
|
||||
Write_Log("Dokument closed" + ";" + Me.DokumentName)
|
||||
objWatcher.EnableRaisingEvents = False
|
||||
Finished = True
|
||||
|
||||
Thread.Sleep(100)
|
||||
WordWatch.Stopp()
|
||||
If System.IO.File.Exists(Me.DokumentName) = False Then Exit Sub
|
||||
|
||||
Thread.CurrentThread.Sleep(400)
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
If Not Me.Excel_Dokument Then
|
||||
If Globals.Words.Count = 0 Then Disable_Enable_MenuFunctions(True)
|
||||
|
||||
Dim xtime As DateTime
|
||||
xtime = System.IO.File.GetLastWriteTime(Me.DokumentName)
|
||||
'--------------------------------------------------------------------
|
||||
Dim diff As Integer
|
||||
Dim cxtime As String = xtime.ToString
|
||||
Dim csavetime As String = Save_DateTime.ToString
|
||||
diff = DateDiff(DateInterval.Second, Save_DateTime, xtime)
|
||||
'Sofern das Dokument über eine Dokumentpaket erstellt wurde, dieses aus der DP_Collection löschen
|
||||
|
||||
If diff > 2 Then
|
||||
' MsgBox("Savedata")
|
||||
Else
|
||||
'MsgBox("RestoreData")
|
||||
End If
|
||||
End If
|
||||
Try
|
||||
docWord = Nothing
|
||||
objWord = Nothing
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
If Globals.Words.Count = 0 Then
|
||||
StartWord()
|
||||
objWord.NormalTemplate.Saved = True
|
||||
objWord.Visible = False
|
||||
Disable_Enable_MenuFunctions(True)
|
||||
If Me.WordnewInstance = True Then
|
||||
objWord.Quit()
|
||||
Else
|
||||
objWord.Visible = True
|
||||
End If
|
||||
objWord = Nothing
|
||||
End If
|
||||
Try
|
||||
GC.Collect()
|
||||
GC.WaitForPendingFinalizers()
|
||||
GC.Collect()
|
||||
|
||||
GC.WaitForPendingFinalizers()
|
||||
Dim p As Process
|
||||
Dim MyProcesses() As Process =
|
||||
Process.GetProcessesByName(
|
||||
Process.GetCurrentProcess().ProcessName)
|
||||
For Each p In MyProcesses
|
||||
If (p.Id = Process.GetCurrentProcess().Id) Then
|
||||
Globals.Apphandle = p.MainWindowHandle()
|
||||
End If
|
||||
Next
|
||||
Win32API.SetActiveWindow(Globals.Apphandle)
|
||||
Win32API.BringWindowToTop(Globals.Apphandle)
|
||||
Win32API.ShowWindow(Globals.Apphandle, Win32API.SW_Maximize)
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Function FileWatcher()
|
||||
|
||||
Save_DateTime = System.IO.File.GetLastWriteTime(Me.DokumentName)
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub filechange(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
|
||||
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
|
||||
Me.Dokument_Saved = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Close_Log()
|
||||
FileClose(1)
|
||||
End Sub
|
||||
Private Sub Write_Log(ByVal sin As String)
|
||||
open_log()
|
||||
WriteLine(1, Now.ToShortDateString + ":" + Now.ToShortTimeString + " - " + DokumentName + " : " + sin)
|
||||
Close_Log()
|
||||
End Sub
|
||||
|
||||
|
||||
Sub open_log()
|
||||
FileOpen(1, "h:\tssettings\wordtest_log.txt", OpenMode.Append)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user