This application has failed to start because the application configuration is incorrect...



  • Hallo

    Ich bekomme beim starten meiner Applikation (auf einer 2. Maschine wo kein .NET Framework drauf ist) immer den im titel genannten Fehler.

    Ich benutze aber in meinem Code keine Teile des .NET Frameworks.
    An was kann das ganze liegen?

    // Window_Disabler.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    #include <stdlib.h>
    #include <windows.h>
    #include "winuser.h"
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	//Variabeln
    	char WindowName[8]={'N','o','t','e','p','a','d'};
    
    	HWND  WindowHandle = ::FindWindow(NULL, (LPCWSTR)WindowName);	// Handle des Hauptfensters
    	HMENU MenuHandle;												// Handle des Menus
    	HMENU SubMenuHandle;											// Handle des SubMenus
    	MENUBARINFO  mbi;												// Informationen der Hauptmenubar
    	int iMenuID;													// ID des Menuelementes
    	LPMENUINFO lpmci = new MENUINFO;								// Information des Menus
    	LPMENUITEMINFO mInfo = new MENUITEMINFO;						// Information des Menuitems
    
    	/*  Console Header */
    	printf("                * * * * * * * * * * * * * * * * * * * * * * * * * \n");
    	printf("                 * * * * * * * * Window Disabler * * * * * * * * * \n");
    	printf("                * * * * * * * * * * * * * * * * * * * * * * * * * \n");
    	printf("                 * * * * * © 2010 Roche Diagnostics AG * * * * * * \n");
    	printf("                * * * * * * * * * * * * * * * * * * * * * * * * * \n\n\n");
    
    	/* MAIN ROUTINE */
    
    	//~ Step 1: Get the Windowhandle
    	printf(" -> Entering Phase 1...\n");
    	if (WindowHandle == NULL)
    	{
    		//Debug Ouput
    		printf(">> WindowHandle not found! Handle is NULL (%d) <<\n", WindowHandle);
    		system("PAUSE");	//debug session
    		return 0;
    	}
    
    	//~ Step 2: Get the Menuhandle
    	printf("WindowHandle has been found...\n -> Entering Phase 2...\n");
    	MenuHandle = GetMenu(WindowHandle);
    	if (MenuHandle==NULL)
    	{
    		//Debug Ouput
    		printf(">> Menuhandle not found! Handle is NULL (%d) <<\n", MenuHandle);
    		system("PAUSE");	//debug session
    		return 0;
    	}
    
    	//~ Step 3: Gathering some informations
    	printf("MenuHandle has been found...\n -> Entering Phase 3...\n");
    	GetMenuBarInfo(WindowHandle, OBJID_MENU, 0,  &mbi);
    	mInfo->cbSize = sizeof(MENUITEMINFO);
    	printf("Size of MenuInfo -> %d", mInfo->cbSize);
    
    	//~ Step 4: Get the SubMenu Handle
    	printf("Gathered all the informations, I needed...\n -> Entering Phase 4...\n");
    	SubMenuHandle = GetSubMenu(MenuHandle, 2);	// Der Index des MenuPunktes -> Index = Zero-Based
    	iMenuID = GetMenuItemID(SubMenuHandle, 79);	// Der Index dex ContextMenuPunktes -> Index = Zero-Based
    	if (SubMenuHandle == NULL)
    	{
    		printf(">> SubmenuHandle not found! Handle is NULL (%d) <<\n", SubMenuHandle);
    		system("PAUSE");	//debug session
    		return 0;
    	}
    
    	//~ Step 5 (FINAL Step): Disable the Menu-Entry
    	printf("SubmenuHandle has been found...\n -> Entering final Phase (5)...");
    	EnableMenuItem(SubMenuHandle, iMenuID, MF_GRAYED);
    
    	system("PAUSE");	//debug session
    	return 0;
    
    }
    

    Gruss,
    Peach_

    PS: Komischerweise kann ich das ganze nicht in DevC++ kompilieren. Fehler -> "
    [Linker error] undefined reference to `WinMain@16'
    "



  • Kann geschlossen werden.

    Ich hatte ne falsche Main-Methode beim DevC++..
    nun klappts. 😉

    int main(int argc, char *argv[])
    

Anmelden zum Antworten