|
main program reads same vector variable not thread.
|
|
|
|
|
Hi,
Because u r using multi-threading application you SHOULD sync ur work using critical sections, events, semaphores,...
your program runs well now, but when the thread writes to the variable at the same time as the main thread reads it, the value read by the main thread will be out-of-date, it is not the current value of the variable.
Furthermore, if you don't use the keyword volatitle in declaring shared variables, the compiler may perform wrong optimizations to speed the code up, and you may get wrong results.
-Always take the safest way
Regards,
Mohammad Gdeisat
|
|
|
|
|
|
Another concern is a possible program crash. When vectors are changed, all iterators are invalidated. So if the main function has an interator and is in the process of reading the data, the thread could interrupt and add something to the vector. Now the main function has an invalid iterator. The problem with not using synch methods is that the errors may not be noticed for months. You could think all is well and then one day, your program crashes while doing the same thing it's been doing all along.
Shawn
|
|
|
|
|
i need to be able to delete the browser history. also it would be a big help to be able to delete temporary internet files. thanks
|
|
|
|
|
deleteurlcacheentry is a function, use it.
however you need to know the exact url that you want to delete
hope this helps you
peace
|
|
|
|
|
I declared a variable through ClassView>Add Member Variable in my Cview.
I included header in my MainFrm.cpp.
How to use the variable because it doesnt recognise my variable. Do I need to make an object inside my MainFrm.cpp?
I tried to use
CProgView cview;
cview.myvariable;
but it says cannot access protected member declared in class.
Thanks
|
|
|
|
|
Add Member Variable with 'public',not 'protect', than you can access it.
|
|
|
|
|
It is public variable from CView. I use it in CDoc, how to declare it? THanks
|
|
|
|
|
Thx Astham
There are 3 kinds of member variables/functions:
public:
Can be used/called by objects of any class
private:
Can be used by objects of this class only
protected:
Can be used by objects of this class and derived classes only.
So if you want to use the variable from somewhere else than a CProgView member
function, you need to make the variable public. If you use Add Member Variable
there's three radio buttons at the bottom of the dialog. Or you could just write
public: at the line before the variable declaration.
THis is my header code,
public:
float pointX[100];
float pointY[100];
virtual ~CMyProgView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif ]
This is my public variable declaration. Why cant I use it?
How to use it from my CMyProgDoc? I have #include CMyProgView.h and use it such as below:
CMyProgView obView;
obView.pointX[i] = something;
|
|
|
|
|
When you right click a RichEdit Control.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Does anyone know how to find a local group's permissions? I am enumerating through the local groups on my machine using the NetLocalGroupEnum API, but when I check the group using the NetLocalGroupGetInfo API, I only get two pieces of information that I don't need:
1 The group's name - already have, don't need again
2 The group's description - doesn't serve my purpose
Are there any APIs or methods that I can use to find if a local group is an admin group? I've spent many many hours working on this problem and I am getting a little frustrated.
|
|
|
|
|
Hi, in my VC7 app, I would like to record calls to a dll that I have made using my GUI part and be able to play them back if I need the same sequence again. Any suggestions on how to start, where to look?
Paul
|
|
|
|
|
hello
how do I send a key combination to a window like for example ctrl+c. I have tryed with keybd_event and SendInput but I could not send more than one key. Is there a way to send a key combination to a window?
thank you
|
|
|
|
|
Hello!
I had such a problem a year ago,
I didn't find a good answer so I decided
to 'Put a hidden BUTTON on the dialog' and use '&' to give it a shortcut to a On... Message.
It solved my problem temporarily! but it's not a good way I think.
But I'm a begginer yet.(I started VC++ about a year ago).
|
|
|
|
|
|
Hi, in the code of dll, I need to extract the full path of a file at runtime. Any suggestions?
paul
|
|
|
|
|
Hello!
Perhaps this will solve your problem:
FILE *fp;
CString fileName,s;
GetModuleFileName(NULL,s.GetBuffer(512),512);
s.ReleaseBuffer();
//remove executable file name
s.Delete(s.ReverseFind('\\'),s.GetLength()-s.ReverseFind('\\'));
fileName=s;
fileName+="\\File Name In Your Project Folder (for example)";
OK?;)
|
|
|
|
|
Unfortunately not, since the path of the .exe is unknown (the dll who should determine the path is called thru COM)
Anyways, thanks for your answer!
Paul
|
|
|
|
|
I'm sorry.
I know almost nothing about COM and it's problem.
I'm a begginer yet
|
|
|
|
|
HI Mr Paul!
you have to write following code in your DllMain of DLL (wither Com or simple)
For Getting the path of DLL
DllMain<code>(HINSTANCE hInst</code>,...)
{
.......
case DLL_PROCESS_ATTACH:
char szfileName[MAX_PATH];
GetModuleFileName(<code>hInst</code>,szfileName,MAX_PATH);
char szDriveName[3];
char szDirectoryName[MAX_PATH];
_tsplitpath(szfilename,szDriveName,szDirectoryName,NULL,NULL);
sprintf(szfileName,"%s%s",szDriveName,szDirectoryName);
}
For Getting path OF Application calling your DLL
--Just change GetModuleFileName api first Parameter from hInst to NULL , and proceed in same way.
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Thanks! this one worked!
Paul
|
|
|
|
|
I would like to write an app that can send video/images out the S-Video out port of my graphics card. I don't want to have to rely on the secondary monitor and 'extend desktop' functions of the graphics card to be able to display the video in my application on a tv monitor. So, I'm wondering if the S-Video out, or Composite Video out on my graphics card can be directly accessed by my Visual C++ app. I've searched the web, the MSDN library, and the ATI site (I have a Radeon ViVo card), but can't find any references to doing this. Is it at all possible? Any help or comments would be greatly appreciated.
|
|
|
|
|
I would like to find out how to extract the visual wave of an audio file(mp3, wave, wma, etc). I have absolutely no idea how to do this or even where to begin. Ahead Nero can do this, also WMP do this as a visualization.
I use Borland C++, and would like to develop for multiple platforms.
thank you
butt to seat ppl
gunigugu
|
|
|
|
|