 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 23, 2008 2:10 pm Post subject: hiding questions |
|
|
How does an application hide the GUI, so that it doesn't have tab in the toolbar, but in the bottom right, it has an icon where it has options, like: Open, Exit, Save, New, etc. Also, how do you unlink a process so that it's hidden, and what other ways can you make a process hidden. And how do you make custom right click menus? So like if someone is running your application and they right click, you have a menu you created, _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
Last edited by oib111 on Mon Jun 23, 2008 9:24 pm; edited 1 time in total |
|
| Back to top |
|
 |
jackyyll Expert Cheater
Reputation: 0
Joined: 28 Jan 2008 Posts: 143 Location: here
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Jun 23, 2008 3:49 pm Post subject: |
|
|
Hiding the GUI is easy, just call ShowWindow with the nShowCmd parameter being SW_HIDE
To Create a system tray icon:
NOTIFYICONDATA (MSDN)
Shell_NotifyIcon (MSDN)
To Create a context menu for the tray icon:
CreatePopupMenu (MSDN)
AppendMenu (MSDN)
TrackPopupMenu (MSDN)
DestroyMenu (MSDN)
Code snippet:
| Code: | #define TRAY_RESTORE 2000
#define TRAY_EXIT 2001
void ShowContextMenu()
{
POINT pt;
GetCursorPos( &pt );
HMENU hMenu = CreatePopupMenu();
if ( hMenu )
{
AppendMenu( hMenu, MF_BYPOSITION, TRAY_RESTORE, _T("Restore") );
AppendMenu( hMenu, MF_SEPARATOR, 1, 0 );
AppendMenu( hMenu, MF_BYPOSITION, TRAY_EXIT, _T("Exit") );
SetForegroundWindow( hWnd );
TrackPopupMenu( hMenu, TPM_BOTTOMALIGN, pt.x, pt.y, 0, hWnd, NULL );
DestroyMenu( hMenu );
}
} |
Then in your window procedure (WM_COMMAND) filter for the Id's (TRAY_RESTORE/TRAY_EXIT).
You can use this method exactly the same for custom right clicks.
Because when u create a system tray icon you define its personal message, where in that message you filter
| Code: | case WM_SYSTRAYMSG:
switch ( LOWORD(lParam) )
{
case WM_RBUTTONDOWN:
case WM_CONTEXTMENU:
ShowContextMenu();
break;
}
break; |
while as if you want to do just a custom right click you can either filter directly from your window (WM_CONTEXTMENU/WM_RBUTTONDOWN) or you can filter through notifications on certain objects (WM_NOTIFY)
Finally to hide your process you have to use the Direct Kernel Object Manipulation (DKOM) method. Search around.
Hope this helped. _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 23, 2008 7:10 pm Post subject: |
|
|
Ok. Well if I wanted to hide it and then add it to the tray:
| Code: |
#define SYSTRAY 100
NOTIFYICONDATA nid;
nid.hWnd = hwnd;
nid.uID = SYSTRAY;
ShowWindow(hwnd, SW_HIDE);
Shell_NotifyIcon(NIM_ADD, &nid);
|
Right? _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Jun 23, 2008 8:10 pm Post subject: |
|
|
| Code: | nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hWnd;
nid.uID = LBOT_SYS_TRAY;
nid.uFlags = NIF_MESSAGE | NIF_TIP | NIF_ICON;
nid.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(IDI_ICON1) );
nid.uCallbackMessage = WM_LBOTSYSTRAY; |
This is how you should fill the structure (taken from lBot 1.9 Source)
IDI_ICON1 is an icon i added to a resource file.
Then if you want it ot have a tooltip you gotta copy the string to the struct like this (also taken from my bot, Note: This is looped that is why i am using NIM_MODIFY just copy the string to nid.szTip when your initializing the rest of the struct and call it with NIM_ADD if you don't plan to modify the tooltip.)
| Code: | TCHAR tszTip[260];
wsprintf( tszTip, _T("lBot 1.9.0\nHWND: %s\nStatus: %s"),
hMaple ? _T("MapleStory") : _T("Nothing"),
CheckStatus() ? _T(" Botting") : _T(" Nothing") );
_tcscpy_s( nid.szTip, _ARRAYSIZE(tszTip), tszTip );
Shell_NotifyIcon( NIM_MODIFY, &nid );
Sleep( 1000 ); |
Essentially though, yes, Hide the window and then create the system tray icon.
Extra Note:
Remember to call SetForegroundWindow to your main window that your restoring before u call ShowWindow with the parameter being SW_RESTORE _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 23, 2008 8:28 pm Post subject: |
|
|
My code:
| Code: |
#include <windows.h>
#define SYSTRAYMSG WM_USER+0x0300
#define SYSTRAY 100
#define RESTORE 101
#define EXIT 102
void CreateIcon() {
NOTIFYICONDATA nid;
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hwnd;
nid.uID = SYSTRAY;
nid.uFlags = NIF_MESSAGE;
ShowWindow(hwnd, SW_HIDE);
Shell_NotifyIcon(NIM_ADD, &nid);
}
void ShowMenu() {
POINT point;
GetCursorPos(&point);
HMENU hMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING, RESTORE, "Restore");
AppendMenu(hMenu, MF_SEPERATOR, 1, 0);
AppendMenu(hMenu, MF_STRING, EXIT, "Exit");
SetForegroundWindow(hwnd);
TrackPopupMenu(hMenu, TPM_BOTTOMALIGN, point.x, point.y, 0, hwnd, NULL);
DestroyMenu(hMenu);
}
//coding
case SYSTRAYMSG:
switch(LOWORD(wParam)) {
case RESTORE:
SetForegroundWindow(hwnd);
ShowWindow(hwnd, SW_NORMAL);
break;
case EXIT:
PostQuitMessage(0);
}
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
Last edited by oib111 on Mon Jun 23, 2008 8:42 pm; edited 2 times in total |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Jun 23, 2008 8:33 pm Post subject: |
|
|
| oib111 wrote: | Don't I have to define the message?
| Code: |
#define WM_SYSTRAYMSG WM_USER+0x0300
|
|
Yes _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 23, 2008 8:43 pm Post subject: |
|
|
Btw, a tooltip in this case would be like when they hover their mouse over it, it would say something like "Status: , Percent: , etc" (Just an example, could be anything right?) _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Jun 23, 2008 8:49 pm Post subject: |
|
|
| oib111 wrote: | My code:
| Code: |
#include <windows.h>
#define SYSTRAYMSG WM_USER+0x0300
#define SYSTRAY 100
#define RESTORE 101
#define EXIT 102
void CreateIcon() {
NOTIFYICONDATA nid;
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hwnd;
nid.uID = SYSTRAY;
nid.uFlags = NIF_MESSAGE;
ShowWindow(hwnd, SW_HIDE);
Shell_NotifyIcon(NIM_ADD, &nid);
}
void ShowMenu() {
POINT point;
GetCursorPos(&point);
HMENU hMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING, RESTORE, "Restore");
AppendMenu(hMenu, MF_SEPERATOR, 1, 0);
AppendMenu(hMenu, MF_STRING, EXIT, "Exit");
SetForegroundWindow(hwnd);
TrackPopupMenu(hMenu, TPM_BOTTOMALIGN, point.x, point.y, 0, hwnd, NULL);
DestroyMenu(hMenu);
}
//coding
case SYSTRAYMSG:
switch(LOWORD(wParam)) {
case RESTORE:
SetForegroundWindow(hwnd);
ShowWindow(hwnd, SW_NORMAL);
break;
case EXIT:
PostQuitMessage(0);
}
break;
|
|
RESTORE and EXIT are filtered through WM_COMMAND
| Code: | case WM_LBOTSYSTRAY:
{
switch ( LOWORD(lParam) )
{
case WM_LBUTTONDBLCLK:
SetForegroundWindow( hWnd );
SysTray( FALSE );
break;
case WM_RBUTTONDOWN:
case WM_CONTEXTMENU:
ShowContextMenu();
break;
}
break;
}
...
...
case WM_COMMAND:
switch ( LOWORD(wParam) )
{
/** SysTray **/
case LST_EXIT: DestroyWindow( hWnd ); SysTray( FALSE ); break;
case LST_RESTORE: SysTray( FALSE ); break;
case LST_SETTING: _CreateThread(OpenSettings); break; |
This is how it looks in mine.
| oib111 wrote: | | Btw, a tooltip in this case would be like when they hover their mouse over it, it would say something like "Status: , Percent: , etc" (Just an example, could be anything right?) |
Yep. _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 23, 2008 9:00 pm Post subject: |
|
|
What is the LOWORD in lParam? _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Jun 23, 2008 9:09 pm Post subject: |
|
|
| oib111 wrote: | | What is the LOWORD in lParam? |
| Quote: | | LOWORD(lParam) contains notification events, such as NIN_BALLOONSHOW, NIN_POPUPOPEN, or WM_CONTEXTMENU. |
Taken from NOTIFYICONDATA (MSDN) Link at uCallbackMessage _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 23, 2008 9:19 pm Post subject: |
|
|
Oh ok. So here's my finalized code. Btw, what message is called when the user hit's the minimize button? I want to hook it so that when they do that it hides the window and sends it to the systray.
| Code: |
#include <windows.h>
#define SYSTRAYMSG WM_USER+0x0300
#define SYSTRAY 100
#define RESTORE 101
#define EXIT 102
void CreateIcon() {
NOTIFYICONDATA nid;
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hwnd;
nid.uID = SYSTRAY;
nid.uFlags = NIF_MESSAGE;
nid.uCallbackMessage = SYSTRAYMSG;
ShowWindow(hwnd, SW_HIDE);
Shell_NotifyIcon(NIM_ADD, &nid);
}
void ShowMenu() {
POINT point;
GetCursorPos(&point);
HMENU hMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING, RESTORE, "Restore");
AppendMenu(hMenu, MF_SEPERATOR, 1, 0);
AppendMenu(hMenu, MF_STRING, EXIT, "Exit");
SetForegroundWindow(hwnd);
TrackPopupMenu(hMenu, TPM_BOTTOMALIGN, point.x, point.y, 0, hwnd, NULL);
DestroyMenu(hMenu);
}
//coding
case SYSTRAYMSG:
switch(LOWORD(lParam)) {
case WM_LBUTTONDBLCLICK:
SetForegroundWindow(hwnd);
ShowWindow(hwnd, SW_RESTORE);
break;
case WM_CONTEXTMENU:
ShowMenu();
break;
}
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case RESTORE:
SetForegroundWindow(hwnd);
ShowWindow(hwnd, SW_RESTORE);
break;
case EXIT:
PostQuitMessage(0);
break;
}
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Jun 23, 2008 9:30 pm Post subject: |
|
|
WM_SIZE is the message sent when a window minimizes, maximizes, restores, etc.
| Code: | (WinUser.h)
/*
* WM_SIZE message wParam values
*/
#define SIZE_RESTORED 0
#define SIZE_MINIMIZED 1
#define SIZE_MAXIMIZED 2
#define SIZE_MAXSHOW 3
#define SIZE_MAXHIDE 4 |
so in your windows procedure, just filter for WM_SIZE like so:
| Code: | case WM_SIZE:
if ( wParam == SIZE_MINIMIZED )
CreateIcon();
break; |
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 23, 2008 10:38 pm Post subject: |
|
|
Hey. I can't filter out WM_CONTEXTMENU or load an icon. Am I doing something wrong.
| Code: |
nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
| Code: |
case SYSTRAYMSG:
switch(LOWORD(lParam)) {
case WM_CONTEXTMENU:
ShowMenu();
break;
}
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|