|
What happens if you change the 'newtoolbar' variable type to CToolBar?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks for your reply.
Your method really works well. Here is my source codes:
//my program is based on MDI
newtoolbar.Create((CMainFrame*)(AfxGetApp()->GetMainWnd()),WS_CHILD | WS_VISIBLE | CBRS_TOP,NEWTOOLBAR);
newtoolbar.LoadToolBar(IDR_TOOLBAR1);
((CMainFrame*)(AfxGetApp()->GetMainWnd()))->RecalcLayout();
//where NEWTOOLBAR is the ID of the toolbar window,
//newtoolbar is a data class member of the "View" class,
//"IDR_TOOLBAR1 is" the resource id of the toolbar resource
Thanks again.
Maer
|
|
|
|
|
Ive been wanting to start becomming a better coder.
THere is so much out there and even on this site, im confused as to where even to start!
Ive bought books one C and read tutorials, and I am fairly familiar to c/c++, but when it comes to actually making something worthwhile, other than those stupid printf("hello world!\n");
things then i dont know where to start.
...
|
|
|
|
|
There are so many places you can go - are you wanting to write console programs rather than Windows ones ? If not, then you need to get a good book on MFC. What you probably need to do is decide what sort of program you will write, choose something simple and then learn whatever you need to get it done.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
How to show a window in full screen?
Thanks.
|
|
|
|
|
Not too hard. Look at the documentation for CreateWindowEx. For window styles, pass WS_POPUP | WS_VISIBLE. For the window width and height, give it the width and height of the entire screen. You can call SetWindowPos to get it positioned at 0, 0. The window will occupy the entire screen.
|
|
|
|
|
Also, more simply, use WS_MAXIMIZE for your window style.
CodeGuy
http://groups.yahoo.com/group/wtl
|
|
|
|
|
If you want your mainframe class to go fullscreen (like VC++ IDE does), check the KB article Q164162.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks for your reply.
I find the method you introduced to me works well. But I still have a question, that is, how to show a window maximized but not covering the task bar.
Thank again.
Maer
|
|
|
|
|
Hello...
I have to read a txt file (a csv file) and qhen I read one by one field, I can find fields that have different type (long, string, date etc...). So how can I do to convert a string that represent a date in a real date object?
Thanks to all You
Alessio Bulleri
a.bulleri@metodoshoes.it
norbland@lycos.it
|
|
|
|
|
If you are using MFC, you can use COleDateTime. It has a ParseDateTime function you can use to extract a date from a string.
|
|
|
|
|
thanks, You saved me ?????? (and in a very very quickly way and time)
Thanks
Alessio Bulleri
a.bulleri@metodoshoes.it
norbland@lycos.it
|
|
|
|
|
My program is not made to handle the "Large Fonts" option in Windows, and therefore when this options is used, things don't appear in lists and so on (Because the list sizes are fixed, and noscroll is enabled). Is it possible to force the font to a spesific size? I want the app to use "MS Sans Serif", size 8 no matter what the windows settings are...
Sprudling
|
|
|
|
|
Hi,
This is just something that a professional Windows developer has to deal with. Windows will scale everything differently based on large fonts. You aren't allowed to mess with this. The OS is doing it behind the scenes.
You have a few options:
1) Keep your lists the same size and rely on tooltips to show the whole item in the list when the user hovers over it.
2) Add scroll bars.
3) If your window is smaller than the screen size, consider adding resizing support such as the CResizeableDialog class by Paolo Messina (found on this site).
Good luck!
CodeGuy
http://groups.yahoo.com/group/wtl
|
|
|
|
|
Can somebody please tell me how to max/min toggle a view in a splitter?
Checkout
http://www.codeguru.com/mfc/comments/7113.shtml
to see an attempt by Kirk but his code will not solve this case:
Imagine a 2x2 splitter where the pane in row 2 col 2 is to be toggled to full view, that is the top left, top right and lower left should be hidden. Hiding them works fine, but when I wish to restore the hidden panes the views in the panes are swapped. And I can't seem to get around it.
|
|
|
|
|
afx_msg int CChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
CClientDC dc(this);
CFont font;
font.CreateFont(charHeight, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "MS Sans Serif");
//charheight is any number (usually 12)
dc.SelectObject(&font);
m_MyEdit.SetFont(&font);
...
}
This works fine on Win98, but on WinNT and Win2000 it seems like nothing happens. The default font (FixedSys) is being used instead. Why? And it's not only MyEdit, but all other childwindows: CStatic, CListCtrl, CEdit, CStatusBarCtrl, anything!
Please help me
|
|
|
|
|
You need to allocate the CFont object with the new operator (on the heap) and you need to maintain it for as long as you plan on using that font for those controls. Actually, I am surprised it works on Win98. Usually, I allocate fonts in my OnCreate or OnInitialize and destroy them in the OnDestroy or destructor.
|
|
|
|
|
You would not need to allocate the CFont object on the heap -- you could do on the stack as a class member variable. One less thing to worry about during cleanup. However, you still have to remember to call DeleteObject() in OnDestroy.
CodeGuy
http://groups.yahoo.com/group/wtl
|
|
|
|
|
You are absolutely right, it just needs to be persisted as long as it is being used.
I just like to have definitive control over all resource related functionality.
|
|
|
|
|
A global CFont object could do the job as well I guess then, but is that "good programming"?
Sprudling
|
|
|
|
|
No. Resources such as fonts should be tied to the lifetime of their windows. Also, you would not want to let other windows have the potential of fighting over the same global font variable.
CodeGuy
The WTL newsgroup: 860 members and growing ... http://groups.yahoo.com/group/wtl
|
|
|
|
|
The scenario is that I have a file xyz.ini and I want to make a backup of it called xyz.ini2 and then rewrite to xyz. I have tried CFile::Rename and CFile::Duplicate and I am getting "a sharing violation occured while accessing an unnamed file".
CFile temporiginifile;
temporiginifile.Open(m_sFileFullPathName,CFile::modeReadWrite|CFile::shareDenyNone);
temporiginifile.Rename(m_sFileFullPathName,m_sFileFullPathName+"2");
temporiginifile.Close();
Paradise is where I am.
Voltaire
|
|
|
|
|
Just use CopyFile API function. All you need to do is to pass the filenames.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks.
Paradise is where I am.
Voltaire
|
|
|
|
|