作成したアプリケーションに大きな問題がありますwindows server 2008 R2.
アプリケーションは で動作し.NET framework 3.5
、私が知る限り、Windows Server 2008 R2 にはそのようなフレームワークが含まれています。
アプリケーション自体はかなり巨大で、従業員の勤務時間をバーコードスキャナーで登録し、. ファイルから、数分ごとにxml
自分自身を更新します。update.xml
このアプリケーションが常にフォーカスされないようにするために、いくつかの方法を使用して、アプリケーションにフォーカスせずに押されたキーをキャプチャしました。
したがって、私の問題の根底にあるのは、アプリケーションが適切に起動し、コードを適切に読み取って識別していることですが、アプリケーションは明らかに「break:」と「return」に問題があり、内部のメソッドの 1 つを起動しません。私のプログラムの。(引数なしの単純な static void メソッドです)
メソッドやすべてのブレークとリターンを呼び出さずに動作させるには、プログラム全体を書き直す必要がありますか? または何が問題なのですか。これは私にとって非常に重要です。締め切りは多かれ少なかれ今日です。また、このアプリケーションは他の PC でも問題なく動作しており、自分の PC でデバッグしているときも意図したとおりに動作することを付け加えることができます。
ここにコード全体を投稿することはしません。単に大きすぎるためですが、皆さんを助けるためにコードの一部を投稿できます。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.Xml;
using System.IO;
using System.Threading;
using System.Data;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using Microsoft.Win32;
using System.Reflection;
using System.Security.AccessControl;
static void Main()
{
var handle = GetConsoleWindow();
ShowWindow(handle, SW_HIDE);
appPath = Path.GetDirectoryName(Application.ExecutablePath);
if (AutoStarter.IsAutoStartEnabled == false)
{
AutoStarter.SetAutoStart();
}
if (!Directory.Exists(appPath+"\\Raporty"))
{
Directory.CreateDirectory(appPath + "\\Raporty");
}
if (!File.Exists(appPath+"\\settings.jsn"))
{
utworzsetting();
}
sprawdzostatniawersje();
uaktualnij();
_hookID = SetHook(_proc);
Application.Run();
UnhookWindowsHookEx(_hookID);
}
private delegate IntPtr LowLevelKeyboardProc(
int nCode, IntPtr wParam, IntPtr lParam);
private static IntPtr HookCallback(
int nCode, IntPtr wParam, IntPtr lParam)
{
if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
{
int vkCode = Marshal.ReadInt32(lParam);
switch (vkCode)
{
case 48:
wiersz = "";
break;
case 49:
wiersz += "1";
break;
case 50:
wiersz += "2";
break;
case 51:
wiersz += "3";
break;
case 52:
wiersz += "4";
break;
case 53:
wiersz += "5";
break;
case 54:
wiersz += "6";
break;
case 55:
wiersz += "7";
break;
case 56:
wiersz += "8";
break;
case 57:
wiersz += "9";
break;
case 13:
if (wiersz != null)
いくつかの「If」
そして最後に
if (aktualneID != -1) // Jezeli ID znajduje sie bazie danych
{
// MySettings settings = MySettings.Load(appPath + "\\settings.jsn");
if (settings.limit == true && lPracownik[aktualneID].Dni.Count != 0)
{
czymoze();
if (niemoze == false)
{
Console.WriteLine("z limitem");
asdf();
Console.WriteLine("nie wywolalem metody");
}
}
else
{
Console.WriteLine("bez limitu");
asdf();
Console.WriteLine("nie wywolalem metody");
}
}
}
wiersz = "";
zapiszbaze();
break;
default:
break;
これが問題です。アプリケーションはこの瞬間に進み"Console.WriteLine("bez limitu");"
、それだけです。" " メソッドを起動しませんasdf
。また、wiersz = "" にも進みません。
何かご不明な点がございましたら、お手数ですが教えていただければ幸いです。
PS。あなたが私VS 2010 Express
を助けることができると思うなら、私はあなたに完全な解決策を送ることができます。