|
I take it you mean each step is running on its own thread?
Semaphores dont help you gaurentee order. All the do is protect say thread A accessing the same thing as thread B. Which order thread A and thread B run in is down to the scheduler. So it might happen A grabs the semaphore, B tries to and waits, A releases semaphore, B contnues to run. Or it might happen B grabs the semaphore, A tries to and waits, B releases semaphore, A contnues to run - its up to the scheduler (and of course your theads priority).
If you want things to happen one after the other, run them on the same thread:
void Foo(
{
Step1();
Step2();
Step3();
}
etc.
If you really want each step to happen on it's own thread, then you need to use events. Look up CreateEvent/SetEvent/ResetEvent
If I have the wrong end of the stick, and what you are asking is you want ShellExecuteEx not to return until the spawned process has finished, you do it like this.
SHELLEXECUTEINFO si;
si.fMask = SEE_MASK_NOCLOSEPROCESS;
si.etc etc
ShellExecuteEx(&si);
WaitForSingleObject(si.hProcess, INFINATE);
|
|
|
|
|
Hello!
please help me in this field.
when I run this program in visual C++ (6.0) this link error appears:
error LNK2001: unresolved external symbol _WMCreateEditor@4
Debug/main.exe : fatal error LNK1120: 1 unresolved externals
this program put marker on sound file
thank you for reply.
(I'm sorry.I could not speak English perfectly)
#######################################################
IWMMetadataEditor *pEdit = 0;
IWMHeaderInfo *pInfo = 0;
// Create the metadata editor object.
WMCreateEditor(&pEdit);
pEdit->Open(L"C:\\example.wmv");
pEdit->QueryInterface(IID_IWMHeaderInfo, reinterpret_cast<void**>(pInfo));
// Add the markers. Note that we add the last ones first. Do this when possible
// for improved performance when writing the markers to the file.
hr = pInfo->AddMarker(L"End", 520000000); // 52 sec.
hr = pInfo->AddMarker(L"Segue", 350000000); // 35 sec.
hr = pInfo->AddMarker(L"Intro", 15000000); // 1.5 sec.
// Commit changes and clean up.
pEdit->Flush();
pEdit->Close();
pInfo->Release();
pEdit->Release();
|
|
|
|
|
have you checked if all .lib files are included into the project? or check if prototypes of WMCreateEditor is declared correctly
Paolo
|
|
|
|
|
1. either link in the "wmvcore.lib" into your project settings (link tab)
or
2. add this to your source or into "stdafx.h"
#pragma commend(lib, "wmvcore.lib")
or
3. directly add the lib into your project as one of the files
|
|
|
|
|
Hi,
I have an app with a series on property pages in a row. I was wondering if there was a fancy way that it could dock on the left hand side on the screen tucked away and the subsequent clicks would bring it out to the middle of the screen and vice versa.
I think I have seen something like this some where but can't remember where.
Does any one have a small sample link to such a thing?
|
|
|
|
|
Hello,
I'm writing a GUI to simplify the use of a console-based application, I've created a WIN32 application ( no MFC or ALT), I want to know if it's possible to print the output from dos console to an HWND that it's related to a listbox control;for opening the dos-console program I've used the ShellExecuteEx function.
thanks
Paolo
|
|
|
|
|
There is one article in Codeproject which also redirect stdin, stdout and stderr handles to a window.
Check this out.
http://www.codeproject.com/dialog/quickwin.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
See these two articles:
http://support.microsoft.com/default.aspx?scid=kb;en-us;190351
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi there,
Does anyone have an idea of how to go about using Constrained Delaunay Triangulation in Line thinning? The input is a black and white TIFF image, pixel based. The program should thin the lines of the image to one pixel width.
Would really appreciate help here!
regards, fuzzypeach
|
|
|
|
|
Hi,
Now I'm using IHTMLDocument2::write to write html contents to an HTML document. But I found it become slower and slower after many times of writes, even I wrote in the same html contents every time. I dont know why
Below is the sample codes:
IHTMLDocumentPtr doc;
if(FAILED(doc.CreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER)))
return;
CComQIPtr<IHTMLDocument2> doc2 = doc;
if(doc2 == NULL)
return;
time_t startTime, ltime, delta = 0;
int step = 200;
for (int i = 1; i <= 50000; i++)
{
time(& startTime);
if(FAILED(doc2->write(sfArray)))
break;
doc2->close();
time(& ltime);
delta += ltime - startTime;
if (i % step == 0)
{
TRACE (_T("Seconds used on loading %d html DOM from %dth with same doc: %ld\n"), step, i - step, delta);
delta = 0;
}
}
I also write a demo project to demonstrate this but cant attach it here. If you need it, I'll send it to you.
Thanks & regards,
Hailiang
|
|
|
|
|
Okay, so I'm checking out the source code on this project. And I get to this section of code.
<br />
void GetResolution( int &X, int &Y ) {<br />
byte array[8];<br />
X = Y = 0;<br />
unsigned long address;<br />
if ( ReadProcessMemory( g_hCurrentProcess, (void *) g_uiResolutionOffset, (void *) array, 4, NULL ) ) {<br />
address = GetUnsignedLong( array );<br />
if ( ReadProcessMemory( g_hCurrentProcess, (void *) (address + 268), (void *) array, 4, NULL ) ) {<br />
X = GetUnsignedLong( array );<br />
if ( ReadProcessMemory( g_hCurrentProcess, (void *) (address + 272), (void *) array, 4, NULL ) ) {<br />
Y = GetUnsignedLong( array );<br />
Now, I am a bit confused as to what is meant by "address +268" I know 'address' is the base offset, but what is added to it? is it 268 bytes or is it an unsigned long or what?
|
|
|
|
|
looks like 268 bytes to me
|
|
|
|
|
What is added to it is (268 * sizeof(unsigned long)).
For example:
unsigned long al[10];
unsigned long* pal = al + 1; // same as pal = &al[1];
// and
unsigned long al1 = al[1]; // same as al1 = *(al+1);
INTP
|
|
|
|
|
John R. Shaw wrote:
What is added to it is (268 * sizeof(unsigned long)).
This is not correct. address is defined as an "unsigned long ", not as an array or a pointer. So (void*)(address + 268) adds 268 to the number held in address , and then casts to a void pointer. So it is incrementing by 268 bytes, not 268 unsigned long s.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
i gave you a 5 for that, cos you were thinking exactly the same thing as me, but you type faster
oh and your response is more legible
|
|
|
|
|
Whoops! You are correct, I need to be more observant. I saw 'address' and automaticaly saw a pointer variable, instead of an unsigned long variable that is holding a value that happens to be an address.
INTP
|
|
|
|
|
well then I'm confused. In the example given :
unsigned long address;
now if address is then set to 1000;
address = 1000;
then you add 268;
address += 268;
it'll be 1268
NOT 1000 + (268 *sizeof(unsigned long)) = 1072+1000 = 2072
what you have said doesn't make a lot of sense to me.
|
|
|
|
|
How to capture/save a bitmap on the picture box using VC++?
Aparna
|
|
|
|
|
GDI+
capture and save a bitmap of what?
Screen shot? Your active window?
by save do you mean to file or draw on the screen?
|
|
|
|
|
you can write it Byte wise. (like printf, but then it's called fwrite or write or something) You can then write pixel per pixel.
(Note: bitmaps have headers, this should be written first)
(Note: Write BGR NOT RGB (don't know why it just is)
(NOTE: remember Y-axis is inverted)
hope it helps!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
How should an application create a file so that it inherits the permissions of the folder it is created in?
Microsoft says, in http://www.eu.microsoft.com/resources/documentation/windows/2000/server/reskit/en-us/serverop/part1/sopch03.mspx,
The version of NTFS included with Windows 2000 offers an important new feature for managing security — inheritable permissions. The Security dialog box offers the option to Allow inheritable permissions from parent to propagate to this file object *which is enabled by default*. (Emphasis mine)
And, in http://www.microsoft.com/resources/documentation/WindowsServ/2003/all/techref/en-us/Default.asp?url=/resources/documentation/windowsServ/2003/all/techref/en-us/w2k3tr_sec_authz_over.asp,
Inheritance of permissions You can control permissions for new objects created in a container object by setting inheritable permissions on the container. The permissions that you set on a container are also inherited by existing objects in the container *as well as newly created objects*. (Emphasis mine)
Well, it doesn’t seem to work that way at all. The second article also gives the following code for opening a file that will be written:
hfile=CreateFile(pszFile,GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
That’s exactly how I open an output file in my application, except that I use CREATE_ALWAYS instead of OPEN_EXISTING, because the file to be written may not exist yet.
The problem is that a file created by the application DOES NOT inherit permissions from the folder it is created in. This is true even if the file already exists and DOES inherit permissions before CreateFile() is called! When the “Security” tab of the file properties is examined, the “Allow inheritable permissions…” checkbox is cleared. This means that, if an Administrator creates the file, no non-Administrator users can open the file, even for read access.
How can I fix this problem?
|
|
|
|
|
From MSDN:
CREATE_ALWAYS Creates a new file. If the file exists, the function overwrites the file and clears the existing attributes.
Maybe two calls one with CREATE_NEW
if it fails you use OPEN_EXISTING
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Both files have been found. They are part of Cygwin.
www.cygwin.com
Hi all,
I'm trying to compile a project I obtained from Sourceforge. There are #includes for files such as <strings.h> and <poll.h>. I'm pretty sure they are not files missing from the project I downloaded, but more so, files I'm missing for a library that I have not downloaded.
I've done a quick search on google, and I get the impression that they exist on unix dev environments. The author of the project says his project compiles ni VC7.x and the code is like this :
#ifdef WIN32
#include <poll.h>
#include <strings.h>
#endif
and this is in several files, so it seems that they are available somewhere for win32.
Anyone know where I can get these or with which library they exists? (it's not in the latest Platform SDK, i looked)
Thanx
Jubjub <b></b>
|
|
|
|
|
Hi,
I am pretty new to DirectX and I need to accomplish the following thing:
Preview a live video stream from a webcam and be able to select (draggable&resizable rectangle) an area of the live video and apply some real-time image processing only on that area.
This involves video overlay (for the selection rectangle) and video processing of a portion of the video stream.
I understand DirectShow will let me preview a live video stream "quite easily". But will it give me the flexibility I need for overlaying the video and processing a portion of it?
If so how? And if not, what could I use?
Anything that could point me in the right direction would be greatly appreciated.
Thanks!
|
|
|
|
|
go to see my article http://www.codeproject.com/useritems/Motion_Detection.asp
|
|
|
|