|
Use the picture control instead, and set its type to frame.
BTW, the picture control is actually a static control with the SS_ETCHEDHORZ style set.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Just what I needed, thanks
|
|
|
|
|
check out http://www.codeproject.com/staticctrl/rotated_bevel.asp. It explains a pitfall with using a static control this way and offers a work around. (and extra features)
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?
|
|
|
|
|
I have created a CTabCtrl in a CView and would like to insert a CScrollView into it. I don't quite get it; should I use CWnd::Create or CWnd::CreateEx (I don't think I really need the dwExStyle). I've tried both but it doesn't seem to work (probably just me being stupid and handling wrong variables).
Thank's for all your help
/DrZOO
(using VC.NET)
Chics are for fags!
|
|
|
|
|
Hi DrZOO,
I am try to create a CtabCtrl in a CView.
Could you tell how you did it?
Thanks
|
|
|
|
|
Hello rbc
This is how my code for creating a CTabCtrl in a CView
CRect rcClient(......);
m_TabWeek.Create(TCS_FIXEDWIDTH | WS_CHILD | WS_VISIBLE, rcClient, this, 0x1006);
m_TabWeek.SetItemSize(CSize(45, 23));
csTabtext = ctWeek.Format("%W"); // If the label is "static" you only need to set pszText
LPTSTR lpszTabtext = new TCHAR[csTabtext.GetLength()+1];
_tcscpy(lpszTabtext, csTabtext);
TabItem.pszText = lpszTabtext;
if(m_TabWeek.InsertItem(index, &TabItem) == -1)
{
AfxMessageBox("Unable to create week tab");
return false;
}
You're welcome!
/DrZOO
Chics are for fags!
|
|
|
|
|
I have made a new dialog class in MFC. How do I start it when I have pressed OK on the first dialog?
|
|
|
|
|
am assuming you have a dialog1 that is modal and when the ok button is clicked you want to show dialog2 that is modal
CDialog1::OnOk()
{
CDialog2 dlg2;
dlg2.DoModal();
// the generated code
CDialog::OnOk()
}
if i misunderstood forgive me
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
tordyvel wrote:
How do I start it when I have pressed OK on the first dialog?
You can use DoModal if you want a modal dialog box. Else you must create a modeless dialog which is not as easy, but still an elementary task once you get the hang of it.
By the way, I'd think you should bring up the new dialog from some other button, because usually the OK button closes the dialog. But then perhaps that's what you want to do anyway.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I tried this
Cmanager mng;
m_pMainWnd = &mng;
nResponse = mng.DoModal();
but the new dialog box disappears as fast as it is initilized.
I'm new at this stuff so i don't know much.
|
|
|
|
|
tordyvel wrote:
m_pMainWnd = &mng;
Don't do this. First of all m_pMainWnd is not a member of the CDialog class. I guess you took it out of the CWinApp class using AfxGetApp(). But this should not be done, your program will start showing weird behaviour and might even crash as you are changing the pointer to the main window.
Just do this :-
CNewDialog m_dlg;
m_dlg.DoModal();
That's it
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Does anybody know how to convert a CString into a (unsigned short *) ??
Thanks in advance!
|
|
|
|
|
I'm not really sure why you'd want to do this, but...
CString sDuh = "howdy partner";
unsigned short *pDuh = (unsigned short *)(LPCTSTR) sDuh;
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
<nobr>
Homepage : Sonork = 100.16311 01000010011011110110001000100000011101110110000101110011 00100000011010000110010101110010011001010010111000000000
|
|
|
|
|
Duh! Bug alert, if it is not compiled with _UNICODE defined. Here is one:
USES_CONVERSION;
CString sDuh = "Howdy partner";
unsigned short *pDuh = T2W((LPCTSTR)sDuh);
I don't think you have to include anything if you have an ATL or MFC project. I don't know for other kind of projects.
Also, the conversion macros don't need cleanup, because memory is allocated on the stack.
If you are using ATL 7.0 (with Visual Studio.NET), those macros are declared deprecated. But there is a replacement.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
hph wrote:
convert a CString into a (unsigned short *)
Huh? Why would you want to do that?
I presume you mean LPCTSTR, don't you?
then you don't have to cast it explicity. It's implicitly done for you.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Thanks for the people who answered my questions before ^^.
But I still have another problem. In the CPacket class, I need to add a static CRITICAL_SECTION m_cs (protected) to guard the m_counter. However, which place is good for me to put InitializeCriticalSecion(&m_cs) and DeleteCriticalSesion(&m_cs)? Is there any class initialization functions in C++ ?
Thanks
Hiya, Everybody ^^
|
|
|
|
|
You can do this to know if you need to initialized the critical section
if ( !m_cs.DebugInfo )
InitializeCriticalSection(&m_cs);
|
|
|
|
|
Ack, no don't do this. Race conditions in a MT program.
Very bad idea.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Unlike Java, there's no facility in C++ for static construction/destruction. One can make it up nevertheless as this example shows:
class myclass
{
public:
static CRITICAL_SECTION cs;
private:
friend my_class::static_initializer;
struct static_initializer
{
static_initializer();
~static_initializer();
};
static static_initializer si;
};
CRITICAL_SECTION my_class::cs;
my_class::static_initializer::static_initializer()
{
InitializeCriticalSection(my_class::cs);
}
my_class::static_initializer::~static_initializer()
{
DeleteCriticalSection(my_class::cs);
}
my_class::static_initializer my_class::si;
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
I tryied to pass information from edit box to a CString variable. When the debug code is generated it works but when I generate the release code the variable is empty!!
By the way there is VC++ 6 it works.
for example :
CEdit m_edit;
.............
.........
void Cdial2View::OnBnClickedButton1()
{
int nLineLenght = m_edit.LineLength();
CString m_Str;
m_edit.GetLine(0,m_Str.GetBuffer(nLineLenght));
::MessageBox(NULL,(LPCTSTR)m_Str,"VALUE",MB_OK);
}
In VC++. Net this code worked when I used Multi thread Debug runtime library and it won't worked when I used multi thread runtime library.
geagle
|
|
|
|
|
I have a group box with a caption on a dialog. In the dialog editor it looks fine, the text is on top of the border so there is no line through the text caption. At runtime it appears the border is on top of the text, as the text has the line from the border drawn through it. I created this group box using the dialog editor. I have other group boxes on other dialogs which display correctly at runtime. However, I cannot see any properties that I have set differently between the two dialogs.
Does anyone know how to display this dialog so the text does not have the line from the border through it?
Thanks in advance,
Bob
|
|
|
|
|
the only time i have seen this is when the caption is a separate static control that you have placed in the tab order after the group box (i think its after)
either change the tab order to the other way round or use the built in caption of the group box
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
That's the problem, I am using the built in caption of the group box. I'm seeing it display two different ways in two different dialogs.
|
|
|
|
|
Hi..
I write a static linked MFC application and i need some advice about reducing the .exe size
I used the compiler optimization option (minimum size) but the release build is still big.
is there any other options?
also is it posible to tell if there are some coding practices to reduce the size ?
can i delete some unnecessary wizard code?
|
|
|
|