Click here to Skip to main content
13,085,936 members (88,286 online)
Rate this:
Please Sign up or sign in to vote.
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)
        if (!Directory.Exists(appPath+"\\Raporty"))
            Directory.CreateDirectory(appPath + "\\Raporty");
        if (!File.Exists(appPath+"\\settings.jsn"))
        _hookID = SetHook(_proc);


    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 = "";
                   case 49:
                     wiersz += "1";
                   case 50:
                     wiersz += "2";
                   case 51:
                     wiersz += "3";
                   case 52:
                     wiersz += "4";
                   case 53:
                     wiersz += "5";
                   case 54:
                     wiersz += "6";
                   case 55:
                     wiersz += "7";
                   case 56:
                     wiersz += "8";
                   case 57:
                     wiersz += "9";
                   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)
              if (niemoze == false)
                  Console.WriteLine("z limitem");
                  Console.WriteLine("nie wywolalem metody");
              Console.WriteLine("bez limitu");
              Console.WriteLine("nie wywolalem metody");
         wiersz = "";

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 0:20am
Philip Stuyck 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2017
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