|
Just be careful with A2W() because it uses the stack for the conversion, so it's very dangerous to use in loops or with large strings. If you use VC7, try to take a look at CA2W(), it uses the heap (if needed), and is safe to use in loops
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
When I create a new dialog class and display it with the DoModal() command, I can't interact with anything else on the screen until I close the dialog. How do I create a dialog that will stay up on the screen and allow me to still access everything else (menus, etc in my actual MDI, SDI application). Similar to the properties dialog in visual studio.
|
|
|
|
|
A Modal dialog locks down the user interface until the user exits the dialog. When you call DoModal, you are creating a Modal dialog.
You want to create a Modeless dialog. You can do this by declaring an instance of your dialog, calling the Create method, then calling the ShowWindow method and setting the dialog to visible.
When you want this dialog to disappear, you can call ShowWindow again to hide the dialog.
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!
|
|
|
|
|
try to create the dialog object using the create command(supplying the parent handle). This creates a Modalless dialog box
|
|
|
|
|
http://www.codeproject.com/useritems/gettingmodeless.asp
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I want to add a variable for an edit box. But the only choices are CString, int, long, UINT... is there some way I can have the variable be a float or a double?
|
|
|
|
|
Yep! Do it the real way . Tell ClassWizard to use a Control instead of a Variable, and then manipulate the CEdit directly. You will need to call its SetWindowText() and GetWindowText() functions and do the appropriate float <-> string conversions.
cheers,
swinefeaster
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Anyone know of the "right" way to format a number in C++ (i.e. using STL)
I have looked up the locale and facet classes but have yet to find an obvious answer/example for some like converting the number 1232344 into "1,232,344"
Any help would be greatly appreciated !
Thanks
|
|
|
|
|
This is one of the most intricate aspects of C++, and it involves locales, which are very often skipped in most books, even Stroustrup's "The C++ Programming Language". this Usenet post shows how to do it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Hi,
I am very new to C++ & have again come unstuck!
I am trying to copy a file from a file selected from an open file dialog to a fixed location & name. The from (open dialog etc) works fine but the destination part dose not:
CopyFile(m_File_In, "c:\\osc_out\\logo.*", FALSE);
I guess this is becouse my destination is not 'null terminated'?
I still get problems if i try:
CString m_File_Out;
m_File_Out="c:\\osc_out\\logo.*";
CopyFile(m_File_In, m_File_Out, FALSE);
If this is becouse it is not null terminated how do i do that?
Thanx
An Expert is somone who has previously made ALL the Mistakes, I dream of this day. - Lucky
|
|
|
|
|
You can only copy one file at a time. Wild card characters are not valied (*).
declaring a string in quotes "", the compiler automatically NULL terminates it for you. Besides you are using a CString so that would NULL terminate it as well.
You will need to change:
m_File_Out="c:\\osc_out\\logo.*";
To something else like:
m_File_Out="c:\\osc_out\\logo.bmp";
Or whatever file type it is because the asterisk (*) is not a legal character to use in a file name.
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!
|
|
|
|
|
Thank you v.much. I will try that.
Thanx again,
Lucky
An Expert is somone who has previously made ALL the Mistakes, I dream of this day. - Lucky
|
|
|
|
|
To expand on what kilowatt said, you can use the splitpath() function to get the file extension from m_File_In.
HTH
---
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?
|
|
|
|
|
Thank you v.much, thats the answer i was lookin for. I will try that.
Thanx again,
Lucky
An Expert is somone who has previously made ALL the Mistakes, I dream of this day. - Lucky
|
|
|
|
|
How do I create a horizontal line on a dialog box? Much like the horizontal line you can add to a menu. I've tried using a group box without caption text with a width of 1. The result is each end has one pixels worth of a corner which is not desirable.
Thanks in advance,
Bob
|
|
|
|
|
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.
|
|
|
|