Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Dictionary<string, SapInfoItem> get_sapInfo()
- {
- Dictionary<string, SapInfoItem> sapInfo = new Dictionary<string, SapInfoItem>();
- GuiApplication sapGuiApp;
- SapROTWr.CSapROTWrapper sapROTWrapper = new SapROTWr.CSapROTWrapper();
- object SapGuilRot = sapROTWrapper.GetROTEntry("SAPGUI");
- object engine = SapGuilRot.GetType().InvokeMember("GetSCriptingEngine", System.Reflection.BindingFlags.InvokeMethod,
- null, SapGuilRot, null);
- sapGuiApp = engine as GuiApplication;
- GuiConnection connection = sapGuiApp.Connections.ElementAt(0) as GuiConnection;
- foreach (GuiSession child_session in connection.Children)
- {
- GuiSession session = child_session as GuiSession; //connection.Children.ElementAt(0) as GuiSession;
- SapInfoItem sii = new SapInfoItem();
- sii.system_name = session.Info.SystemName;
- sii.client = session.Info.Client;
- sii.client = session.Info.Program;
- sii.screen_number = session.Info.ScreenNumber;
- sii.handle = session.ActiveWindow.Handle;
- sii.transaction = session.Info.Transaction;
- sapInfo.Add(sii.handle.ToString("X"), sii);
- }
- connection.CloseConnection();
- return sapInfo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement