|
Is there an easy way to determine if I'm in a worker thread vs the main thread? I tried calling:
if( AfxGetMainWnd() )
expecting that it would return NULL if it was the worker thread, based on an article by NewComer on CodeProject. However, it didn't return null in the worker thread. Any ideas?
|
|
|
|
|
hi
when i tried to declare an object that take CString constructor as follow:
Group groupA("France", "Senegal", "Uruguay", "Denmark");
it just give me this error:
: error C2059: syntax error : 'string'
and this is my constructor implementation:
Group::Group(CString t1,CString t2, CString t3, CString t4)
{
team.Add(t1);
team.Add(t2);
team.Add(t3);
team.Add(t4);
}
and i've tried this one also and by the way what is LPCTSTR??
Group::Group(LPCTSTR t1, LPCTSTR t2, LPCTSTR t3, LPCTSTR t4)
{
team.Add(t1);
team.Add(t2);
team.Add(t3);
team.Add(t4);
}
What is going on??? Thanks heap for you help
|
|
|
|
|
Hm, maybe there's a problem with the team member variable. How it is defined?
A LPCTSTR is a const pointer to an ASCIIZ string. If it's really ASCII/ANSI or Unicode depends on your compiler settings.
Martin
|
|
|
|
|
looks like you're using a type called "string" somewhere, but you haven't #include'd the appropriate header.
where does the syntax error occur??
LPCTSTR is a pointer to an array of TCHARs. a TCHAR is some character type (char, wchar, etc) depending on your build settings.
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|
|
The code
Group groupA("France", "Senegal", "Uruguay", "Denmark"); is not passing CString objects to the constructor.
This code
Group groupA(CString("France"), CString("Senegal"), CString("Uruguay"), CString("Denmark")); is.
The code
Group::Group(LPCTSTR t1, LPCTSTR t2, LPCTSTR t3, LPCTSTR t4) should work unless team.Add(...) is also wanting a CString object.
Hope this helps...
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
LPCTSTR = Long Pointer Constant To String Portable for UNICODE.
If you use the CString constructor you must pass CString objects not a char*
You can cast them directly
Group (CString ("France"),...)
but it is not worth it becasuse it will create some useless objects.
Use LPTSTR = Long Pointer To String Portable for UNICODE. You can see it is not a constant.
Best regards,
Alexandru Savescu
|
|
|
|
|
yeah, i understand it now. however it keeps produce another error.
this my class definition for the Group Class
class Group
{
public:
Group::Group(CString t1, CString t2, CString t3, CString t4);
CString Group::GetTeam(int i);
void Group::PutResult(int t1, int s1, int t2, int s2);
void Group::GetLadder();
private:
CStringArray team;
int res[4][4];
};
and this is my implementation for the constructor:
class Group
{
public:
Group::Group(CString t1, CString t2, CString t3, CString t4);
CString Group::GetTeam(int i);
void Group::PutResult(int t1, int s1, int t2, int s2);
void Group::GetLadder();
private:
CStringArray team;
int res[4][4];
};
and this is how i used it in the Doc
Group groupA(CString("France"), CString("Senegal"), CString("Uruguay"), CString("Denmark"));
and this is the error it produces
unexpected 'class CString ('
Regard
|
|
|
|
|
1. It looks that you missed the copy paste thing. The implementation and the source code look the same [ ]
2. Why do you prefix the functions inside the class?
class A
{
int A::f (); // you can say int f()
}
Best regards,
Alexandru Savescu
|
|
|
|
|
yes indeed, i missed the copy and paste
the function looks like this:
Group::Group(CString t1, CString t2, CString t3, CString t4)
{
team.Add(t1);
team.Add(t2);
team.Add(t3);
team.Add(t4);
}
and thanks for the tips, i did not know it before since i've just been working with MFC for 1 week.
|
|
|
|
|
I have this line in debug window:
HEAP: Free Heap block 14993bc8 modified at 14993bf4 after it was freed
Can anyone tell me what is that exactly I what can I do to correct this error.
Tanks...
|
|
|
|
|
looks like you are writing past the end of the buffer. check all the places you write into the array and make sure your pointers are good.
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|
|
BUG: Exceeding Max Error Value in BCP Can Give Unhandled AV
ID: Q151592
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft SQL Server version 6.0
--------------------------------------------------------------------------------
BUG#: 13310 (6.00)
SYMPTOMS
When a BCP (Bulk Copy Program) operation exceeds the max error setting, an unhandled exception can be encountered with the BCP executable. This is controlled by the (-m) switch of the BCP.EXE, which defaults to 10 errors. The error you will receive will look similar to the following:
HEAP: Free Heap block 25c17c8 modified at 25c1894 after it was freed
CAUSE
If the max error value is exceeded, the bcp_exec function attempts to free a memory block twice. In some cases this results in an access violation while in other cases it can simply corrupt application memory.
WORKAROUND
Eliminate the errors from the BCP operation so that the max error value is not exceeded.
STATUS
Microsoft has confirmed this to be a problem in Microsoft SQL Server 6.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Keywords : kbprg SSrvBCP SSrvProg kbbug6.00
Version : 6.0
Platform : WINDOWS
Issue type :
Maxwell Chen
People say "No news is good news". Then, no bug is good bug!?
|
|
|
|
|
Martin Laporte wrote:
HEAP: Free Heap block 14993bc8 modified at 14993bf4 after it was freed
There is your answer: you freed a pointer (to a memory block) by using delete , delete[] , or free(...) , and then tried to use the pointer after that.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
Hi,
I am looking at a VC class that makes use of the Intel JPEG Library. The class is used to convert a BMP to jpeg.
My problem is the class only works with 24bit jpegs.
Is anyone familiar enough with JPEGS, to offer any advice on what is causing the dependency.
Cheers
Rich
|
|
|
|
|
does the Intel code read 8-bit JPEGs?
i use IJG's code. it works.
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|
|
I was under the impression that JPEG supports only 24bit color?!?
Signature space for rent. Apply Within.
|
|
|
|
|
JPEG can support single-channel 8-bit grayscale images, too. and, JPEG supports images with up to 12-bits per channel.
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|
|
I have an MFC application that appears to have a memory leak.
I read the article "Catching Memory Leaks" and placed the code in my application. Also used the MS example code to add some additional checkpoints inside the main loop of the program. The code executed inside the debugger for over 24 hours. There were no leaks detected. The memory usage reported by Task Manager was almost constant.
However, I took the same debug .EXE file and executed it on a Windows XP platform. After 24 hours the memory usage, as reported by Task Manager, increased by about 30MB and continued to increase the longer the program ran.
The program uses the GetBufferSetLength and ReleaseBuffer functions which are my primary suspects. The documentation for ReleaseBuffer is a bit cryptic. The CString to which they are applied though is declared in an OnTimer routine and definitely goes out of scope each pass.
Any ideas what I should try next? The biggest problem is not being able to do much in the way of diagnostics on the target system.
TIA...
>>>-----> MikeO
|
|
|
|
|
Have you tried setting up a remote debugging session?
Thta should help you track it down if its OS dependant.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Roger Allen wrote:
Have you tried setting up a remote debugging session?
I'm not familiar with how to do this. Is there a how-to guide available here on CodeProject?
>>>-----> MikeO
|
|
|
|
|
Recapping the situation: I have an app compiled for Debug which while running under the debugger is fine. If I execute the same app stand-alone it appears to have a memory leak. As suggested earlier, the stand-alone platform was configured for remote debugging.
Under Debug, Task Manager reports the application using around 7MB of memory. Task Manager also reports the overall memory usage of the system to be around 110MB. While the app memory usage varies more than I would have expected, it has not gone over 10MB that I have observed while running in debug mode.
Running standalone Task Manager initially reports the application using the same 7MB amount of memory. After 8 hours of operation the memory usage of the application has increased around to around 10MB, and after 48 hours it is around 14MB. The overall memory usage reported after 8 hours though has increased by 30MB! and this value continues to increase linearly with time. After 48 hours the overall memory usage has exceeded 300MB.
I have placed memory leak detection code around the entire app and inside the app around the core functions. The inside code reports an occassional change in memory, but reports a reciprocal change later on. As noted, it doesn't leak under debug, so dumping statistics to the debug output window is not helping resolve the problem.
Any further suggestions for locating the cause of this problem would be appreciated. FYI, the stand-alone platform is XP though I do not know if this is significant.
>>>-----> MikeO
|
|
|
|
|
Hi,
How to get MODEMDEVCAPS by calling GetCommProperties ?
MDN says that COMMPROP.wcProvChar contains MODEMDEVCAPS
wcProvChar is widechar, How to get MODEMDEVCAPS structure from COMMPROP.wcProvChar ?
Thanks,
Perumalla Koteswara Rao, (B.Tech)
Hyderabad, Inida
|
|
|
|
|
Can I using CTreeCtrl show only some folders, for example:
Show all folders in (C:\\winnt\)
excluding rest disks etc ... ?
thank you!
==============
www.design.kg
|
|
|
|
|
|
Offcourse u can, if you are programming the TreeCtrl
yourself. Can u be more specific abt ur requirements ?
|
|
|
|