|
deadlyabbas wrote: ShellExecute(0,
"Open",
"%s\\HELP\\RiverCADPro_User_Manual.pdf",
NULL,
NULL,
SW_MAXIMIZE
question remain, do you want to load that in Adobe reader or in your application itself
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Please the questin attached to your reply ............
Yes I want to load the PDF and want to show the bookmarks also
|
|
|
|
|
Here is my code:
vector<int> CPanoCylinderImage::RGBofPixel(CImage image, int x, int y)
{
vector<int> vect;
COLORREF cr = image.GetPixel(x, y);
BYTE r = GetRValue(cr);
BYTE g = GetGValue(cr);
BYTE b = GetBValue(cr);
vect.push_back((int)r);
vect.push_back((int)g);
vect.push_back((int)b);
return vect;
}
float CPanoCylinderImage::IntensityOfPixel(CImage image, int x, int y)
{
vector<int> vect = RGBofPixel(image, x, y);
return 0.30f * vect.at(0) + 0.59f * vect.at(1) + 0.11f * vect.at(2);
}
float CPanoCylinderImage::LuminanceDifference(CImage image1, CImage image2, int length)
{
float diff = 0.0;
float sum = 0.0;
float intensity = 0.0;
vector<float> vectImage1, vectImage2;
for(int i = 0; i < image1.GetHeight(); i++)
{
for(int j = image1.GetWidth() - length; j < image1.GetWidth(); j++)
{
intensity = IntensityOfPixel(image1, j, i);
vectImage1.push_back(intensity);
}
}
return ;
}
image1 and image2 have been loaded correctly.When I calculate intensity first time, I got the right RGB value and intensity value. But second time, I got Debug Assertion Failed when it run statement "COLORREF cr = image.GetPixel(x, y);", messagebox told me that
File: ...........\atlimage.h
Line: 1217
Expression: hBitmap == m_hBitmap
Anybody know what's happening?
modified on Thursday, September 17, 2009 4:03 AM
|
|
|
|
|
Why don't you pass the CImage object by reference?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank u! U solved this problem. Can you tell me why I failed?
|
|
|
|
|
Well, I don't know, exactly. Anyway using a copy of the image object is wrong, you need to use the actual instance.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi All,
MFC(VC++)
I have a shared folder in server, client will access that folder through a dilaog box.
I have to give username, password of server in the program.
Please help me.
Thanks
Ranjith
|
|
|
|
|
Have a look at this [^] CP article.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks pallini for reply.
I read that artical but it will work only for local system, but I have to connect to onother(server) macine through WAN.
Ranjith
|
|
|
|
|
Use NetUseAdd() for this.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thank you,
NetuseAdd() function need to link with netapi32.lib but I am unable to download that files.
I am using windowsXP as client and windows 2003 server as server.
ranjith
|
|
|
|
|
ranjithgoud wrote: NetuseAdd() function need to link with netapi32.lib but I am unable to download that files.
You don't need to download anything. That file is already in your Visual Studio folder.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
CImage imageOriginal;<br />
imageOriginal.Load(_T( "read.tif" ));<br />
<br />
<br />
CRect rectCopy(9177,68, 10566, 635);<br />
<br />
CImage imageNew;<br />
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());<br />
imageOriginal.BitBlt(imageNew.GetDC(), rectCopy, rectCopy.TopLeft());<br />
imageNew.Save(_T("D://imgnew.jpg"));<br />
<br />
imageNew.ReleaseDC();
when i pass the 9177, 68 ,10566,635 these rectangular portion ..the output of image contains only black.
the whole area of images are black ...how to pass these rectagular portion ..??
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
rajugis wrote: imageOriginal.BitBlt(imageNew.GetDC(), rectCopy, rectCopy.TopLeft());
That's wrong. you should use, for instance:
CRect rect(rectCopy);
rect.OffsetRect(-rectCopy.left, -rectCopy.top);
imageOriginal.BitBlt(imageNew.GetDC(), rect, rectCopy.TopLeft());
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thank for your replay
CImage imageOriginal;
imageOriginal.Load(_T( "read.tif" ));
CRect rectCopy(9177,68, 10566, 635);
CImage imageNew;
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());
CRect rect(rectCopy);
rect.OffsetRect(-rectCopy.left, -rectCopy.top);
imageOriginal.BitBlt(imageNew.GetDC(), rect, rectCopy.TopLeft());
imageNew.ReleaseDC();
imageNew.Save(_T("D://imgnew.jpg"));
still its showing the whole area of image is black
???
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
See this[^] answer to your question.
|
|
|
|
|
Why don't you start with 'fail-proof' parameters?
For instance you may start copying from the origin (top-left) of the source image.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The problem with my custom threadpool (fun activity, not commercial) is this:
I have, say 5 threads running, a global counter of how many pieces of work there are, and a work event which should be unsignaled (reset) when there is no work, and signaled (set) when there is work, because when there is no work, the threads simply wait on this event. I have two methods PushWork() and PopWork(). PushWork() increments the global counter by 1 using an interlocked operation, and checks "if I just incremented the global counter to 1, SetEvent()". PopWork() decrements the global counter by 1 using an interlocked operation, and checks "if I just decremented the global counter to 0, ResetEvent() and wait on the event".
The problem is a race condition. Imagine if the work queue is currently empty.
PushWork() gets called, and increments the counter to 1.
Then, PopWork() gets called and decrements the counter to 0.
PopWork(), running faster than PushWork() (for whatever reason) resets the event.
PushWork(), chugging along, then sets the event.
Now, we have a no more work in the queue, but the event is set, so the threads keep polling the queue for work. There is a similar problem for the other way around. Imagine if the work queue currently has one item.
PopWork() gets called, and decrements the counter to 0.
Then, PushWork() gets called and increments the counter to 1.
PushWork() sets the event.
PopWork() resets the event.
Now, there are work items in the queue, but the threads will stop running as soon as it hits the event.
The reason why this can occur is because modifying the counter and setting/resetting the event are not atomic. I could simply wrap both of these with a critical section, but I think the overhead is too big, since it means that for every piece of work, there are two EnterCriticalSection() calls and two LeaveCriticalSection() calls, one for each of push and pop. I've been trying to find a way to do this without locks. Does anyone have any ideas?
INFO: I use a combination of global work queues and local work queues (one per thread) as per modern threadpooling implementations with work-stealing queues. I do, however, have one global counter for all the work. I've entertained the idea of using different counters but don't see how that would solve my problem.
|
|
|
|
|
Cyrilix wrote: The reason why this can occur is because modifying the counter and setting/resetting the event are not atomic. I could simply wrap both of these with a critical section, but I think the overhead is too big, since it means that for every piece of work, there are two EnterCriticalSection() calls and two LeaveCriticalSection() calls, one for each of push and pop. I've been trying to find a way to do this without locks. Does anyone have any ideas?
1. Lock-free programming is *very* difficult - and I don't think can be done for your specific case of multiple, unconnected actions.
2. If the overhead of calling critical section is significant compared to amount of work being done in the thread, your work items are much too small.
You need to make your two actions atomic - the only way to do that is to serialize access to a combination of work queue and event, using a mutex or critical section.
A different way might be for the thing that's pushing the work to select the thread that's to do the work and, by having an event per thread, signal the selected thread to pick up a work item. If there are no waiting threads, do nothing. And when a thread enters a waiting state, it can look at the work queue before entering the waiting state and pick the next work item.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You need to make your two actions atomic - the only way to do that is to serialize access to a combination of work queue and event, using a mutex or critical section.
I sort of figured that might be the case.
If the overhead of calling critical section is significant compared to amount of work being done in the thread, your work items are much too small.
What I use for work items is something in the order of a hundred multiplications/divisions. So, for instance, say I want to multiply two square matrices matrices or equal size using the naive method, I split up the work so that each <column,row> entry of the resulting matrix is a single work item. If I have a 100x100 matrix multiplied by a 100x100 matrix, then that gives me 100 multiplications and 100 additions for each of 100x100 (10000) work items. This seems to really stress my threadpool implementation since the single-threaded version of this naive matrix multiplication is a lot faster, and it's definitely due to the overhead of my threadpool. I was thinking that a more efficient use of synchronization (if possible) might alleviate this problem, however, I haven't actually extensively profiled my program. What I do know, however, is that the vast majority of the time is being spent on queueing the work, rather than doing the actual work.
A different way might be for the thing that's pushing the work to select the thread that's to do the work and, by having an event per thread, signal the selected thread to pick up a work item. If there are no waiting threads, do nothing. And when a thread enters a waiting state, it can look at the work queue before entering the waiting state and pick the next work item.
OK, that's some food for thought. I'll think about this and see if I can implement something accordingly.
Thanks for your comments.
|
|
|
|
|
I was thinking with my suggested alternate solution that as you're using an event per thread, you could use a lock-free queue - there are plenty of implementations on the web if you Google for "lock free queue c++". It's a case of finding a trust-worthy one! This[^] may be useful, while this[^] may be of interest, as might this[^]. In fact, as all of those are by Herb Sutter, Herb Sutter's blog[^] is probably of interest!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Cyrilix wrote: The reason why this can occur is because modifying the counter and setting/resetting the event are not atomic.
Have you considered using Interlocked Singly Linked Lists[^] for your work que? This would make adding, removing and querying all atomic operations.
Using Singly Linked Lists[^]
Best Wishes,
-David Delaune
|
|
|
|
|
I've seen that series of documents, although I haven't considered it for my implementation, though I don't think it really solves the problem I have of trying to make "push/pop and signal" atomic.
It does however seem like it would have better performance than the standard locked queue.
Thanks for bringing it up.
|
|
|
|
|
Hi all. I want to create a desktop application "Web-Filter" that can block unwanted websites. That can block website having Porn, Drugs, Crime related content. That can block Advertisement/Banners and pop ups. That can block chatting. I don't know where to start even. Don't know the best library for this stuff. But I know C++. Can somebody help me please? Please guide me how can I make such an application.
|
|
|
|
|
|