English 中文(简体)
• 如何在背景中应用网。
原标题:How to run a .NET console application in the background

我在C#中写了一幅ole光申请,该申请计划每15分钟开一次,或者使用已建的Windows 任务表。

每当它运行时,黑色哥塞罗箱就在执行期间pop,然后关闭。 我没有写过任何东西。 是否有办法使这种情况发生?

最佳回答

容易!

似乎难以相信,但它是一家药店。 当你想在没有任何迹象的情况下履行习俗任务时,我就利用了这些项目。

  • Create the project as a Windows application project (this is the hard part).
  • 从来没有发出任何形式的呼吁。 就像在您的假释申请中一样,保持公正。

    class Program
    {
        static void Main(string[] args)
        {
            // Just don t call Application.Run(new frmMain(args));
    
            // ... your code
        }
     }
    

This is because windows application projects are no really different than console, except because of the first form and references. It is totally hidden execution. Try it!

问题回答

Project > Property> Application tab > change Output category to "Windows application.

没有一个更方便的窗口。


Update for .NETCore aka .NET5+: edit the project file and change OutputType to WinExe

您可使用Windows AP来尽量减少ole子。 否则,你就可以将其编成一个视窗EXE文档,实际上不装一个表格,也不打上<编码>System.Windows.Forms.Application.Run()

• 《刑法》:

[DllImport( "user32.dll" )]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

public const int SW_SHOWMINIMIZED = 2;

IntPtr winHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
ShowWindow(winHandle, SW_SHOWMINIMIZED);

在窗户服务中安装 app子有什么意义? 你们可以将间隔时间定为15分钟,并在时间上操作。

如果你已经安装了Windows Console服务器,那么你就可以简单地改变其视窗应用程序的输出类型。

Under your project: Go to Properties > Application Select "Windows Application" as the Output type.

这将是影响最小的,而且你可以把视窗工作队的表列机继续承担同样的任务。

If it doesn t write anything to the console you could make it a service. http://msdn.microsoft.com/en-us/library/9k985bc9%28VS.80%29.aspx

只有在计划与目前gged的同一用户一样运行时,才会显示。 在机器上创建另一个用户,其密码长得可笑,使它成为署长(如果需要的话),并安排工作与用户一样。

这是容易的。 规定在不属于你的记录账户下经营的任务。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...