|
Hi
I made some simple program..it sometimes die...
so I'd like to know the line number which line cause problem and die.
so, is there macro or function to find out died line for VC6.0?
Thanks.
|
|
|
|
|
die?? did you mean crash?? if that is the case then i think you should debug the code and find out where it is crashing
|
|
|
|
|
|
|
Do you know from which method it is crashing? Does your methods have exception handlers?
One lazy way->
try{
int nLine = 1;
nLine = 2;
nLine=3;
nLine=4;
}
catch(...)
{
}
-Suhredayan
|
|
|
|
|
In short : I'm having trouble trying to figure out to convert any base number{2-36} to base 10 in C++.
Really, I'm supposed to design a program that can take in any InBase number(2-36) and convert it to any OutBase(2-26) by use of a stack.
As a solution and probably a inefficient one, I thought I would convert the InBase first to a base 10 number and then reconvert to whatever chosen OutBase.
Psuedo or the actual code is much appreciated but really, I need an good explanation on how I could implement this way of conversion.
I'm using Visual c++ 2008 express edition to code the program.
Thanks in advance.
|
|
|
|
|
The formula for converting to base 10 is (base^n * dn) + ... + (base^2 * d2) + (base^1 * d1) + (base^0 * d0) read as base to the power n into dn
where d0 is the left most digit and dn is the right most digit and base is the base value using which the number is currently encoded.
Once you get the base 10 value you can convert it to any other base between 2 - 36 using the _itoa_s .
|
|
|
|
|
Sorry for the late reply.
Thank you very much for your help!!
|
|
|
|
|
I can't see any examples of this function. I was hoping if answered the following issue below...
I have been asked to have arrow keys work in the microsoft C++ Ribbon bar like they do in Microsoft Word 2007.
Press F10 in Microsoft Office and then hit the arrow keys and it will move the user across the categories. When I do this in the microsoft demo, it doesn't do this.
|
|
|
|
|
Hi,
I'm reading a file straight in to a CRichEditCtrl, butI am not getting any justification maintained.
The rtf file has been created in Microsoft Word, and is fully justified (to fill the screen etc), but when I read the file in to my control each paragraph just appears as a single line.
I have tried using SetParaFormat but it seems to make no difference.
My PARAFORMAT2 is configured as below
<pre>
PARAFORMAT2 pf;
// Modify the paragraph format so that the text is centered.
pf.cbSize = sizeof(PARAFORMAT);
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_JUSTIFY;
BOOL bOK = m_rtfControl.SetParaFormat(pf);
</pre>
Any help on getting over this hurdel would be much appreciated.
Tony
|
|
|
|
|
Did you enable the advanced typography for your CRichEditCtrl by sending the EM_SETTYPOGRAPHYOPTIONS[^] message?
If not the control will not maintain the paragraph justification.
You can enable the advanced typography like that:
::SendMessage(hWndEdit, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);
Regards,
Nuri Ismail
|
|
|
|
|
Thanks for the reply Nuri,
I have tried to implement that in my OnInitDialog, along with setting PARAFORMAT2 etc.
The hwndEdit you mention is, I assume, m_hWnd of the edit control, e.g. MyRichEditCtrl.m_hWnd?
I have added richedit.h to my project, in fact I have tried pretty much all that I read on various sites, but with no joy.
Do you have any further suggestions?
My code now looks like
<pre>
//open the fiel that contains the commissioning information
CStdioFile cFile(TEXT("RES\\Message.rtf"), CFile::modeRead);
//ensure a blank canvas
m_rtfCtrl.Clear();
//enable advanced typography
::SendMessage(m_rtfCtrl.m_hWnd, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);
PARAFORMAT2 pf;
// Modify the paragraph format so that the text is centered.
pf.cbSize = sizeof(PARAFORMAT);
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_JUSTIFY;
BOOL bOK = m_rtfCtrl.SetParaFormat(pf);
EDITSTREAM es;
//read the data by setting up the callback
es.dwCookie = (DWORD) &cFile;
es.pfnCallback = MyStreamInCallback;
m_rtfCtrl.StreamIn(SF_RTF, es);
</pre>
Tony
|
|
|
|
|
Hi,
maycockt wrote: The hwndEdit you mention is, I assume, m_hWnd of the edit control, e.g. MyRichEditCtrl.m_hWnd?
Yes, it is the m_hWnd of your edit control.
This is from your code:
PARAFORMAT2 pf;
pf.cbSize = sizeof(PARAFORMAT);
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_JUSTIFY;
BOOL bOK = m_rtfCtrl.SetParaFormat(pf);
Try with this change. If this don't solve your problem, then you have to paste your MyStreamInCallback function because there are some tricks about this callback for UNICODE builds.
Regards,
Nuri Ismail
|
|
|
|
|
Hi Nuri,
Your initial help was spot on, it was a different issue causing the problem.
The Auto HScroll was set, and as soon as I unset that (FALSE), everything sparked in to life.
I dont have any need for the SetParaFormat now, so my other mistake can now be deleted anyway.
Many thanks for your help
Tony
|
|
|
|
|
You're welcome!
|
|
|
|
|
now, i have a window which sends mouse-key-message to desktop-window(names "FolderView"), how can i make the desktop-window handle MouseLButtonDown and not get focus. in other words, my window owns focus other than desktop-window.
|
|
|
|
|
i feel you need "HOOK"
|
|
|
|
|
Hans Conried, Cyril Ritchard, Jason Issacs, Dustin Hoffman, ...?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
thank you, i don't use hooking, but i send the proper message to the window,which message is viewed by spy++, thank you all the same
|
|
|
|
|
my program uses SetItem() to change the image of an item in a list control dynamiclly,it works in debug version,but doesn't work in release version.Why is that?I'm so confused!
|
|
|
|
|
It could be related to the initialization of your variables/pointers. Debug version does some "non visible" things that you don't programm but release version doesn't, so what in debug works doesn't have to work in release. Check your code.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
I suggest you add OutputDebugString() calls and use dbgview from sysinternals.com (free utility) to view the debug messages. This works equally well in both debug and release mode build.
|
|
|
|
|
Hi Please let me know how to remove readonly permissions for a folder and its subdirectories and files inside it...
|
|
|
|
|