|
Hello,
I need to use template functions, but as it seems that they must be declared and defined in the same file, I've placed them in the header file.
After doing this I've noticed two problems:
1. I can't use breakpoints there.
2. I can't see the functions in the class wizard.
Any advice? mostly on the first topic, I can live with the second one... but I need to be sure that the pointers passed as parameters are the right ones and I need to be able to debug that functions...
Thank you in advance.
|
|
|
|
|
Having just knocked up a quick test application, I have no problem with setting the breakpoints in the header file.
I would guess that maybe the debug information is incorrect for your project (I presume you've tried a full rebuild?) or you have some strange compiler settings that are causing problems, but beyond that I don't see any reason why you can't set breakpoints.
Sorry I can't assist you any further than that.
--
Ian Darling
|
|
|
|
|
The functions are template based declared in this way:
template<class T> inline long WriteSomeData(CString csNameOfTheVar, T TemplateParam, int iPort)
{
...
} this declaration is placed as a member of one class.
then, I can't place a breakpoint and make it work right.
Any idea?
|
|
|
|
|
Nothing looks amiss to me. My first reaction told me it was the inline, but I seriously doubt that's the problem (although I do doubt the usefulness of that inline in this context
--
Ian Darling
|
|
|
|
|
Hello,
Ian Darling wrote:
I do doubt the usefulness of that inline in this context
Why do you doubt that?
I use that function from some others a lot of times and if I have not misunderstood the inline modifier, it's purpose is to give more velocity to the program by not calling the inline function but adding the inline function code at the place where the inline function call is.
Then the pourpose it's clear, isn't it?
|
|
|
|
|
If you include the body of a function inside the class definition, then it is the same as if you qualify it with inline . That is,
class A
{
int f(){cout<<1<<;}
}; is equivalent to
class A
{
inline int f();
};
...
int A::f()
{
cout<<1;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
First of all thank you for your answer, it has explained me other thing that I didn't know, but after removing the inline , it makes the more or less the same:
1. I can't debug the function properly (some times I can debug it (the compiler stops at the breakpoint) and sometimes not and the function is being called (I'm sure about that last part)).
2. The functions involved (there are various functions placed in the header file) continue without appearing in the ClassView...
Could you tell me what's happening?
As always, thank you in advance...
|
|
|
|
|
1. I think this is a problem with the debugger and template member functions (I've experienced similar strange things in the past). One way (not tested myself) to make sure the debugger always stops is as follows:
template<typename T> void CMyClass::Whatever()
{
DebuggerStopper();
...
}
void CMyClass::DebuggerStopper()
{
} 2. The class viewer is crap, I don't know any fix for that.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, thank you, I've tested it and it worked OK, I'll be able to detect errors in those functions now.
Talking about the other thing... I think I'll be able to live with it... moreover when I'll place that code inside a DLL for further use of it.
as always, thank you very much.
|
|
|
|
|
inline might be your culprit...
-=jarl=-
|
|
|
|
|
Hello,
First of all thank you for your answer, but after removing the inline, it makes the same:
1. I can't debug the function properly (some times I can debug it (the compiler stops at the breakpoint) and sometimes not and the function is being called (I'm sure about that last part)).
2. The funtions involved (there are various functions placed in the header file) continue without appearing in the ClassView...
thank you in advance...
|
|
|
|
|
HI guys
I'm really newbie coding printing and I have the following doubt.
I'm doing calculations and depending of the result I have to print or not.
If the result is 0 the page doesn't have to be printed in any other case yes.
But if I'm not wrong , the number of pages has to be fixed in OnPreparePrinting and then... what do you suggest to me to do to avoid print blank pages when the result is 0.
I hope do you understand my question.
Best Regards and thank you.
Doctor pi
|
|
|
|
|
From MSDN:
Another example is the case in which the length of the document is not known until it is printed. In this situation, the view class tests for the end of the document each time a page is printed. When the end is reached, the view class sets the m_bContinuePrinting member of CPrintInfo to FALSE; this informs the framework to stop the print loop
Look up the CPrintInfo structure for additional info.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
How can I simulate a toolbar press, not just the PressButton function since this does not call the function, but the actuall calling of the function related to the toolbar button.
Cheers
Asim
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Can you not just send yourself the correct WM_COMMAND message?
AfxGetApp()->SendMessage(WM_COMMAND, ID_TOOLBAR_BUTTON, 0);
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Thanks...
Just figured that one out for myself.. i was using AfxGetApp()->SendMessage(ID_TOOLBAR_BUTTON, 0, 0);
and wondering why it wasn't working?!?!?!?
Thanks again...
Asim.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Dear all,
I have written a program and try to run it but get this Dos
screen and message
" Program too big to fit into meemory"
Anybody pls help!!!
thanks you
|
|
|
|
|
what do you do in the program?
[]D [] []D []
|
|
|
|
|
Operating sytem? (Dos 3.1?)
How big is your program?
Do you have any global static arrays?
|
|
|
|
|
Well, i add a few clines for helps files in my project, and complie no problem, but when exe, the message appears
Any expert can solve this problem???
btw,the system i used is p2 500mhz, os win2000 pro ram 256MB
thanks
|
|
|
|
|
Are you using 98 with > 512MB of memory? I seem to remember a friend getting these error messages when he upgraded his PC. There is a "system feature" with 98. i.e. you can't have > 512MB of memory.
It is always worth trying the prog on another PC.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Does anyone know a good unique Encrypting technique to encrypt a string? or a article to read about it?
[]D [] []D []
|
|
|
|
|
|
Hola Willem:
Yo tengo dos alternativas:
1. Uso
CString stFrase;
stFrase.Replace("e", " ");
...
//Esto reemplaza la letra "e" por un espacio, lo hago varias veces con varias letras y al final queda encriptado.
Nos vemos
Saludos desde el Caribe Mexicano
|
|
|
|
|
Hi
I'm trying to create a CSplitterWnd within a CFrameWnd, but I have some problems with that... or MFC. I'm creating the CFrameWnd by calling the Create function, and passing a NULL to the pContext parameter because i don't know how to fill the CCreateContext with valid data.
But my problems starts in the OnCreateClient of the CFrameWnd, when i'm trying to create the CSplitterWnd.
Doing something like this:
<br />
BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)<br />
{<br />
<br />
<br />
m_MySplitterWnd.CreateStatic (this, 2, 1);<br />
<br />
m_MySplitterWnd.CreateView (0, 0, RUNTIME_CLASS(CMyView), CSize(100,100), pContext);<br />
m_MySplitterWnd.CreateView (1, 0, RUNTIME_CLASS(CMyView), CSize(100,100), pContext);<br />
<br />
<br />
return TRUE;<br />
}<br />
As expected, the pContex is NULL and apparently i'm not allowed to call CreateView and pass NULL to the pContext. CreateView returns FALSE, and after that i'm getting a bunch of assertions and an access violation. So what am i supposed to do to get this to work?
|
|
|
|