|
Tara14 wrote: Well... non of them had vs installed in them. I even sent the exe file to client.
Oops ! search for MFC42.DLL,MSVCRT.DLL on those m/cs. And hope that same are present on client m/c in windows folder.
Its impossible to have these dlls present on clean m/c.
|
|
|
|
|
Oh! Ok. I just got lucky then!
Thanks a lot for the help.
Fortitudine Vincimus!
|
|
|
|
|
I use the folowing code to listen the com:
void CMina_sView::OnListenCom1() <br />
{ <br />
running = TRUE;<br />
AfxBeginThread(run,this);<br />
}
void CMina_sView::ascultarea()<br />
{<br />
<br />
CSerial serial;<br />
LONG lLastError = ERROR_SUCCESS;<br />
DWORD dwBytesRead = 0 ;<br />
char szBuffer[21];<br />
CString str2="jjk";<br />
char of[5]= "Addd";<br />
int i=10;<br />
const int nBuflen = sizeof(szBuffer)-1;<br />
<br />
lLastError = serial.Open(_T("COM1"),0,0,false);<br />
lLastError = serial.Setup(CSerial::EBaud9600,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);<br />
lLastError = serial.SetMask(CSerial::EEventBreak |<br />
CSerial::EEventCTS |<br />
CSerial::EEventDSR |<br />
CSerial::EEventError |<br />
CSerial::EEventRing |<br />
CSerial::EEventRLSD |<br />
CSerial::EEventRecv);<br />
<br />
lLastError = serial.SetupReadTimeouts(CSerial::EReadTimeoutNonblocking);<br />
<br />
lLastError = serial.WaitEvent();<br />
<br />
const CSerial::EEvent eEvent = serial.GetEventType();<br />
<br />
if (eEvent & CSerial::EEventRecv)<br />
{<br />
while (running)<br />
{Sleep(300);<br />
dwBytesRead = 0;<br />
<br />
<br />
serial.Read(szBuffer,nBuflen,&dwBytesRead);<br />
szBuffer[dwBytesRead] = '\0';<br />
str2.TrimLeft();<br />
str2.TrimRight();<br />
str2.TrimLeft();<br />
str2.TrimRight();<br />
}<br />
}<br />
running = FALSE;<br />
serial.Close();<br />
<br />
}<br />
<br />
UINT CMina_sView::run(LPVOID p)<br />
{<br />
CMina_sView * me = (CMina_sView *)p;<br />
me->ascultarea();<br />
return 0;<br />
<br />
}
If I run the program I get an error. If I run it in debug mode I when try to watch str2 i get the error: "symbol "str2" not found" What's wrong? I can watch any other variable.
|
|
|
|
|
tanarnelinistit wrote: If I run the program I get an error
What error ?
|
|
|
|
|
|
Did you use your debugger to see on which line of code it crashes (if needed, use the call stack to see in which of your function it crashes).
|
|
|
|
|
Cedric Moonen wrote: Did you use your debugger to see on which line of code it crashes (if needed, use the call stack to see in which of your function it crashes).
But I can see what the error is, because when I use the debugger I don't have a value for str2, it says "symbol not found". But why does this happen? Does it have anything to do with multithreading?
|
|
|
|
|
It's not because you can't see the value of str2 that you are not able to see where your program crashes.
Maybe you are trying to watch str2 out of its scope. It can only be watched if you have a breakpoint in the function where it is declared. Outside it, its not visible.
|
|
|
|
|
Cedric Moonen wrote: Maybe you are trying to watch str2 out of its scope. It can only be watched if you have a breakpoint in the function where it is declared. Outside it, its not visible
But I try to watch the variable str2 inside the function and I can't. I know what ur trying to say, that's why I asked you if it's because of the multihtreading, is that why I can't see it's value?
|
|
|
|
|
When you get an assert, the first step is to break into the code. If you can't work out what's wrong, the next step is to post the line number and even the actual line of code that's causing the assert. We need the line number and file as well, if we're to see it in context.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: We need the line number and file as well, if we're to see it in context.
File wincore.cpp Line 883.
|
|
|
|
|
Use the callstack to see in which of YOUR function the code crashes. Then put a breakpoint at the begining of this function and step by step to see which instruction makes your program crash.
|
|
|
|
|
Cedric Moonen wrote: Use the callstack to see in which of YOUR function the code crashes. Then put a breakpoint at the begining of this function and step by step to see which instruction makes your program crash.
The line that makes my program crash:
if (str2=="FFFF00000000028C") m_pSet->m_Nume="Gigi";
else m_pSet->m_Nume="Ionica";
Because that's a line on which I have str2 the variable that is defined and initiated with a value, but which I can't see.
-- modified at 8:53 Wednesday 26th July, 2006
|
|
|
|
|
tanarnelinistit wrote: if (str2=="FFFF00000000028C") m_pSet->m_Nume="Gigi";
Put a breakpoint on the if statement and single-step (F10) from there.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Where does this code come from ??
Please, when you post something give the complete information. This has absolutely nothing to do with the first code snippet you posted. So how can we guess what the problem is ?
What is this m_pSet and what is its value ? Is it a valid address ?
|
|
|
|
|
tanarnelinistit wrote: File wincore.cpp Line 883.
This is apparently not with VC++ v6. Correct?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: This is apparently not with VC++ v6. Correct?
No, it is with VC++ v6.0. The error is comming from using the str2 CString variable. If I dont use any reference to it there is no problem.
|
|
|
|
|
tanarnelinistit wrote: No, it is with VC++ v6.0.
Line 883 of wincore.cpp does not have any ASSERT() statements. Here are the first few lines of code in the AssertValid() method:
#ifdef _DEBUG
void CWnd::AssertValid() const
{
if (m_hWnd == NULL)
return;
ASSERT(HWND_TOP == NULL);
if (m_hWnd == HWND_BOTTOM)
ASSERT(this == &CWnd::wndBottom);
else if (m_hWnd == HWND_TOPMOST)
ASSERT(this == &CWnd::wndTopMost);
else if (m_hWnd == HWND_NOTOPMOST)
ASSERT(this == &CWnd::wndNoTopMost);
else
...
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
IME, symbol "str2" not found errors in the debugger are due to one of four things:
1 : You typed the identifier incorrectly
2 : You are in the wrong context
3 : You are trying to view a static variable (VC++ 6.0)
4 : You have overrun/underrun a buffer
Given that you are also getting additional errors, I would research #4 .
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote: You have overrun/underrun a buffer
What do you mean by that? If I don't use multithreads I don't get an error.
|
|
|
|
|
tanarnelinistit wrote: If I don't use multithreads I don't get an error.
Most likely the problem is still present and is simply being masked by some other operation.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Most likely the problem is still present and is simply being masked by some other operation.
With all respect it can not be posible to have the problem when I don't use multithreads because i use str2 to edit a field in the database and that works fine. I run the program just fine.
|
|
|
|
|
Hi,
I have an MFC ver 4 dll that I want to use in my MFC ver 7 exe.
I created an interface dll that uses MFC ver 4 and calls my main
ver 4 dll. This interface dll does not export any MFC dependent
classes or functions and so I can use it in my ver 7 exe. However I
get a crash in my main dll. I wrote a quick ver 4 exe that uses the
interface dll to call the main dll and it works okay. Is there
some issue mixing different versions of MFC in a single application ?
Nvat.
|
|
|
|
|
you may run in to problems anyway but are you statically linking mfc?
cje
|
|
|
|
|
My main dll links dynamically and I can't change that.
The exe and interface dll both link dynamically but I
could change those if you think it would help ?
Nvat.
|
|
|
|