|
When a window is created, you get a window handle (HWND).
You can use that handle in a call to SetWindowText():
::SetWindowText(hwnd, _T("My Window Title"));
If you're using MFC, and you've created your main window in
the usual way, you can use something like this:
if (AfxGetApp()->GetMainWnd())
AfxGetApp()->GetMainWnd()->SetWindowText(_T("My Window Title"));
No message handlers are necessary - just call it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank You, for ur helps, but just one more think, where should i insert your code.
I'm usinf MFC.
Ok i tried to put it as follow. but no changes
void CAutoView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
if (AfxGetApp()->GetMainWnd())
AfxGetApp()->GetMainWnd()->SetWindowText(_T("BIOHAZARD"));
}
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Ok i think that i have to put it into OnPaint() Funct. and now it works
Thank you again. God bless you
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Blood_HaZaRd wrote: Ok i think that i have to put it into OnPaint() Funct. and now it works
Hence, do you update the window caption each time the window is painted?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I know that is not a well done job but it's the only funct where it works. does it exist another one. ?
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
That should have worked.
Change the window title wherever it's appropriate.
Changing it in a view class' OnInitialUpdate() might not be appropriate unless
you want the title to change every time a new view of that class is created.
OnPaint() is a bad choice since you most likely don't need to set the title
every time the window needs repainting.
If you want one title for the lifetime of the app, you could do it
when the main window is created (generally in your CWinApp-derived class'
InitInstance() override).
Also, if you're using the doc view architecture, MFC, by default, will adjust
the title when the active view changes. To avoid this behavior, change
the frame window style to exclude the FWS_ADDTOTITLE style. For info on how
to do that, see How To Change Window Attributes in an MFC Application[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
although i am using .net c++, i want to run application while .net framework isn't installed on the another machine. anyone knows, is it possible?
thanks.
|
|
|
|
|
When you create the project, choose a Win32 application type.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
i tried and tested however it couldn't run. i changed framework configuration but not run agin. is it necessary to change any configuration?
|
|
|
|
|
darkonoid wrote: i tried and tested however it couldn't run. i changed framework configuration but not run agin. is it necessary to change any configuration?
You have to build a win32 unmanaged application, i.e. a native application, that doesn't need the framework at all. With C++ you can do this: On Visual Studio IDE, choose menu item File->New->Project and then, on the newly appeared window, for instance, Win32 project (or one using MFC ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
i see what you mention, but it doesn't work, that you tell
|
|
|
|
|
In fact it works as I told. I've done a lot of programs that way.
The only caveat maybe the runtime version: you have two options, link with the static version of the runtime (/MT option) of compiler command line or deploy the runtime DLL toghether with your application.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Any app you create with the .net framework is going to need the framework runtime. No way around that.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
i think, visual studio 6 isn't capable platform, do you recommend any platform or add-ins or plugins etc.?
|
|
|
|
|
darkonoid wrote: visual studio 6
You never mentioned it before. Yes, VS 6 is not capable.
darkonoid wrote: you recommend any platform
Yes, make the move to VS 2005/2008.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
how can i run applications any other windows versions, without .net framework
|
|
|
|
|
What is it you are trying to do? Are you trying to develop .net apps to run on any version of windows?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
i want to use .net platform but my applications can be run windows that isn't installed .net framework
|
|
|
|
|
darkonoid wrote: i want to use .net platform but my applications can be run windows that isn't installed .net framework
Like I already said earlier. You will need the .net framework installed in order for the apps to work, no real way around it. There are commercial products out there that for the money, just end up encapsulating the .net framework in the .exe. It is really not worth the money. Bear in mind that the .net framework runtime will not work on windows versions older than Windows 98.
I hope this answers your question.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
ok brother, do you recommend any platform for developing application?
|
|
|
|
|
I already told you, if you are going down the .net road, use VS 2005 or 2008.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
no, no i don't want to use .net
|
|
|
|
|
With the Standard edition of VS2005/2008, you can do native code using Win32 as well.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
|
darkonoid wrote: i am using .net c++
You just told me you don't want to use .net. Here you are saying you are using it. Make up your mind, then.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|