How to change a caption of any window
-
Hey every one... I have read and tested some stuff with "SetWindowText" and when i use SetWindowText i can change the caption of my appelcation, but I think it is possible to change window's caption of other programs.... i am not sure if it is SetWindowText(hWnd,"My Text"); but i used it and it gave me an eroor... so any help? thanks alot I am still a beginner ;)
-
Hey every one... I have read and tested some stuff with "SetWindowText" and when i use SetWindowText i can change the caption of my appelcation, but I think it is possible to change window's caption of other programs.... i am not sure if it is SetWindowText(hWnd,"My Text"); but i used it and it gave me an eroor... so any help? thanks alot I am still a beginner ;)
Hi. you can use Findwindow(wndclass,wndtetxt) API function to retrive the hwnd for any window, and then you can use SetWindowText function. . if you need some help contact me on faroq_tam2004@yahoo On Earth nothing impossible, while your mind running. Faroqtam
-
Hey every one... I have read and tested some stuff with "SetWindowText" and when i use SetWindowText i can change the caption of my appelcation, but I think it is possible to change window's caption of other programs.... i am not sure if it is SetWindowText(hWnd,"My Text"); but i used it and it gave me an eroor... so any help? thanks alot I am still a beginner ;)
Dody_DK wrote: ...but i used it and it gave me an eroor... My telepathy powers are weak today. Can you tell us what the error is?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Dody_DK wrote: ...but i used it and it gave me an eroor... My telepathy powers are weak today. Can you tell us what the error is?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
It will give me this error error C2065: 'hWnd' : undeclared identifier :sigh: hope you can help...
From where and how are you calling
SetWindowText()
?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
From where and how are you calling
SetWindowText()
?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
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?
-
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