|
You are not changing anywhere this variable?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
no
just a global variable that i set before i begin any threads..
after threads begin..they just need to read the variable/object.
|
|
|
|
|
And in the object, are they changing any data concurently?
Or its just read read situation?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
a read read situation..
just in case that i change any data .. i use make synchronization inside the function that make the change.
|
|
|
|
|
Shouldn't have a problem.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
thanks..
just wanted to make sure
|
|
|
|
|
If there is any chance that some threads might be READING the data while others are changing it EVER, then you will have trouble unless you synchorize the readers ALONG with the writers.
If the data is only written before any of your reader threads start up, you are safe.
|
|
|
|
|
I can't get Chris Maunder's grid control to work. Get this:
Linking...
GridCtrl.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CTitleTip::~CTitleTip(void)" (??1CTitleTip@@UAE@XZ) referenced in function __unwindfunclet$??0CGridCtrl@@QAE@HHHH@Z$0
GridCtrl.obj : error LNK2019: unresolved external symbol "public: __thiscall CTitleTip::CTitleTip(void)" (??0CTitleTip@@QAE@XZ) referenced in function "public: __thiscall CGridCtrl::CGridCtrl(int,int,int,int)" (??0CGridCtrl@@QAE@HHHH@Z)
GridCtrl.obj : error LNK2019: unresolved external symbol "public: void __thiscall CTitleTip::Hide(void)" (?Hide@CTitleTip@@QAEXXZ) referenced in function "protected: void __thiscall CGridCtrl::OnHScroll(unsigned int,unsigned int,class CScrollBar *)" (?OnHScroll@CGridCtrl@@IAEXIIPAVCScrollBar@@@Z)
GridCtrl.obj : error LNK2019: unresolved external symbol "public: void __thiscall CTitleTip::Show(class CRect,char const *,int,struct tagRECT *,struct tagLOGFONTA const *,unsigned long,unsigned long)" (?Show@CTitleTip@@QAEXVCRect@@PBDHPAUtagRECT@@PBUtagLOGFONTA@@KK@Z) referenced in function "protected: void __thiscall CGridCtrl::OnMouseMove(unsigned int,class CPoint)" (?OnMouseMove@CGridCtrl@@IAEXIVCPoint@@@Z)
Debug/gc.exe : fatal error LNK1120: 4 unresolved externals
Help!!!!!!!!!1
|
|
|
|
|
Seems like a file is missing from the project
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I've used the AfxbeginThread function before with a global function, but is there a way I can use it with a member function of the object it's operating in? When I try to use it here, I get the following error message:
error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'UINT (LPVOID)'
and here is the function declaration:
UINT Parse( LPVOID pParam );
If it's broken, I probably did it
bdiamond
|
|
|
|
|
declare it as a static function
A member function has a thiscall convention, so it has an additional this parameter passed.
When you declare it static this wont be passed anymore, thus fixing your problem
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
thanks!! just what I needed!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
that was what I needed, but now I get errors because I tried to call a non-static member function within the procedure,(BeginWaitCursor), but there's also other ones.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Several options:
1. Pass this into the parameter to the thread and call the functions
2. Send a message to the original window and handle them
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I got it!! What I did was pass the 'this' pointer as the LPVOID argument and cast it to a pointer of the type of my dialog class, then use that pointer to reference the controls and member variables. Thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I can #include <vector> in the header file for a class I've created, but I can't put a vector<cstring> declaration in my header file. I figured I needed the stuff from stdafx.h in my header file also, so I tried to #include that in my header file instead of the .cpp file, but I get an error telling me that there was an error looking for the precompiled header directive. How can I use vector properly in my class?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
<small><b>bdiamond wrote:</b></small>
<i>ForumVisual C++
Subject:Re: vector problem
Sender:bdiamond
Date:11:19 1 Jun '04
I can #include in the header file for a class I've created, but I can't put a vector declaration in my header file</i>
?? Why not?
You can put in yourheader.h
#include <vector>
using namespace std;
class CFish
{
public:
vector<int> m_nIntVec;
};
and it works quite happly.
<small><b>bdiamond wrote:</b></small>
<i>I figured I needed the stuff from stdafx.h in my header file also</i>
No. Never include stdafx.h in a header. include stdafx.h should always be the first include in a .CPP and any other includes that follow will have stdafx.h already included.
|
|
|
|
|
I forgot the 'using' directive. thanks!!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I am getting problem while displaying chart (V.T.Chart Error)
Can anyone let me know why it is comming.
Thanks
|
|
|
|
|
Theme of code:
Draw to Memdc
in OnDraw
Stretch over the clientDc
Save the dc content to the image file
Problem faced
Well this code is executed in starting time i.e. 1-2 turn when the function is called it will display the things drawn on the view. Even when we save bitmap it does save to BMP file (3.6Mb)
After 1-2 turns it makes screen blasnk and the MemDC contains nothing. Even when MemDC is saved as Bitmap file then it makes BMP file of 1*1 pixel and of size 70 bytes.
What can be the problem? My MemDC is member variable of the class.
<br />
<br />
void CMyView:rawWFRDiagram(int Velocity)<br />
{<br />
char cc[10];<br />
int maxdelay = -1;<br />
CPatternDoc *pDoc = GetDocument();<br />
<br />
CSize sizeTotal; <br />
sizeTotal.cx = 590; sizeTotal.cy = 1100;<br />
SetScrollSizes(MM_LOENGLISH, sizeTotal);<br />
<br />
CClientDC ClientDC(this);<br />
OnPrepareDC(&ClientDC);<br />
<br />
ClientDC.SetMapMode(MM_TEXT);<br />
m_WfrBmp -- Member of CMyView of type CBitmap<br />
m_WfrBmp.DeleteObject (); <br />
m_WfrBmp.CreateCompatibleBitmap(&ClientDC, 860, 1100);<br />
MemDC.CreateCompatibleDC(&ClientDC); <br />
CBitmap *pOldBitmap = MemDC.SelectObject(&m_WfrBmp);<br />
MemDC.SetMapMode(MM_TEXT); <br />
MemDC.PatBlt(0, 0, 860, 1100, WHITENESS); <br />
<br />
Draw anything further to the MemDC<br />
<br />
<br />
MemDC.SetMapMode(MM_LOENGLISH);<br />
if(ClientDC.StretchBlt(50, 0, 860, -1100, &MemDC, 0, 0, 860,<br />
-1100, SRCCOPY) == FALSE)<br />
AfxMessageBox("Failed to draw WFR diagram"); <br />
}<br />
<br />
OnDraw()<br />
{<br />
pDC->StretchBlt(50, 0, 860, -1100, &MemDC, 0, 0, 860, -1100, SRCCOPY);<br />
<br />
}<br />
Help me to solve this problem?
Thanks in advance
Sandeep
Leave your mark wherever you go
|
|
|
|
|
Well in plain words my problem is that i have to draw on the view
and also in the memory device context, which will be used for storing the device context conte to the image file
If you can provide guideline and suggestions then it will be helpful.
NOTE
1.0 I have to keep CDC MemDC ( Memory device context) member of the class so that i can write it in the drawing function and then i can use the same in another function of the class to store it in the image
2.0 In OnDraw i have to render the memdc content on the view. Thats what i was doing? On running the application and trying the drawing function 1-2 times it just draws, but after that it does not draw and same 1*1pixel bitmap
<br />
OnDraw()<br />
{<br />
pDC->StretchBlt(50, 0, 860, -1100, &MemDC, 0, 0, 860, -1100, SRCCOPY);<br />
}
3.0 I want to know that does the following schema is ok?
memdc.createcompatibledc()
bmp.createcompatiblebitmap()
CBitmap *old =memdc.selectobject(bmp);
DO THE DRAWING HERE
memdc.selectobject(old)
another query related to this is that
does this will not effect my memdc.stretchblt in the onDraw.
What i mean is when i select anaother bitmap then does my mainbitmap on which i had drawn still carries the drawing and can i use that for saving as bitmap file?
Would it not affect that bitmap file?
If you can provide the sample code taking above points in consideration than i will be greatfull? Well also point out any mistake.
Leave your mark wherever you go
|
|
|
|
|
You having a 1 X 1 pixel bitmap in your memdc tells me that the bitmap selected into it is the original default bitmap that all memdcs have. You have at some point selected your bitmap out of the memdc.
If I were you, I would make the bitmap (CBitmap or HBITMAP) a member of your class. That way you only have to create it once. Select it into a memdc to draw on it, and select it out again when done. You can then pass that bitmap to your save function.
Remember, it is the bitmap that stores your image, not the DC. The DC is just the means that you use to draw onto a bitmap.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
The following code, which compiles just fine on VC6, apparently causes the VC7.1 (and presumably VC7.0) compiler to wet it's pants. I don't understand why?
#include <string>
class String {
public:
~String() { };
String(){};
String(const String& rhs) {
*this = rhs;
}
String(const std::string& rhs) {
};
};
class Path {
public:
Path() { };
Path( const String& filename );
Path( const Path& filePath );
virtual ~Path() { };
inline Path& operator= ( const Path& path ){
filename_ = path.filename_;
return *this;
}
inline Path& operator= ( const String& filename ) {
filename_ = filename;
return *this;
}
inline operator String () const {
return filename_;
}
inline operator String& () {
return filename_;
}
public:
String filename_;
};
class ConversionClass {
public:
ConversionClass() {
}
String getFileName() {
return filePath_;
}
Path filePath_;
};
int main(int argc, char *argv[])
{
ConversionClass* conversionClass = new ConversionClass();
String s = conversionClass->getFileName();
return 0;
}
The actuall warning/error is:
d:\code\junk\cvt\Conversion_c.cpp(68) : warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied
while calling the constructor 'String::String(const String &)'
d:\code\junk\cvt\Conversion_c.cpp(13) : see declaration of 'String::String'
Any thoughts, suggestions on how to get rid of this would be most welcome, and I'll be sure to have Bob send you a cookie
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
You could try this
Change
String getFileName()
to
const String& getFileName()
Ant.
|
|
|
|
|
Or probably better
String getFileName()
{
return (String)filePath_;
}
Ant.
|
|
|
|