Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows Server Console
im having huge problem with application i made for windows server 2008 R2.
 
The application works on .NET framework 3.5, and as far as i know windows server 2008 R2 contains such a framework.
 
Application itself is pretty massive, it is a server program for registering employees work time, by barcode scanner, then store it in .xml file, it also does update itself from update.xml file every few minutes.
 
To avoid having this application in focus all the time i used some methods to capture keypressed without focus on application.
 
So to the base of my problem, application is launching properly, it is also reading codes properly and identyfiing them, but application is apparently having prolem with "break:" and "return", and it simply does not launch one of my methods inside of my program. (it is simple static void method without any arguments)
 
Do i have to rewrite whole program to make it work without calling mehtods and all breaks and returns? Or what is the problem. This is quite important for me, deadline is more or less today. I could also add that this application is working perfectly fine on other pc's, and when im debuggin i on my pc, it also works as intented.
 
I won't post whole code here, it is simply too massive, but i can post parts of it to help you guys.
 
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)
 

Few more Ifs after that and
 
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;
 

 
This is where is the problem, application goes to this moment "Console.WriteLine("bez limitu");" and thats it, it doesn't launch "asdf" method, it also doesn't go for wiersz = "";
 
I would appricaite any help, if u have any more questions, wants me to specify some things just tell.
 
PS. Im using VS 2010 Express, if u think that u can help me, i could send u entire solution.
Posted 3-Sep-12 1:20am
Comments
Philip Stuyck at 3-Sep-12 7:55am
   
Isn't there some kind of exception being thrown by the application ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Maciej Los 285
2 Sergey Alexandrovich Kryukov 230
3 Shweta N Mishra 186
4 Aajmot Sk 153
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100