// 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
//~ 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);
// 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
//~ 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);
// 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
//~ 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'
"
Nächstes Thema anzeigen Vorheriges Thema anzeigen
Sie können Beiträge in dieses Forum schreiben. Sie können auf Beiträge in diesem Forum antworten. Sie können Ihre Beiträge in diesem Forum nicht bearbeiten. Sie können Ihre Beiträge in diesem Forum nicht löschen. Sie können an Umfragen in diesem Forum nicht mitmachen.
c++.de ist Teilnehmer des Partnerprogramms von Amazon Europe S.à.r.l. und Partner des Werbeprogramms, das zur Bereitstellung eines Mediums
für Websites konzipiert wurde, mittels dessen durch die Platzierung von Werbeanzeigen und Links zu amazon.de
Werbekostenerstattung verdient werden kann.
Die Vervielfältigung der auf den Seiten www.c-plusplus.de, www.c-plusplus.info, www.c-sar.de, www.c-plusplus.net und www.baeckmann.de
enthaltenen Informationen ohne eine schriftliche Genehmigung des Seitenbetreibers ist untersagt
(vgl. §4 Urheberrechtsgesetz). Die Nutzung und Änderung der vorgestellten Strukturen und Verfahren in
privaten und kommerziellen Softwareanwendungen ist ausdrücklich erlaubt, soweit keine Rechte Dritter verletzt werden.
Der Seitenbetreiber übernimmt keine Gewähr für die Funktion einzelner Beiträge oder Programmfragmente, insbesondere
übernimmt er keine Haftung für eventuelle aus dem Gebrauch entstehenden Folgeschäden.