Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Runtime.InteropServices; // added for DllImport
- namespace ConsoleApp1
- {
- // definition of STARTUPINFO structure
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
- public struct STARTUPINFO
- {
- public uint cb;
- public string lpReserved;
- public string lpDesktop;
- public string lpTitle;
- public uint dwX;
- public uint dwY;
- public uint dwXSize;
- public uint dwYSize;
- public uint dwXCountChars;
- public uint dwYCountChars;
- public uint dwFillAttribute;
- public uint dwFlags;
- public ushort wShowWindow;
- public ushort cbReserved2;
- public IntPtr lpReserved2;
- public IntPtr hStdInput;
- public IntPtr hStdOutput;
- public IntPtr hStdError;
- }
- class Program
- {
- // Import
- [DllImport("kernel32.dll", SetLastError = true, EntryPoint = "GetStartupInfoA")]
- public static extern void GetStartupInfo(out STARTUPINFO lpStartupInfo);
- static void Main(string[] args)
- {
- STARTUPINFO sui;
- sui.dwFlags = 0x00000800; // STARTF_TITLEISLINKNAME
- GetStartupInfo(out sui);
- System.Console.Write(sui.lpTitle);
- System.Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment