Thread: disabling button in another prog

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    4

    disabling button in another prog

    I recently downloaded the new MSN .NET Messenger. And frankly the block button cudn't be in a worse place. my friends keep on accidently pressing it.

    I was wondering how i cud disable the block button, preferably without actually patching the program, but instead by having another program running all the time to disable it. I was thinking if i cud get the handle of the button i cud use SendMessage() to disable the button. Or change the window class of the button so it is in a different position in the parent window.

    Cud sumone tell me if I am newhere near close to wot i wud have todo.

    Any suggestions are much apreciated.

    Cheers.
    Chris.

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    It's hard to tell if you could...hmmm...that could be something interesting to work on...I mean, I KNOW you probably could...unless they used a resource to make it...or VB...well, where there's a will there's a way...maybe I'll work on this...

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    OK, how do you make a button disabled...? lol

  4. #4
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    EnableWindow(); lol
    TNT
    You Can Stop Me, But You Cant Stop Us All

  5. #5
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Post Well, first start by..

    You would haveto find the handle of the block button first. Once you do, try:

    SendMessage(*Handle to block button*, WM_DISABLE, (LPARAM)0, (WPARAM)0);

    That might work. You just need to find the button's handle.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    4
    Yeah that's wot i thought, but just thinking about it now, wouldn't u need tot have the handle of the application sumwhere as well.

    Because just using SendMessage(*Handle to block button*, WM_DISABLE, (LPARAM)0, (WPARAM)0);

    wud be trying to send it to a control in my own app with that handle. or am i being stupid? or cud it be that u were thinking of patching the original messenger so this code is actually in the messenger executable file.

    chris.

  7. #7
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    I think you might have to pass the handle to the main window, and in wParam pass the handle to the button.

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    4
    OOO just had a very quick look at my API docs and thought it mite be better to use PostMessage.

  9. #9
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You can't stop another app processing its messages before yours.(as far as I know)


    Find an external resource editor , extracts the resource script of an .exe for editing.
    They are available to remove ads, ect from programs .
    If they have used a script you will be able to load their resources and move/remove/disable the button. Everybody will have to have your edit of the program though.

  10. #10
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339

    Cool OK, here we go

    I dug up some code i wrote a while ago that sent a destroy msg to another prog.

    This could i suspect be easily adapted to msns block button:

    HWND Control = FindWindow(NULL, "Program Title");
    SendMessage(Control, WM_DESTROY, wParam, lParam);

    Now thats pretty simple, i dunno but for a button you would use FindWindow with param 2 as the button caption, then do an enable window on it, somthing like this:

    //Get a handle to the button
    HWND Control = FindWindow(NULL, "Block");

    //disable the button
    EnableWindow(Control, FALSE);

    in theory that should work, but as msn dosnt have a button caption and uses and icon instead, i dunno but thats how it would work, if msn is written in c++ or somthing, but no vb as ken said....

    Hope that helps
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  11. #11
    Registered User
    Join Date
    Oct 2001
    Posts
    4
    That looks very interesting TNT, even if it won't work for this particualr problem. Mite have to start playing around with that now.

    Cheers.
    Chris

  12. #12
    Registered User WayTooHigh's Avatar
    Join Date
    Aug 2001
    Posts
    101
    i wrote this little Win32 Console program to show you how. it is designed for Yahoo Messenger, since i don't use MSN Messenger. it disables the Search button.

    when you open this program it searches for Yahoo Messenger. if its not open or the title of the window is different than "Yahoo Messenger". you get an error. if it is open it finds the Search button. and disables it.
    Code:
    #include<iostream.h>
    #include<windows.h> 
    
    BOOL CALLBACK EnumProc(HWND hwnd, LPARAM lParam)
    {
    	char wndtitle[255];
    
    	GetWindowText(hwnd, wndtitle, 254);
    
    	if(!strcmp(wndtitle, "&Search"))
    	{
    		EnableWindow(hwnd, FALSE);
    	}
    
    	return TRUE;
    }
    
    int main()
    {
    	HWND hYahoo;
    
    	hYahoo = FindWindow(0, "Yahoo! Messenger");
    
    	if(hYahoo == NULL)
    	{
    		cout<<"Yahoo! Messenger is not open or has a different title";
    
    		return 0;
    	}
    
    	EnumChildWindows(hYahoo, EnumProc, 0);
    	return 0;
    }
    i don't have much time. so repost if you dont understand.
    Last edited by WayTooHigh; 10-29-2001 at 03:42 PM.
    Sometimes, the farthest point from the center is the center itself.

    Your life is your canvas, it's only as beautiful as you paint it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Disabling a button
    By TheMajorRager in forum C# Programming
    Replies: 0
    Last Post: 10-14-2005, 05:09 PM
  2. writing text over a deleted button
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-02-2005, 11:32 AM
  3. Disabling a button
    By Devil Panther in forum Windows Programming
    Replies: 4
    Last Post: 07-07-2003, 02:08 PM
  4. Disabling "X" button on Window
    By Boomba in forum Windows Programming
    Replies: 3
    Last Post: 06-14-2003, 01:53 PM
  5. Disabling maximize button and movable border
    By Garfield in forum Windows Programming
    Replies: 6
    Last Post: 01-26-2002, 02:21 PM