|
In dlgcore.cpp, function CDialog::DoModal():
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL); //Fails here
this is the first line of the function.
any thoughts??
thanks
|
|
|
|
|
When you wrote the CModemInterface class constructor, did you remember to call the default CDialog constructor, passing along the dialog template Id?
CModemInterface::CModemInterface (CStringArray *s, CWnd *pWnd)
: CDialog (CModemInterface::IDD, pWnd)
{
}
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
Does anyone know of a printf() replacement that will print numbers with commas? For example:
printf("Number is %D\n", num);
Number is 198,456
I need all the normal functionality of printf, but with the comma'd decimal numbers. I realize there are a lot of international concerns with commas, but those aren't an issue for my needs.
RZ
|
|
|
|
|
i don't think there is such an option - you'll have to do this one by-hand
-c
Cheap oil. It's worth it!
|
|
|
|
|
Yes, I know there is no option, that's why I'm looking for a printf replacement that does have it. Several years back I remember seeing some printf() like functions that did this and other fancy formating, but can not find them anywhere.
Doing a Google search for printf is not a pretty sight
|
|
|
|
|
For example:
#include <stdio.h>
#include <locale.h>
int main(void)
{
setlocale(LC_NUMERIC,"Spanish");
printf("%f\n",198.456);
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This isn't what I'm looking for. I want to print an integer number like:
100000
as
100,000
or
10000000
as
10,000,000
using a printf() like function that also works with the other printf formatting fields.
|
|
|
|
|
Oh, misunderstood your question, sorry.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Use the GetNumberFormat API, which returns a new string with commas/decmial points inserted. You can then use that string in your printf call.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
That is the function that I have been using, but it lakes the convenience of a good-ol simple printf. I have to allocate a return buffer, plus fill out a format structure. Nothing beats the single line of code that printf offers.
My task today is going to write a replacement for printf (sprintf actually) that does this formatting.
Thanks.
|
|
|
|
|
you can use the following function; it's not mine and I havent tried it to be honest but it looks persuasive "
// Function inputs a num with commas every 3 places
// e.g. for 1000, add_commas prints 1,000
//
// Program uses recursion (non tail end)z
#include <iostream.h>
void add_commas(int num,int count)
{
if(num < 10)
{
cout << num << endl; // num by now only 1 digit
return;
}
else
{
count++; // count=count+1
if(count%3==0)
{
add_commas(num/10,count); // recursive call
cout << ',' << num%10; // cout comma then remainder of
// num / 10
}
else
{
add_commas(num/10,count); // recursive call
cout << num%10; // no comma just remainder of num/10
}
}
}
void main(void)
{
add_commas(123456789,0); // call add_commas (second param must be 0!)
}
try it you will lose nothing
|
|
|
|
|
I am an extreme newbie to C++!
I am using CreateWindow() to create a window, and it is successful, but I can not find a way to set the window's font size, style, etc...
Is there a simple way to do this or am I missing something completely?
All help is extremely appreciated!!!
Sample:
m_hWnd = ::CreateWindow(TEXT("EDIT"),
TEXT("My Text"),
WS_CHILD | ES_LEFT | WS_VISIBLE | SS_LEFT,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
m_hWndParent,
NULL,
NULL,
NULL);
Thanks,
Troy
troygtroy@hotmail.com
|
|
|
|
|
To change a window's font, you will have to get the device context using GetDC(), then create a font (look up CreateFont), then call SelectObject() to select the font.
Be sure to call DeleteObject() when you are finished with the font, and ReleaseDC() when you no longer need the device context.
Documentation for these functions can be found on MSDN.
Like it or not, I'm right.
|
|
|
|
|
Geez, out with vb's Me.Font = "" and into a whole new world. Thanks for the help and for the quick response. I will follow your lead in MSDN.
Thanks again,
Troy
|
|
|
|
|
Hi, everyone
I am trying to develop some code to connect my local MS Access database. Now I have a very long char string, the length of this string could vary very differently. In my Access database, the field type is Memo. Now I am using ODBC function SQLBindParamenter to try to bind this string dynamically. My question is how should I set the columnsize parameter of the SQLBindParamenter method? I can always set a very huge number, like 50000, but the length of that string still could be larger. what should I do?
Anyone has any suggestions?
Thanks a lot in advance.
|
|
|
|
|
Hi !
Anyone knows about a tutorial where I could learn how to use CSpinButtonCtrl ?
Well, admit I have a MFC App with a CEdit and a CSpin.. next to it. How do I assign the CEdit as the buddy window for the CSpin ? My question could be : how do you retrieve the Cwnd * from a given control ?
Thanks
RaGe
|
|
|
|
|
Well, I got it alone =)
CWnd *tmp=GetDlgItem(IDC_EDIT);
m_Spin.SetBuddy(tmp);
in case other are interested ...
RaGe
Unfortunately, brute-force solutions tend to be slow
even when performed by modern-day microcomputers,
which are capable of several MIPS except when I'm late
for an appointment and want to finish a compile and
run just one more test before I leave, in which case
the crystal in my computer is apparently designed to
automatically revert to 1 Hz.
-- Michael Abrash
|
|
|
|
|
Just place Spin near edit in the dialog editor, invoke "Layout->Tab Order" menu command, and set spin tab number after edit tab number. Then select "AutoBuddy" property of spin and it will be automatically attached to edit control. In OnInitDilog function set the spin behavior, for example:
<br />
CSpinButtonCtrl* pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_FREQ_SPIN);<br />
pSpin->SetRange(0, 20000);<br />
|
|
|
|
|
Sorry to nitpick, but the proximity of the two controls is meaningless. Only the tab order is important. Having them near each other makes the dialog easier to understand and maintain, but has no effect on functionality.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Michael Dunn wrote:
proximity of the two controls is meaningless
I know, I don't said, that it's needed. I recommended to use it for design purposes only.
|
|
|
|
|
hi !
I need to display a dialog box built in resource editor at a certain precise coordinate on
screen.
Is there anyway I can achive this without modifying the resource .RC file.
Actually I need to so this on the fly.
DeepBlue
|
|
|
|
|
SetWindowPos or MoveWindow, your choice.
-c
Cheap oil. It's worth it!
|
|
|
|
|
I tried using this one.. but couldn't get around the first parameter.
BOOL SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );
How do I use it ??
Thanks again
DeepBlue
|
|
|
|
|
it's usually of a set of predefined window ptrs. i just use wndTop (think that's what it is)
-c
Cheap oil. It's worth it!
|
|
|
|
|
Guys, I prefer to use SetWindowPlacement under win32 or CWnd::SetWindowPlacement Under MFC...
Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|