|
IIRC you can only have 255 (or 256?) controls in a dialog resource. If you need more, you must create the controls at runtime.
--Mike--
http://home.inreach.com/mdunn/
A recent survey reports that 1/4 of all internet users in England surf for porn.
The other 3/4 just didn't want to admit it.
|
|
|
|
|
Is it possible to register multiple file extensions with an SDI application?
I tried doing the following, but this strange box pops up (new document) but if I pick any choice but the first, an error occurs. Should I create a different document class to handle each file extension type? Or is there an easier way?
AddDocTemplate(new CSingleDocTemplate(IDR_FILETYPE1,
RUNTIME_CLASS(CTest2Doc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CTest2View)));
AddDocTemplate(new CSingleDocTemplate(IDR_FILETYPE2,
RUNTIME_CLASS(CTest2Doc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CTest2View)));
IDR_FILETYPE1 is "sdi app\n\n1\nfiles (*.txt)\n.txt\npart 6-1\npart 7-1"
IDR_FILETYPE2 is "sdi app\n\n1\nfiles2 (*.doc)\n.wsf\npart 6-2\npart 7-2"
--
Peace,
Amit Jain
|
|
|
|
|
Check the Microsoft Knowledge Base ( Q198538 ).
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Got it, thanks =)
--
Peace,
Amit Jain
|
|
|
|
|
How can I change the font of a CStatic control?
Thanks,
Joseph LeBlanc
unixd0od@hotmail.com
|
|
|
|
|
Hi...
Use the CStatic::GetDC() function to get the device context of the static control.
Then u can use the CDC's font manipulation functions to play with fonts.
Happy coding,
Regards,
Rejeesh
|
|
|
|
|
You can use CWnd::SetFont(), and I always use CFont::CreatePointFont() for convenience.
Cheers,
Bob.
|
|
|
|
|
Hi,
I am adding an automatically resizable dialogbar into my MFC program. But it can not automatically resize when the window size is changed. Can you tell me the reason and how to implement this? Thanks in advance.
Kidd
|
|
|
|
|
If I throw and catch an exception in VC++ I see something like this in the debug window:
First-chance exception in DF.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Is there anyway to prevent this message from being displayed?
|
|
|
|
|
If I throw and catch an exception in VC++ I see something like this in the debug window:
First-chance exception in DF.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Is there anyway to prevent this message from being displayed?
|
|
|
|
|
There might be a pragma, but what's the problem ?
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
I would like to get an answer as well. When a server program pops up one of those messages phones start ringing. If it is a regular program, all I usually have to do is clear the error message. If it is a service though, there is no visible message to clear and the only resort is to re-start the computer
|
|
|
|
|
Why would your server program run your code via Visual C++ in debug mode ? Unless I read you wrong, you're saying you get a trace message, right ?
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
I lead a team of developers of different skill levels. The assertions are the only way to let someone know where the problem is. We get all sorts of crap data sent from the users, which manages to set up "impossible" situations that were not trapped in the code. The asserts capture the condition, I just wish I could get them to write to a file and hopefully let the programs continue on their way
|
|
|
|
|
So, if you must, write your own replacement for assert. It's just a macro. Personally I'd never use assert in the way it sounds like you're using it.
Assert is supposed to be disabled as soon as you move out of a debug environment. It's for checking that your program is doing what you thought it was, not for checking your users are doing what they ought to do. That's input validation which, in a serious production application, is usually a significant proportion of the program code.
An assert failure ought to ring alarm bells.
However AFAIK an assert failure just raises an exception. You can probably catch it and do what you like with it.
|
|
|
|
|
I've written an application that plays AVI files, and has no problem opening them, with one exception:
I took some open-able AVI files and burned them onto a CD. Then, when I tried to open them directly from the CD or after copying them from the CD to the hard drive, AVIFileOpen returns the error AVIERR_FILEOPEN. The process of burning the files onto the CD did something to cause this, however the files still play fine in Windows Media Player. This is a big problem, and I haven't been able to find out anything about what causes the FILEOPEN error. If any of you have any ideas, I would greatly appreciate them
thanks,
Jake
|
|
|
|
|
Here's a good one... I want to get the number of decimal digits from a float Any suggestion would be greatly appreciated!!
Thanks
Stephane Denis
big_dog45@hotmail.com
|
|
|
|
|
Check out _fcvt (Converts a floating-point number to a string), take the resulting string's length and subtract the decimal-point position.
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
if you want the digits to the LEFT of the decimal point, use this:
char cString[128];
float myValue = 123.456;
sprintf(cString, "%.0lf", myValue);
int digits = strlen(cString);
If you want the numbers to the RIGHT of the decimal point, it's pretty much up to you how many there are, but I would try it this way:
char cString[128];
float myValue = 123.456;
sprintf(cString, "%lf", myValue - floor(myValue));
int digits = strlen(cString) - 2;
Now, which one were you after?
|
|
|
|
|
Would you know what's wrong with this code?
CArray<cbutton, cbutton&=""> m_COMOnlyButtonArray;
/ctrlRect 's height is 32
BOOL bOK = m_COMOnlyButtonArray[nDex].Create("ab",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, ctrlRect, this, pCtrl->m_GuiCtrlId);
m_COMOnlyButtonArray[nDex].SetFont(&m_font);
//The button is created but I don't see the text on the button????
|
|
|
|
|
What happens if you comment this line? ->
m_COMOnlyButtonArray[nDex].SetFont(&m_font);
Do you need to set your custom font?
|
|
|
|
|
|
How can I hide the toolbar in some dialogs and display it in others?
Thanks!
Richard
|
|
|
|
|
Let's say I create an SDI app w/ Appwizard using a CRichEditView instead of a regular view. (could be mdi for all i care, also has compound document support since cricheditview demands it)
When I compile and run the sample, it should run right? It shouldn't actually do anything since I haven't implemented anything, but it should at the very least run and let me type text, right? I'm thinking this way because when I create a default project using CEditView (doesn't ask for or need compound document support), it works fine, sort of.
Anyway, this is what I get in the trace window, but I'm not sure how to proceed. Any ideas/pointers?
Detected memory leaks!
Dumping objects ->
strcore.cpp(118) : {101} normal block at 0x003014E0, 18 bytes long.
Data: < Read> 01 00 00 00 05 00 00 00 05 00 00 00 52 65 61 64
H:\Program Files\Microsoft Visual Studio\MyProjects\test4\test4Doc.cpp(19) : {98} client block at 0x00302760, subtype 0, 244 bytes long.
a CTest4Doc object at $00302760, 244 bytes long
array_p.cpp(110) : {97} normal block at 0x00302880, 20 bytes long.
Data: < d 0 > 00 00 00 00 64 16 30 00 00 00 00 00 CD CD CD CD
array_p.cpp(71) : {96} normal block at 0x003028C0, 4 bytes long.
Data: < > 00 00 00 00
winfrm2.cpp(66) : {95} client block at 0x003028F0, subtype 0, 168 bytes long.
a CDockBar object at $003028F0, 168 bytes long
array_p.cpp(71) : {94} normal block at 0x003029D0, 4 bytes long.
Data: < > 00 00 00 00
winfrm2.cpp(66) : {93} client block at 0x00302A00, subtype 0, 168 bytes long.
a CDockBar object at $00302A00, 168 bytes long
array_p.cpp(71) : {92} normal block at 0x00302D70, 4 bytes long.
Data: < > 00 00 00 00
winfrm2.cpp(66) : {91} client block at 0x00302AE0, subtype 0, 168 bytes long.
a CDockBar object at $00302AE0, 168 bytes long
winfrm2.cpp(66) : {89} client block at 0x00302BC0, subtype 0, 168 bytes long.
a CDockBar object at $00302BC0, 168 bytes long
bardock.cpp(735) : {88} normal block at 0x00302DA0, 176 bytes long.
Data: < K_ > 84 01 4B 5F CD CD CD CD CD CD CD CD CD CD CD CD
strcore.cpp(118) : {87} normal block at 0x00302CA0, 17 bytes long.
Data: < SCRL> 01 00 00 00 04 00 00 00 04 00 00 00 53 43 52 4C
strcore.cpp(118) : {86} normal block at 0x00302CE0, 16 bytes long.
Data: < NUM > 01 00 00 00 03 00 00 00 03 00 00 00 4E 55 4D 00
strcore.cpp(118) : {85} normal block at 0x00302D20, 16 bytes long.
Data: < CAP > 01 00 00 00 03 00 00 00 03 00 00 00 43 41 50 00
{81} normal block at 0x00302EF0, 80 bytes long.
Data: < > 00 00 00 00 00 01 00 00 00 01 00 08 00 00 00 00
plex.cpp(31) : {78} normal block at 0x00302F70, 124 bytes long.
Data: < /0 d 0 > 00 00 00 00 80 2F 30 00 00 00 00 00 64 16 30 00
strcore.cpp(118) : {66} normal block at 0x003014A0, 18 bytes long.
Data: < test> 01 00 00 00 05 00 00 00 05 00 00 00 74 65 73 74
H:\Program Files\Microsoft Visual Studio\MyProjects\test4\test4.cpp(93) : {64} client block at 0x00301520, subtype 0, 484 bytes long.
a CMainFrame object at $00301520, 484 bytes long
plex.cpp(31) : {63} normal block at 0x00301730, 124 bytes long.
Data: < 0 > 00 00 00 00 00 00 00 00 00 00 00 00 A0 18 30 00
{62} client block at 0x003017E0, subtype 0, 32 bytes long.
a CDocManager object at $003017E0, 32 bytes long
strcore.cpp(118) : {61} normal block at 0x00301830, 57 bytes long.
Data: < , , Tes> 01 00 00 00 2C 00 00 00 2C 00 00 00 0A 54 65 73
H:\Program Files\Microsoft Visual Studio\MyProjects\test4\test4.cpp(84) : {60} client block at 0x003018A0, subtype 0, 144 bytes long.
a CMultiDocTemplate object at $003018A0, 144 bytes long
strcore.cpp(118) : {58} normal block at 0x00301960, 19 bytes long.
Data: < File> 01 00 00 00 06 00 00 00 06 00 00 00 46 69 6C 65
strcore.cpp(118) : {57} normal block at 0x003019A0, 29 bytes long.
Data: < Rece> 01 00 00 00 10 00 00 00 10 00 00 00 52 65 63 65
{56} normal block at 0x003019F0, 20 bytes long.
Data: < L_ L_ L_> 04 00 00 00 14 CB 4C 5F 14 CB 4C 5F 14 CB 4C 5F
{55} normal block at 0x00301A30, 32 bytes long.
Data: << K_ 0 0 > 3C 8D 4B 5F 04 00 00 00 F4 19 30 00 AC 19 30 00
oleinit.cpp(86) : {52} client block at 0x00301AE0, subtype 0, 68 bytes long.
a CCmdTarget object at $00301AE0, 68 bytes long
Object dump complete.
The thread 0xE6 has exited with code 3 (0x3).
The program 'H:\Program Files\Microsoft Visual Studio\MyProjects\test4\Debug\test4.exe' has exited with code 3 (0x3).
--
Peace,
Amit Jain
|
|
|
|
|
I've just created empty MFC app with CRichEditView using AppWizard. Everything works fine, no such thing like memory leaks. The dump you've posted contains lots of stuff, looks like something is terminating your program prematurely.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|