|
It's starting to tick me off here! I have this template class (may or may not be relevant), and my code seems to crash somtimes. Thing is I can't see much more than just a vague pattern, and it seems to move around a lot. I think it's somthing to do with the heap... When I first tested the code, it somhow crashed within a _tcsdup command, somwhere within the allocation part. So as I havn't used this command too much in the past I just replaced it with
LPTSTR mystr = new TCHAR[_tcslen(str)+1];
_tcscpy(mystr, str); That seemed to move the problem somewhere else:
newbuckets = new Bucket[newarraysize]; Bucket is a nested struct in my class. And newarraysize is sensible value around 11ish. Stepping inside stack scope, I came to a place in malloc.c (ln 211) right before things descend into assembler of ntdll.dll.
return HeapAlloc(_crtheap, 0, size); Baffling because _crtheap seemed to have a value of 0x00320000 (or somthing), and size was not dissimilar to what I'd requested up above. Ok; then somthing triggered the problem to move elsewhere onto a memset function of mine; used to initialise this array of buckets with zeros. That was crashing on in some kind of inline assembly loop routine. So I replaced the memset command with a ZeroMemory , and that caused the problem to descend back on my string allocation routine above! Has anyone seen this before? any ideas? any at all?
*¨¨`)
¸¸.·´ ¸.·*¨¨`)
(¸¸.·* ¸ .·*
¸¸.·*
(¸¸.~~> Joel Holdsworth.
|
|
|
|
|
Make 1000058108829489190289840 calls to _CrtCheckMemory all through your code. It is an ugly hack, but the most effective way I have seen, other than the use of specialized tools, to handle this problem.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yes I was beginning to wonder about the validity of the memory myself, but I even have a try block around the bucket allocation, and which survives ok! It's almost like the system's giving me bogus allocations!
*¨¨`)
¸¸.·´ ¸.·*¨¨`)
(¸¸.·* ¸ .·*
¸¸.·*
(¸¸.~~> Joel Holdsworth.
|
|
|
|
|
How can I now the size of CFont object?
I wnat print the real size of a font like microsoft word. I use MM_TEXT mode anf DrawText function.
aLeXs
|
|
|
|
|
i'm not sure I understand...
sizeof I think works on classes...unless you mean height...?
GetTextMetrics()
tm.tmHeight; + tmExternalLeading; // Maybe Internal...can't remmeber
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
I just want to print a text with the real HEIGHT points. For example, in word when I print a text with font arial 12 points, in the papper the font height is @3mm, but when I use textout function (with Cfont object selected by HDC) the height in papper is @1mm and change with the printer type.
|
|
|
|
|
I have developed a C++ ActiveXObject (dll) which gets loaded in IE with javascript using:
oMyObject = new ActiveXObject( "myDLL" );
The problem is that I need to be able to unload that dll so that I can replace (overwrite) it during a web update.
I have tried deleting oMyObject and setting oMyObject=null but neither seem to work.
The only thing that seems to work is quitting IE which I really don't want to do.
There has to be a way to force IE to let go of the dll.
Any help here would be greatly appreciated.
Thanks,
Pace
|
|
|
|
|
There has to be a way to force IE to let go of the dll.
Unfortunately, you can't. And this is not IE -- in your case, it's JavaScript object.
Your object will probably stay untill next CoFreeUnusedLibraries() will be called.
You may ask yourself however, why do you need your ActiveX dll to unload?
Maybe there is other way to perform what you need?
For example, setting oMyObject=null in javascript will cause FinalRelease and destructor of your object being called -- maybe you can put that logic in there?
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
There is a file you can modify in Visual Studio which allows you to specify things not to step into when F11 stepping but I don't remember where it is or how to set it up. I know you can just step right back out (Shift F11) of code block, but since there is a way to bypass it in the first place, I'd rather do that.
Ex.
CString cs="Hi";
MyFn(cs); // I want to step into MyFn() without
// stepping into the CString constructor
Does anyone know how to do this?
Thanks in advance!
Grailman
|
|
|
|
|
Use the right mouse button or from the debug menu (when debugging) select "step into specific function".
Example:
=======
CString strText = "abc";
MyPrintFunction(strText); // Beak point here
When clicking on "MyPrintFunction" with the right mouse buttion, a popup menu will appear and just below QuickWatch you will see "step into MyPrintFunction"
I hope this makes sense, it has been a long day.
|
|
|
|
|
That does work but it's much nicer to just continue F11-ing to the code I want rather than playing with the mouse. Like I said there is a way to do it, I just need to remember what file needs to be changed and how...
|
|
|
|
|
From the tools menu select
Customize...
Click on the Keyboard tab
From the Category Combo Box select
Debug
From the commands list box select
DebugStepIntoSpecificFunction
Click on "Press New Shortcut Key" edit box and select you new key combination.
CTRL+SHIFT+F11
Click on the [ASSIGN] button.
No you cannot reassign F11 but you can try reassigning F2.
Go to the Edit Category and delete F2 from BookMarkNext
|
|
|
|
|
A question that I didn't find answer to on MSDN or
via Google.
In Visual-C 6+ compiling with "cl /Gr" i.e. __fastcall, how do I detect this at compile time?
I need to use something like this:
#if defined(_MSC_VER)
#include <fastcall.h>
#if defined(__fastcall) || defined(FASTCALL_IN_STORE)
#error Don't even think about compiling this as fastcall (cl /Gr)
#endif
#endif
Unfortunately it doesn't work. Any hints?
Where is FASTCALL_IN_STORE set and what does it mean?
I'm not sure it's related to option /Gr (since it's not prefixed
with '__').
BTW. Watcom sets the symbols __SW_3R in this case.
Gisle V.
"If you feel paranoid it doesn't mean they're not after you!" -- Woody Allen
|
|
|
|
|
visible spaces of a Tab ('\t') character equal to 8 or 6 space (' ') characters in CRichEditCtrl by default.
now i need to change its visible spaces to 4 space characters, but i can't find idea to do that.
in visual c++ ide (not RichEdit), there is a setting which can change visible spaces of a Tab character to any space characters, i want to create a similar setting for our users.
thanks in advance for any hints and help.
includeh10
|
|
|
|
|
|
thx.
i think this is right point.
i will do a test to get it work.
includeh10
|
|
|
|
|
OK, here is what I want to do.
- Create a rich edit area on the screen. Using CScrollView as the canvas. I allow the creation of a CRichEditCtrl by dragging an area on the screen. I then use the screen coordinates and create the control.
- Setup the control so it emulates the printer in the word wrapping and font emulation. I use the SetTargetDevice with the width (in TWIPS)and a HDC to the printer. I calculate the width by getting a handle to the DC for the client window, setting the mapping mode to MM_TWIPS, and converting the display points from screen into TWIPs. Calculate the width and call SetTargetDevice.
- Print the contents of the CRichEditCtrl to a printer. I do this by using the same rectangle that I used to create the width for the SetTargetDevice in the FORMATRANGE structure. Fill in the rest and call FormatRange. (Three times, first with (null, false), second (format, true ), and the third (null,false).
Here is what I'm seeing. I draw a box around the control that is +5 screen units bigger (each direction) on the screen and printer. When I type text in the box then do a print preview/print, the characters to the right side of the box, the space seems to be smaller when I print it than when I displayed it. I think the printed version is using a different size font than what is on the display. What this should look like is a text box in word. As an example, create a text box in word, draw a line some where over it (like the middle). Notice what characters it intercets and print. The print output looks like the screen. I would like to do the same thing!
So: How do I create the control so it will appear on the screen as it will when I print?
Thanks
Once I get this beast whipped, all is well with the world. At least in my world!
BTW, there is not much information on how to do this. Either on the MSDN or anywhere else.
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
I hae problem registering my ocx. So I am trying
to debug it using regsvr32 sample program available
at microsoft.com. Does anyone know how to debug using
this regsvr32 program?
Shin
|
|
|
|
|
I just figured out!!
Thanks
|
|
|
|
|
Sorry..
I figured out how to use it..but i don't know the problem
I am getting ctlreg.cpp line 502 assertion error. seemslike
it won't let me trace that deep. If I am getting this error,
where should I look at. any help is appreciated!
shin
|
|
|
|
|
Obviously, Look at MFC\SRC\CTLREG.CPP line 502...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Thanks for your posting. Is there anyway that
I can put the break point here?
Shin
|
|
|
|
|
This time it's real. I figure out all!!
No problem registrying the ocx.
Thank you very much!!!!!
|
|
|
|
|
I have a Windows VC++ SDI Application that gathers and process data.
All I want to do is generate a report from data I have collected!!!.
I want to be able to generate a report when I select ‘Generate Report’. (And NOT File -> New)
I also want to be able to Print the report.
I have now idea how to do it.
Please help me.
|
|
|
|
|
Hi,
probaly the easiest approach is before saving your data, you transform the data into a CStringArray. That is for every data you need report you transform this data into a textual representation (CString) and add it to the array.
Then you may store the array into a file. If you take care that a line is not too long, then you may also print that array line by line. Do a heighth calualtion and divide the paper length by this height to get the number of pages to print.
Your application framework should alredy have the appropriate Print(Preview) functions installed.
If you do NOT want to select File New, rename it.
Regards
G. Steudtel
|
|
|
|