|
Just in case I wan't clear about it - I agree with Matthew Faithfull.
And interestingly enough, quick Googling shows that there seems to be few implementation of Reflection in C++.
http://www.extreme.indiana.edu/reflcpp/
Hey, Its C++, It can do everything ...
|
|
|
|
|
I am developing an app which will fetch addresses from the GAL. I need the email address of the users. I get those in the exchnage format (Electronic mail format)
for eg. /c=US/a=att/p=Microsoft/o=Finance/ou=Purchasing/s=Furthur/g=Joe
and need those in
I am using Exchange SDk to fetch the contacts from GAL.
for e.g : xyz@fgh.com
"A winner is not one who never fails...but the one who never quits"
|
|
|
|
|
Hi for all
I've created a program that triggers some threads.
I don't get to use the syncronization. Some threads are triggered before others.
I created a class called ResourceObject. This is a simple class with a boolean value and a CRITICAL_SECTION value:
<br />
ResourceObject::ResourceObject()<br />
{<br />
m_bLocked = false;<br />
InitializeCriticalSection(&m_ResourceSection);<br />
}<br />
ResourceObject::~ResourceObject()<br />
{<br />
DeleteCriticalSection(&m_ResourceSection);<br />
}<br />
<br />
void ResourceObject::LockResource(unsigned int uiTimeToSleep)<br />
{<br />
EnterCriticalSection(&m_ResourceSection);<br />
m_bLocked = true;<br />
Sleep(uiTimeToSleep);<br />
LeaveCriticalSection(&m_ResourceSection);<br />
}<br />
<br />
void ResourceObject::ReleaseResource()<br />
{<br />
EnterCriticalSection(&m_ResourceSection);<br />
if(m_bLocked)m_bLocked = false;<br />
LeaveCriticalSection(&m_ResourceSection);<br />
}<br />
In another class I have this struct that have a pointer to a ResourceObject
<br />
typedef struct LineText<br />
{<br />
FloatText * Line;<br />
bool bShow;<br />
float fTimeWait;<br />
ResourceObject * resource;<br />
}TextLine;<br />
In the same class I have the following codes:
- the first is how I create a thread;
<br />
idThread[m_iLineCount] = CreateThread(NULL, 0, Helper::TextThread, (void*)&Lines[m_iLineCount], CREATE_SUSPENDED, NULL);<br />
- the second is the thread:
<br />
DWORD WINAPI Helper::TextThread(void * vData)<br />
{<br />
LineText * temp = (LineText *)vData;<br />
temp->resource->LockResource(2000);<br />
temp->bShow = true;<br />
temp->resource->ReleaseResource();<br />
return 0;<br />
}<br />
- the third is when I Resume the threads and show some text;
<br />
void Helper::ShowImages()<br />
{<br />
for(int i = 0 ; i < m_iLineCount ; i++)<br />
{<br />
ResumeThread(idThread[i]);<br />
if(Lines[i].bShow)Lines[i].Line->PrintText();<br />
}<br />
}<br />
The threads must have to follow the sequence in that they are resumed, but they don't. Even the first thread is started with the resource, it is not the first to show the text.
Anyone can help me to solve this problem?
Thanks
|
|
|
|
|
If you want multiple threads to pass through a single function in predetermined order you're going to need a master thread to manage them and each one will have to wait to be signalled. I would add an Event to your one-per-thread structure, have each worker wait on its event and then have the main thread signal each event and wait for it to be reset by the signalled thread before singalling the next one. Have the worker reset its event after it has executed your controlled function. I can't see why you'd want to do this as it seems to negate any real benefit of threading but it's your project
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Not sure I understand, you want to use multiple threads to perform sequential operations?
|
|
|
|
|
More or less.
Like you've seen in my code, I have a thread that receives a structure. I have about 10 structures that have different values of text. And I need to show these texts in some moment. At the moment I need to show these values sequentially, but in any other time I would need to show these texts in any other sequence. Just like that, I create the ResourceObject class. I have a pointer to an object of this type in my structs. The first started thread access this object and the others wait.
I called the threads sequentially thinking that the calling order have been respected, with one thread at time access the resource and release it.
|
|
|
|
|
Alex Cutovoi wrote: More or less.
What? You don't know? How are we supposed to help you if you can't specify exactly what your requirements are.
Alex Cutovoi wrote: I need to show these texts in some moment.
I have no idea what that means. I am not familiar with "Moment Based Processing".
Look the bottom line is that trying to use multiple threads to execute sequential operations is like putting a square peg in a round hole. It doesn't seem your approach is the appropriate solution to your problem, whatever that is.
|
|
|
|
|
Look, I'll explain better.
What I really want is the threads access the resource in the order that they started. What that is not occur at the moment.
Example, I have 4 thread(thread1, thread2, thread3, thread4).
If I start the threads in a sequence like thread4, thread2, thread1, thread3, the threads must access the resource in this sequence. Even with the CriticalSection, this is not occur. The threads access the resource in an arbitrary order. The only thing that works is that the resource is accessed for one thread at a time.
I've tried to put a mutex to guarantee this type of access but I didn't get the expected results.
This is EXACTLY what I want.
|
|
|
|
|
Alex Cutovoi wrote: Look, I'll explain better.
Alex Cutovoi wrote: This is EXACTLY what I want.
No that is not an explanation of the "requirements". What "you want" has nothing to do with what "the requirements" are. Do you have requirements for sequential operations? Yes or no? If yes then threads are not an appropriate solution even if you "want" to use threads.
Note: You should never "want" to use threads. They should be used as a last resort, only to satisfy specific requirements.
|
|
|
|
|
You're right, but unhapilly I solved my problem.
Thanks
|
|
|
|
|
Please, can anyone provide me help on this. I am creating an application where I need to create multiple image controls (or maybe a GDI+ graphics on that control) with transparent background on CFormView. These controls will provide user the ability to move, resize or select the control. I am stuck on this from long time and not able to find any solution. I will be very greatful if someone can provide me help on this.
Thanks,
Selvaraj
|
|
|
|
|
kcselvaraj wrote: I am stuck on this from long time and not able to find any solution.
Can you be more specific about what part(s) you're stuck on?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
I am writing an application where I have CFormView as a "Preview Image". I want to create a windowless/traparent control on which I can use TextBox or GDI+ drawing and user can select, move and resize the control. User can select a graphic from list of graphics like ellips, circle, rectangle or checkmark and place it on "Preview Image". I want to know how can I create such a control?
I will be really greatful to you if you can help me out with this.
Selvaraj
-- modified at 6:31 Wednesday 4th July, 2007
|
|
|
|
|
I am creating a library that is using a library that has a function implemented called xlAutoOpen. I wrote a function called xlAutoOpen, how do I in my .def file tell the linker to reference the one I wrote?
I am getting errors like these because the linker isn't sure which
function I am referencing...
1>curve.def : warning LNK4022: cannot find unique match for symbol
'xlAutoOpen'
1>curve.def : warning LNK4002: "int __cdecl xlAutoOpen(void)" (?
xlAutoOpen@@YAHXZ) defined in .\release\Generic.obj
1>curve.def : warning LNK4002: _xlAutoOpen@0 defined in .
\Univswap.lib
1>curve.def : warning LNK4002: _xlAutoOpen@0 defined in .\Univyld.lib
1>curve.def : error LNK2001: unresolved external symbol xlAutoOpen
These functions are essential because they are the required functions
for this interface I am using.
Thanks
|
|
|
|
|
This is just a guess, but if your xlAutoOpen file is written in c++, it will have a decorated name (to cope with different parameters)
I suspect all you'll need is to declare it as:
extern "C"
{
XXXX xlAutoOpen (....)
}
or the like.
While that's hardly a full solution, I hope it points you in the right direction.
Iain.
|
|
|
|
|
Hey all,
I have several projects that I want to complete that involve USB devices. I was wondering if there is any generic way to grab the output and input to any USB device.
I'm not looking for anything too clean, just something that works for the moment, as I will spend time adjusting the method to my various projects.
At any rate, is there a generic way to access the output and input of any USB device in windows? (or even just grab the output?)
thanks,
- legit
legit-tech.net
|
|
|
|
|
legit wrote: I was wondering if there is any generic way to grab the output and input to any USB device.
No, there isn't.
Anyway, try to post your question to the Hardware forum.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
Please provide the links / documents for Microsoft Windows NT / XP / Vista arhitecture.
Anything regarding the MS Windows programming using C++ language highly appreciated.
Thanks & Regards,
Neeraj
|
|
|
|
|
link[^]
Last modified: 24mins after originally posted --
|
|
|
|
|
So basically you want us to search for you and provide you with the links?
______________________
stuff + cats = awesome
|
|
|
|
|
leckey wrote: So basically you want us to search for you and provide you with the links?
Wait...isn't that what we usually do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
|
This is first time in 3 years I got such a rediculous reply.
led mike , leckey and Mark Salsbery -- Not required your useless replies. Bullshit guys.
Thanks Nemanja Trifunovic - for that useful link.
Note for all: I hope this site is to help or make use of each other for studing or solving problems.
It is rediculous of making fun of people seeking help.
Regards,
Neeraj
|
|
|
|
|
Hi,
I need to search for hard coded strings from the VC++ 6 / VC++.Net 2003 source code.
Is there any tool for this?
Is there any criteria to define the search for this?
Regards,
Neeranjan
Thanks & Regards,
Neeraj
|
|
|
|
|
Neeranjan wrote: Is there any tool for this?
What's wrong with the IDE itself?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|