How to change a caption of any window
-
I creat a button, and from the classwizard I chose BN_Clicked and I add function. then I click edit code and write SetWindowText(hWnd,"My Text");... so it will be void CAdfadfhgDlg::OnButton1() { SetWindowText(hWnd,"My Text"); } I think i am doing something wrong... right?
Dody_DK wrote: I think i am doing something wrong... right? Right, you are doing something wrong. Simply remove the
hWnd
parameter. It's not needed since you are already in the context of the dialog. That will fix that particular compiler error.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Dody_DK wrote: I think i am doing something wrong... right? Right, you are doing something wrong. Simply remove the
hWnd
parameter. It's not needed since you are already in the context of the dialog. That will fix that particular compiler error.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Yeah I did that also, but this will change my applecation's Caption not the other applecation's caption... and this is what I want to change the Window title of other applecation.... is it possible?
Dody_DK wrote: is it possible? Yes, just call
FindWindow()
as has already been mentioned.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Dody_DK wrote: is it possible? Yes, just call
FindWindow()
as has already been mentioned.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
I did that also, but the same problem, only my applecation's caption will be changed, not others... void CAdfadfhgDlg::OnButton1() { HWND hwnd = ::FindWindow(NULL, "Title of program"); if (hwnd) { ::ShowWindow(hwnd, SW_SHOWDEFAULT); ::BringWindowToTop(hwnd); SetWindowText(hWnd,"My Text"); } hmm is there any thing wrong i am doing? thanks alot ;)
-
I did that also, but the same problem, only my applecation's caption will be changed, not others... void CAdfadfhgDlg::OnButton1() { HWND hwnd = ::FindWindow(NULL, "Title of program"); if (hwnd) { ::ShowWindow(hwnd, SW_SHOWDEFAULT); ::BringWindowToTop(hwnd); SetWindowText(hWnd,"My Text"); } hmm is there any thing wrong i am doing? thanks alot ;)
Unless the title of
CAdfadfhgDlg
is "Title of program", the code you have should work. Dody_DK wrote: SetWindowText(hWnd,"My Text"); I assume thathWnd
is supposed to behwnd
. Yes?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Unless the title of
CAdfadfhgDlg
is "Title of program", the code you have should work. Dody_DK wrote: SetWindowText(hWnd,"My Text"); I assume thathWnd
is supposed to behwnd
. Yes?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Yes hWnd = hwnd, but i deleted it also as you said and used
SetWindowText("My Text");
I have tried to do it with many programs.... but it didn't work...hmmmm I hope that you have other selution... thanks alot ;)Dody_DK wrote: SetWindowText("My Text"); This is obviously not going to work as the function is being called in the context of your dialog. The net result being that your dialog's caption gets changed. Perhaps you should explain what you are actually trying to do. If we knew the whole story, we could make more informed suggestions.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Dody_DK wrote: SetWindowText("My Text"); This is obviously not going to work as the function is being called in the context of your dialog. The net result being that your dialog's caption gets changed. Perhaps you should explain what you are actually trying to do. If we knew the whole story, we could make more informed suggestions.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
What I want to do is: A small change the caption of a specific program like MSN Messenger or yahoo or any thing else.... this is the whole story :) I am very thankful for your support and help ;)
Dody_DK wrote: A small change the caption of a specific program like MSN Messenger or yahoo or any thing else.... this is the whole story I Think this little Code Will help for chanfing yahoo or msn Messenger !
HWND hYahooWnd=::FindWindow("YahooBuddyMain",NULL); if(hYahooWnd) { ::SetWindowText(hYahooWnd,"alok Gupta"); } HWND hMSNWnd=::FindWindow("MSBLClass",NULL); if(hYahooWnd) { ::SetWindowText(hMSNWnd,"alok Gupta"); }
----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk -
Dody_DK wrote: A small change the caption of a specific program like MSN Messenger or yahoo or any thing else.... this is the whole story I Think this little Code Will help for chanfing yahoo or msn Messenger !
HWND hYahooWnd=::FindWindow("YahooBuddyMain",NULL); if(hYahooWnd) { ::SetWindowText(hYahooWnd,"alok Gupta"); } HWND hMSNWnd=::FindWindow("MSBLClass",NULL); if(hYahooWnd) { ::SetWindowText(hMSNWnd,"alok Gupta"); }
----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk