Modify the QQ program

Source: Internet
Author: User
Tags strcmp strlen

Recently a net friend to quit QQ, want me to write a program to help him to the QQ quit, yesterday day was done, there is something useful to take out if I think I am very vegetables don't scold me: E

Main ideas:

FindWindow-> "Send Message" "View Message"

Modify the QQ Button,static,edit control

Modify the registry to run it automatically

The specific code is as follows:Char buttoncaption[4][20]={
"Chat log (&h)",
"Dialog mode (&t)",
"Cancel Send (&c)",
"Send Message (&s)"
};
HWND Wndhandle;
HWND Wndedit;
HWND Static_c[11];//static's HWND because a lot of uncertainty set up 11
HWND Button_c[6];//button HWND View message 4 send messages 6 so take 6
Wndhandle =:: FindWindow (NULL, "view Message");
:: SetWindowText (Wndhandle, "chatting is really painful ah");
if (Wndhandle!= NULL) {

Start to fix edit////////////////////.
Wndedit =:: FindWindowEx (Wndhandle,null, "Edit", "");
Class name Caption
:: EnableWindow (Wndedit, false);
Edit is buttoned up/////////////////////
Start to fix button//////////.
for (int i = 0; i < 4; i++) {
Button_c[i] = FindWindowEx (wndhandle,null, "button", Buttoncaption[i]);
}
for (i = 0; i < 4; i++) {
:: EnableWindow (Button_c[i],false);
}
Button± was taken care of///////////

Start to fix static/////////////.
Static_c[0] = NULL;
int n=0;
for (i = 1; i < i++) {
Static_c[i] = FindWindowEx (wndhandle,static_c[i-1], "static", NULL);
When the second argument is null, FINDWINDOWEX returns the same value, so the last HWND was taken as a parameter
You can get all the static HWND
}
for (i = 1; i < i++) {
Char caption[100];
:: GetWindowText (STATIC_C[I],CAPTION,100);
if (strcmp (caption, "qq#:")!= 0 &&
STRCMP (Caption, "nickname:")!= 0 &&
STRCMP (Caption, "Email:")!= 0 &&
STRCMP (Caption, "Press CTRL + RETURN key to send Message")!= 0) {
static_index[n++] = i;
}
Get rid of the change.
}
for (i = 1; I <= 4; i++) {
int index = static_index[i-1];
if (Index < 0 | | Index > 10)
Continue
int dlgindex =:: GetDlgCtrlID (Static_c[index]);
:: Setdlgitemtext (Wndhandle,dlgindex,s[i-1]);
}
:: InvalidateRect (Wndhandle,null,false);
for (i = 1; I <= 4; i++) {
:: UpdateWindow (Static_c[static_index[i-1]]);
}
Static± was taken care of.///////////////////
}

Modify the registration form as follows:

Char path[50];
:: GetCurrentDirectory (50,path);
strcat (path, "\ n quit the bad habit of QQ chat");
Lpbyte path_set = pchar_to_lpbyte (path);
DWORD type = REG_SZ;
DWORD cbdata = strlen (path) +1;
HKEY hkey;
LPCTSTR Data_set = "software\\microsoft\\windows\\currentversion\\run\\";
Long ret_0 =:: RegOpenKeyEx (HKEY_LOCAL_MACHINE,
			Data_set,
			0,
			key_all_access,
			&hkey);
	Long ret_1 =:: RegSetValueEx (hkey,
					"Badqq",
					0,
					type,
					path_set,
					cbdata);
: RegCloseKey (hkey);
Lpbyte Cshitdlg::p char_to_lpbyte (char* str)
{
	lpbyte lpb=new byte[strlen (str) +1];
	for (int i=0 i < strlen (str); i++)
		lpb[i]=str[i];
	Lpb[strlen (str)]=0;
	return LPB;
}

(End of full text)

This article supporting source code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.