|
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
|
|
|
|
|
See, it's strange that you can do that because I get the bad results on my work pooter (nt4 sp6) and at home (98se).
Even stranger is that I just found out the program will run just fine if I compile using the Release config instead of Debug.
On deja, I found a guy with almost the same problem who said he had to uninstall and completely reinstall everything. Since this is problematic at work, I'll try it when I get home...
Thanks for trying though
--
Peace,
Amit Jain
|
|
|
|
|
Try overriding ExitInstance in CYourApp and put a breakpoint there. Check if ExitInstance is called.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
--start--
I had trouble w/ the richedit class for a while, and I believe if you
add Automation support to your app in step 3/6 during the application
creation process, it will cure you ills. (It's a checkbox option toward the
bottom of the dialog during creation)...hope that does the trick, if not let
me know and I can find out for sure. G'luck.
Frank Cronin
--end--
And that worked for me. If anyone has this problem, this is what you try. If anyone else can figure out WHY this is the case, I'd love to hear it...
--
Peace,
Amit Jain
|
|
|
|
|
I'm trying to link an HTML help document into my existing application. I have tried using Microsoft's method of ID_HELP_FINDER however have discovered its wanting a WinHelp document and not a HTML Help document. Does anyone know how I might be able to tweak my application so that I will accept the HTML Help file?
Also I'm noticing that apps created using VC++ with the context sensitive help on automatically run MakeHelp.bat. I'm wondering if having the .hm file in a folder called External Dependencies might trigger this event, however I'm having problems figuring out how this folder gets created by VC++. Does anyone know the sequence of events for this to happen?
Thanks!
Chris
|
|
|
|
|
How can I get the floppy/hard disk serial number?
Daniel
|
|
|
|
|
|
Hello everybody!
I´m writing a MDI app. Application Wizard generates two menus:
One (IDR_MAINFRAME), which is displayed when no document is open, the other (IDR_XXXTYPE) when there is at least one document opened.
This code below (from CMainFrame::OnCreate) modifies the first menu. I want to do the same modification to the other menu.
How to do that?
Thank you for any comments.
Jerzy
CMenu PopupMenu;
PopupMenu.CreateMenu();
for(int i=0;i<3;i++)
{
CString str;
str.Format("Item %d",i);
PopupMenu.AppendMenu(MF_STRING,IDM_ITEM+i,str) ;
}
CMenu *m=GetMenu();
m->AppendMenu(MF_POPUP¦MF_STRING,(UINT)PopupMenu.m_hMenu,"&Items");
PopupMenu.Detach();
|
|
|
|
|
Use GetSubMenu to get the proper menu and continue as you have been.
|
|
|
|
|
Hi,
I don't know what you mean to use GetSubMenu()?
This code is working, it ataches a new popup to the main menu.
The problem is that it ataches this submenu to the IDR_MAINFRAME menu (after main frame is created). I need to do the same for IDR_VIEWTYPE menu. I don't know in what moment that menu is created. If I use this code in that moment, the new popup would be attached to IDR_VIEWTYPE menu.
Jerzy
|
|
|
|
|
The handle of the IDR_XXXTYPE menu is accessible through public data member of the CMultiDocTemplate class, it's called m_hMenuShared.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|