Start RSLinx Minimized/Verify RSLinx Running

zmanvortex

Member
Join Date
Apr 2002
Location
Nebraska
Posts
216
Hi Everyone. I am buidling a VB application which uses DDE via RSLinx to communicate to a processor. I would like to start RSLinx minimized and verify that it is running at my splash screen when my application starts. I was able to start RSLinx using the shell statement in VB with the argument vbMinimized, but RSLinx still started maximized. I would also like to verify that RSLinx is running before leaving my splash screen. I have been unable to find much info on web searches. Hope someone can help.
 
I am probably speeking too quickly and outside of my knowledge comfort zone but. ..... I was wondering if you couldn't run a shortcut to RSLinx and set the properties on the shortcut to run RSLinx minimized. I tried it only by double clicking on the shortcut, and that worked, or am I missing the point.
 
You should have RSlinx set to run as a Service, this will enable it to run in the Systray. Sorry but I do not know of any command line switches will will set this to run minimized.


To check to see if RSlinx is running you can use the following code in VB.

Place this in the General Declartions of a .bas file

Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

:::::: Then add these Functions to the .bas file ::::::::

Public Function EnumWindowsProcCallBack(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Dim RetVal As Long
Dim WinClassBuf As String * 255
Dim WinTitleBuf As String * 255
Dim WinClass As String
Dim WinTitle As String

On Error Resume Next

RetVal = GetClassName(hwnd, WinClassBuf, 255)
WinClass = StripNulls(WinClassBuf) ' remove extra Nulls & spaces
RetVal = GetWindowText(hwnd, WinTitleBuf, 255)
WinTitle = StripNulls(WinTitleBuf)
' see the Windows Class and Title for each top level Window
'Debug.Print WinClass, "::::", WinTitle
'the Following line will check for a specific program
If InStr(WinTitle, sProgram) > 0 Then
bProgramFound = True
'Put code here for info if found
End If


EnumWindowsProcCallBack = True

End Function

Public Function EnumTopLevelWindows()

On Error Resume Next

EnumTopLevelWindows = EnumWindows(AddressOf EnumWindowsProcCallBack, 0)

End Function

Public Function StripNulls(OriginalStr As String) As String

On Error Resume Next

' This removes the extra Nulls so String comparisons will work
If (InStr(OriginalStr, Chr(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
End If
StripNulls = OriginalStr
End Function



::::: in you splash form you can then do the following ::::

bProgramFound = False
sProgram = "RSLinx"
Call EnumTopLevelWindows

If bProgramFound = False Then
Call RSlinx
End If
 

Similar Topics

RSLinx EthernetIP Driver is not starting on Windows 7 PC I have an old XP PC and it works there and I am able to upload program - I tried...
Replies
7
Views
2,472
I want to link tags on excel with rslinx classic gateway and anytime i click on the macro, this stuff keeeps on pooping" start rslinx.exe"
Replies
0
Views
1,190
Just installed RS500 and RSLinx on a new Win7 x64 VM. When I open RS500 and try and who active a server busy message box appears and rslinx...
Replies
3
Views
2,756
Once a plc is taken off the network and then put back on usually after a day or so we see some tags in that plc come and go within the studio se...
Replies
5
Views
4,087
Hi, i'm Elias Castañeda from Mexico. I have a problem, I configure RSLinx to start as windows service on Windows NT service pack 6 and set mode...
Replies
5
Views
7,544
Back
Top Bottom