|
use %1- instead...
sorry, this was the unix way.
use %* to expand all the parameters excluding the %0 (which is the batch file name).b
|
|
|
|
|
good morning
is it possible to fill a table with CString ?
CString tab [20];
|
|
|
|
|
|
yup, why wouldn't it be ?
BTW, think of using STL if it becomes complex (with something like std::vector<CString> )...
|
|
|
|
|
|
I'm writing a DMO (DirectX Media Object) transform filter for video. Now I want to implement internal resizing functionality. Thus previously I have always returned DMO_E_INVALIDTYPE from InternalCheckOutputType() if input and output dimensions doesn't correlate for RGBxx. However this approach isn't possible for YUY2 color space since the renderer (VRM9) for some dimensions introduce memory alignment for every row of the frame (for example if the input video has dim 176x144 the renderer requests a output dimension of 192x144 probable due to some render acceleration of the YUY2 rendering in graphics card and if denied it will use RGB instead and performance will of course decrease).
The above is annoying because I can't see the difference when to perform internal resizing and when to align the rows of the frame (or when to do both).
So my question is, is there a way to get information on the amount of (image row) memory alignment of the output from inside a DMO filter.
(In some cases I also will need to hook up the output of the filter with non-rendering filters.)
|
|
|
|
|
By the way, the sort of memory alignment i am talking about is called pitch or stride.
|
|
|
|
|
Hi everyone
I am running the following piece of code on Windows 2000 and XP (except the code below has been simplified with error checking removed).
This code spawns a child process, which writes its output to a logfile called child.log.
The problem I am having is: if the child process is a command or batch file, then child.log captures output of commands such as "dir",
however, for any processes that are launched from the batch script, such as perl.exe, all the output is lost. I don't know where the
output is going or why. I suspect I have done something wrong with handle inheritance somewhere.. any ideas??
I don't get the same problem if the child process is some other shell interpreter, such as bash.exe.
SECURITY_ATTRIBUTES secAttr;
secAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
secAttr.bInheritHandle = TRUE;
secAttr.lpSecurityDescriptor = NULL;
STARTUPINFO startupInfo;
::ZeroMemory((void*) &startupInfo, sizeof(STARTUPINFO));
startupInfo.cb = sizeof(STARTUPINFO);
startupInfo.dwFlags = STARTF_USESTDHANDLES;
PROCESS_INFORMATION processInfo;
startupInfo.hStdOutput = CreateFile(
"child.log",
GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,
&secAttr,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
startupInfo.hStdError = startupInfo.hStdOutput;
CreateProcess(
NULL,
commandString,
NULL,
NULL,
TRUE,
DETACHED_PROCESS,
NULL,
NULL,
&startupInfo,
&processInfo);
// Close handle because parent process has no further need for it:
CloseHandle(startupInfo.hStdOutput);
<div class="ForumSig">
cheers,
Neil</div>
|
|
|
|
|
So if I understand the issue correctly, you’re creating a file for a batch file to write to right?
Well if that’s indeed the case the issue is how you’re creating it.
neilsolent wrote: startupInfo.hStdOutput = CreateFile(
"child.log",
GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,
&secAttr,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
FILE_SHARE_READ Allows other apps to open it read only. Change that to FILE_SHARE_WRITE or close the file before spawning the the child process.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Thanks for the suggestion.
I tried this out, but it didn't seem to make any difference.
To clarfiy, the issue is that, processes launched by the batch file itself do not send any output to child.log. The batch file itself DOES successfully send ouput to child.log. So if the batch file is:
dir
perl -v
exit 0
.. then you can see output from "dir" (because this is a DOS commmand, that does not run as a new process) but not from perl (because this is launched as a new process).
Weird ??
cheers,
Neil
|
|
|
|
|
Sorry, I'm even more confused.
So you want the output from the perl script written to the log file right?
If you run the perl script from the command line does it do what its suppose to?
What is the perl script doing? Any reason it has to be done from a scipt and not part of your C++ App?
For any of the command line commands redirecting the output from the screen to a file is >Path.To.File ie dir >C:\MyLog.log
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Thanks again for your comments. Here's some answers to your questions:
So you want the output from the perl script written to the log file right?
= Yes. Whatever the program - that is launched by CreateProcess() - does, I want all stdout (and stderr) to go the logfile child.out. If the launched program is a batch script, this includes the output from any new processes (such as Perl) that the script may launch.
If you run the perl script from the command line does it do what its suppose to?
= Well, there is no Perl script here, I am just getting Perl to return its version statement (-v flag). But yes, Perl does correctly return the version statement if I run the batch script manually. If I replace the batch script with a shell script (bash.exe instead of cmd.exe) it works just fine - the output from Perl goes to child.out. It seems that it only doesn't work if the program launched with CreateProcess() is a batch script.
What is the perl script doing? Any reason it has to be done from a scipt and not part of your C++ App?
= That is not really relevant, because the main C++ program - that runs CreateProcess() - is supposed to allow the user to run ANY program or script he/she likes. I was just testing that it out with a sample batch script, when I came across this weird problem. I can't know in advance what programs the user may wish to run, and I can't ask them to kindly not launch any new processes from a batch script !!
For any of the command line commands redirecting the output from the screen to a file is >Path.To.File ie dir >C:\MyLog.log
= Yes, but I am not sure how that is relevant here? The output from the "dir" call DOES goes to child.log as it stands. It is just odd that the output from the Perl call does not. I have concluded that the difference is that Perl.exe is a new process, whereas dir is not. There must be something strange with the startup parameters in the CreateProcess() call, but I just can't think what..
I hope this makes sense, and I hope you can work out what I could be doing wrong, because I am totally stumped!!
cheers,
Neil
|
|
|
|
|
Hi!
I have a question regarding the use of different types of integers in Visual C++ 6.0. For example, I want to use in my application an integer variable named nIntValue.
If I declare it like this:
__int16 nIntValue;
does the system allocate it on only 16 bits or it still uses 32 bits as if I declared it:
__int32 nIntValue;
I have created this small test program:
int main( void )
{
__int32 n32BitsValue = 0x64;
__int16 n16BitsValue = 0x64;
return 0;
}
After that, I disassembled it using dumpbin /disasm test.exe.
Then I realized that it allocates 32 bits on the system stack for each variable. So it didn't matter for the OS that I wanted n16BitsValue to be 16 bits long. The only difference I noticed was this:
mov dword ptr [ebp - 4], 64h
mov word ptr [ebp - 8], 64h
So it allocated 32 bits on that stack for n16BitsValue, but modified only 16 of them. If this happens, what need is for these different integer types anyway? What can be done to force the operating system to allocate only 16 bits for an __int16 variable?
Any help would be greatly appreciated.
Thanks in advance!
|
|
|
|
|
Eikthrynir wrote: If I declare it like this:
__int16 nIntValue;
does the system allocate it on only 16 bits or it still uses 32 bits as if I declared it:
__int32 nIntValue;
<br />
printf("n16BitsValue: %d\n", sizeof(n16BitsValue));<br />
<br />
printf("n32BitsValue: %d\n", sizeof(n32BitsValue));<br />
<br />
n16BitsValue: 2
n32BitsValue: 4
so yeah, 16-bit and 32-bit
Also, VC sees __int16 as short , and __int32 as int .
|
|
|
|
|
Eikthrynir wrote: Then I realized that it allocates 32 bits on the system stack for each variable.
Eikthrynir wrote: mov dword ptr [ebp - 4], 64h
mov word ptr [ebp - 8], 64h
dword is 32 bits, but word is 16 bits AFAIK, so no, not the 2 variables make 32 bits.
|
|
|
|
|
The compiler 'allocates' 32 bits on the stack for an __int16 , but the code it generates only references the lower 16 bits. The reason for this is efficiency due to memory alignment. Modern Intel processors access memory most efficiently on 32-bit boundaries. I don't know about AMD or the other manufacturers, but I would suspect they are similar.
Why is this a concern?
Software Zen: delete this;
|
|
|
|
|
Thank you for your time! I really appreciate it!
The reason I wanted to know how much memory the compiler "allocates" on the stack is the performance concerning space.
Thanks again!
|
|
|
|
|
|
Hi,
My problem is that I sometimes receive dozens of WM_MOUSEWHEEL events for a single rotation step of the mouse wheel. Other events like WM_KEYDOWN don't have this problem, I received them only once for a pressed key.
Normally I'm using this event in a CDialog inherited class and everything's works ok but the context here is slightly different. This time I had to create my window with "CreateWindowEx" so there's no CDialog inheritance and therefore I need to have my own message loop and message processing function. Can you have a look at them below and tell me if you see an explanation for my problem ?
Thanks.
Message loop :
<br />
MSG msg; <br />
while (1)<br />
{<br />
PeekMessage(&msg, hWND, NULL, NULL, PM_REMOVE);<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg); <br />
if (msg.message == WM_QUIT)<br />
{<br />
break;<br />
}<br />
Sleep(100);<br />
}<br />
Message processing function :
<br />
LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch(message)<br />
{<br />
case WM_CREATE:<br />
return 0;<br />
break;<br />
<br />
case WM_CLOSE:
PostQuitMessage(0);<br />
return 0;<br />
break;<br />
<br />
case WM_DESTROY:<br />
PostQuitMessage(0);<br />
return 0;<br />
break;<br />
<br />
case WM_KEYDOWN:<br />
ProcessKeyStroke(MapVirtualKey(((UINT)lParam & 0x00ff0000) >> 16,1));<br />
break;<br />
<br />
case WM_MOUSEWHEEL:<br />
{<br />
short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);<br />
ProcessMouseWheel(zDelta);<br />
}<br />
break;<br />
<br />
default:<br />
return (DefWindowProc(hwnd, message, wParam, lParam));<br />
break;<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
Any one help me..........
1)Im using Visual studio 6.0.......it contain a WININET.h file ..this file contain ::FtpCommand function..........Visual studio WinInet.h does not contain this functio....so i have to download from Microsoft site i dont know wat to download..any one know about this............give me more info
|
|
|
|
|
You asked the same question yesterday - please don't keep reposting!
Anyway, what you need is the platform SDK - the latest one is here:
clicky[^]
Don't be confused that it's called the "Windows Server 2003 R2 Platform SDK" - MS just name the latest platform SDK after the newest version of windows supported - That'll give you the latest stuff if you're developing for 2000, XP, or any of the recent versions of Server.
|
|
|
|
|
HI benjy.........i got SDK files from the link u gave but how will my Visual studio come to know about the SDK i tried to replace the vc98 wininet.h file with a SDK wininet.h file but i got some error how can go through this...reply if u know this....im fedup of this
|
|
|
|
|
benjymous wrote: Anyway, what you need is the platform SDK - the latest one is here...
The SDK for v6 is not available online. It must be ordered on CD.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi Friends,
In my project I want to compare two images to find out the differences in both of the images, can any one please suggest me some algorithm or free code which I can use for this purpose.
Thanks in advance,
Dinu
|
|
|
|
|