|
Code-o-mat wrote: 1. is it possible to copy files to which i have only an ID list (so no "text representation" of the path like "c:\folder\file" and i can't get one either)?
Would SHGetPathFromIDList() help?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
|
|
|
|
|
Thanks for the reply!
Sadly, as i said in my post, SHGetPathFromIDList fails on IDLs of zipped files. The documentation says SHGetPathFromIDList works only on file-system objects, i guess a file compressed into an archive is no longer considered part of the filesystem, it's rather something like a virtual item.
Since i am able to look into a compressed archive and copy-paste or drag-drop items out of it in explorer my guess is that getting the shell to do the dirty work of uncompressing the files to some location should be possible. Maybe faking a drag-drop could work...i will do some research into this once i get some free time to do so.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
So in case anyone ever reads this and is curious about the result, i did the experimenting and as it seems the drag-drop "emulation" works, i used GetUIObjectOf[^] method to get an IDataObject for the "virtual" file inside the archive, i used the same method to get an IDropTarget for the folder i wanted to copy the file into and then i called DragEnter, DragOver (this is probably not needed) and Drop of IDropTarget, specifying the IDataObject i got and DROPEFFECT_COPY. This seems to do the job, the shell moves the file from the archive into the target folder.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
In my VS c++ console app i have the main thread processing input obtained by other secondary threads. The secondary threads use WaitForSingleObject to wait on either tcp input or wait to get the mutex back. These mutexes are used to control access to global buffers. Each secondary thread writes to a specific global buffer and when complete gives up the mutex. The main thread uses WaitForMultipleObjects to determine which buffer to read from, then, when done, turns the mutex back over to the secondary thread.
Problem is if the apps start up when there's a lot of data(messages) backed up I initially get a lot of reported empty buffers in the beginning and later when I get buffers they (the corresponding mutex) seem to be ignored by the main thread. This is what my log file shows. It may be that even my log file sequencing is questionable at this point.
Starting the processes like this would not be the norm but still it should all work even under these conditions.
Is it possible I have some kind of synchronization problem between the main and secondary threads? More details provided upon request.
Thanks
|
|
|
|
|
More information is needed in order to help you.
A common error when we use WaitForMultipleObject is the bWaitAll is not set correctly or an invalid handled is passed to the function.
Check this, if none of the above answers correspond to your issue.
Please provide us more information
|
|
|
|
|
Thanks for the hints. I created the threads as follows:
HANDLE mutexFIXHandle;
HANDLE mutexSetAlertTimer;
HANDLE mutexSetAWAYHandle;
mutexFIXHandle = CreateMutex(NULL, false, NULL);
mutexSetAlertTimer = CreateMutex(NULL, false, NULL);
mutexSetAWAYHandle = CreateMutex(NULL, false, NULL);
Based on first reply I changed this to and will retest:
mutexFIXHandle = CreateMutex(SYNCHRONIZE, false, NULL);
mutexSetAlertTimer = CreateMutex(SYNCHRONIZE, false, NULL);
mutexSetAWAYHandle = CreateMutex(SYNCHRONIZE, false, NULL);
//
// for waitformutlipleobjects
//
HANDLE ghEvents[3];
ghEvents[0] = mutexFIXHandle;
ghEvents[1] = mutexSetAlertTimer;
ghEvents[2] = mutexSetAWAYHandle;
The skeleton of the WaitForMultipleObjects looks like this:
while (1) {
waitRval = WaitForMultipleObjects( 3, ghEvents, FALSE, 2000);
if (waitRval == WAIT_OBJECT_0) {
// process event
ReleaseMutex(mutexFIXHandle);
}
else if (waitRval == (WAIT_OBJECT_0 + 1) ) {
// process event
ReleaseMutex(mutexSetAlertTimer);
}
else if (waitRval == (WAIT_OBJECT_0 + 2) ) {
// process event
ReleaseMutex(mutexSetAWAYHandle);
}
else if (waitRval == WAIT_TIMEOUT) {
//printf("Wait timed out\n");
}
else {
// log something
}
}
|
|
|
|
|
I also needed to do this to get it to compile:
mutexFIXHandle = CreateMutex((LPSECURITY_ATTRIBUTES)SYNCHRONIZE, false, NULL);
mutexSetAlertTimer = CreateMutex((LPSECURITY_ATTRIBUTES)SYNCHRONIZE, false, NULL);
mutexSetAWAYHandle = CreateMutex((LPSECURITY_ATTRIBUTES)SYNCHRONIZE, false, NULL);
|
|
|
|
|
Using (LPSECURITY_ATTRIBUTES)SYNCHRONIZE causes the program to crash. So I'm back to using NULL.
|
|
|
|
|
Hello,
I need to integrate a video player / video API into my MFC / C++ application. It needs to be able to take video data stored as byte arrays in memory and display it in a preview window.
Is DirectShow the appropriate framework to use for this? As far as I have been able to tell, I would need to write a custom source filter which appears to be non trivial.
Is there a simpler way to do this?
Thanks!
|
|
|
|
|
hi my name is akhtar gul <small><pre><code> <a href=""></a><a href=""></a>[<a href="" target="_blank"></a>]</code></pre></small>
|
|
|
|
|
Your first message is pretty hard to comprehend.
|
|
|
|
|
Hi Akhtar,
What is your problem? The name?
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,
I would like to compare some (black& white) images region by region. I want to know how to split an image into many regions with Qt.
franck
|
|
|
|
|
As far as I know, Qt is a GUI framework and not an imageprocessing library. If you're looking for a lot of image processing functions, try OpenCV.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hello to everyone!
I need some help. How can I control 8 LEDs using parallel port and Turbo C? I have read this article http://www.codeproject.com/KB/cs/csppleds.aspx but it is written in C# language and since I only know C language, I don't know how to program it.
Please help me for the source code in Turbo C. Any help will higly appreciated. Thanks in advance.
|
|
|
|
|
Using following function to load the dll.
HMODULE hUsbLib = LoadLibrary("inpout32.dll");
GetProcAddress(hUsbLib, "Output");
|
|
|
|
|
HI,
Is it possible to draw rect using Normalised coordinates like 0.399567,0.000000,1.000000,0.399369
|
|
|
|
|
GDI+ allows this. Anyway why bother? Simply properly scale the rectagle before drawing it.
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]
|
|
|
|
|
pls let me know how can i do that...
|
|
|
|
|
GDI+ uses floating point coordinates. You just need to use GDI+.
|
|
|
|
|
Let me be more clear...
Suppose i want to draw segments(rect) on a Dialog and the given coordinates of the segemnt is
0.499567,0.000000,1.000000,0.499369 (these coordinates are independent of the width and height of the Dialog Rect) then how to draw the segment with the given coordinates.....
|
|
|
|
|
Do you sometimes read the answers that are given to you ?
|
|
|
|
|
Hi all,
I have made a exe using VS-2008.
I am trying to run that exe on another pc which not having VS-2008 inatalled on it (having OS - win xp with sp3), in my exe i have initialised COM using this code.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return;
}
But every time i run my exe on this machine it gives "Failed to initialize COM library".
Do i need to install anything extra on this machine...
Or what other problem there might be?
Can anybody help me in this...
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
You should check better the function return value (make your program reporting it). See the documentation for details [^].
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,
For the function CoInitializeEx(), dont check for the returned code.
Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE.
Just call the CoInitializeEx() and proceed to next.
|
|
|
|