|
1. I kept typing different explanations but this'll be easier:
<http: www.faqs.org="" faqs="" msdos-programmer-faq="" part2="" section-9.html="">
2. I have no clue, sorry.
|
|
|
|
|
|
It is the command interpreter. It's been around since the days of DOS. It contains the internal commands such as CD, DIR, CLS, TIME.
Executable files having a .COM extension are usually much smaller and faster than their .EXE counterparts, because of the single code and data segment. With the 16-bit compiler, you could create a .COM file by specifying the tiny memory model. Exe2bin and Debug could also produce them.
http://physics.concordia.ca/~eddy/391/AppC.html
http://www.du.edu/~etuttle/electron/elect59.htm
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Q1 has already been answered more than adequately.
2. NTVDM is used to run any pure 16 bit app, which command.com evidently is.
(And before you ask, that's NT Virtual DOS Machine, hence the name).
Steve S
|
|
|
|
|
I am running in the debugger and find that sPath = "" !!
VERIFY(::GetModuleFileName(AfxGetInstanceHandle(), szBuffer, _MAX_PATH));
sPath = (CString)szBuffer;
sPath = sPath.Left(sPath.ReverseFind('\\'));
What am I doing wrong?
Many thanks,
ns
I just found out that I get the sPath if I run the debug config, butr I have setup my release config to allow debugging too, and when that version runs I get blank!
|
|
|
|
|
For me, these lines
CString filenname;
::GetModuleFileName(AfxGetApp()->m_hInstance, filenname.GetBuffer(MAX_PATH+1), MAX_PATH);
filenname.ReleaseBuffer(); do work.
You might want to check the return-code and GetLastErr() of GetModuleFileName .
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I hadnt set up the prj correctly for debugging
|
|
|
|
|
Hello!
Use
_pgmptr
or
_wpgmptr
Hope that helps
|
|
|
|
|
Hello,
I have been looking through the CodeProject code and tutorial samples and there is quite a lot of info on how to run another application using the "CreateProcess" and also how to close the run application. Unfortunately I cant find any tutorial on how to send commands to the application(Tutorials in CodeProject just for "Console" control applications). I need to be able to send control commands to another Windows application. The other app can be controlled with just using the "F2, F3," keys etc,.
Thanks in advance to anyone who has any ideas
|
|
|
|
|
through pipe.
see parameters of CreateProcess() function, you can find standard-handler inside, then use CreatePipe() function to establish communications between these handlers (pipe).
includeh10
|
|
|
|
|
Thanks for the answer.
I have now created an application that utilises the createpipe() function.
The application that I am trying to control only uses function keys(F2,F3, etc..). I have tried using Virtual Key Codes (VK_F2, VK_ENTER, etc,..), however this does not seem to have any effect on the application that I am trying to control. Again, does anybody have any ideas?
Thanks again in advance.
|
|
|
|
|
I am alloating and deallocating a byte array as
void OnRecieve
{
if(pBuffer!=NULL)
{
delete []pBuffer;
pBuffer=NULL
}
pBuffer=new BYTE[5000];
}
i get the raw picture data from socket , allocate and dealloate memory as .
This code works fine for quite a long time , but may be after 3 , 4 hr.(So this code works fine for thousands executions )
I get the assertion while deleting this array.
in DBGHEAP.C File.
What might have the cause , Is there some other safer way to do this.
No Worries!
|
|
|
|
|
Could be a few things, the most likely is that you are writing past the end of one of your buffers at some point(probably by very few bytes,most likely one). You should:
- Check your code thoroughly where you write to the heap(allocated by new or malloc)
- Use memory checksumming to home in on the error, there is a CP article on this
- Evaluate a memory leak/overrun detection tool, such as boundschecker - lots of peeps can't live without them. Especialy if they do maintainence programming
5000 bytes is small enough to go on the stack really, and your program will fail in a much more entertaining way if that buffer is the culprit.
Ryan
|
|
|
|
|
It was on the CheckByte statements.in DBGHEAP.C
No Worries!
|
|
|
|
|
If you know you are always going to be allocating 5000 bytes, use Ryan's suggestion and use the stack. Dynamic allocation should be limited to cases where the amount needed is unknown until run-time.
Atif Mushtaq wrote:
I get the assertion while deleting this array.
in DBGHEAP.C File.
What line?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
sorry i wrote 5000 for simplicity of question , actually i recv data range from 4 ot 10 k , so only choice was do it dynamically.
another thing
How can i overwrite the array while deleting it.(It is the delete operator which is cauzing the problem)
throughout the whole program i use this buffer , in read only mode.
actually i get the picture data from remote server and i recieve it ony client side and simply display it .after doing it.On arrival of next packet i delete old memory and allocate new one.
So there is no chance of overwritng .........what u think.
Atif
No Worries!
|
|
|
|
|
Atif Mushtaq wrote:
On arrival of next packet i delete old memory and allocate new one.
This doesn't sound like "read only mode" to me.
Unless you need more memory, there's no need to continually reallocate the same memory. Just use memset() , or ZeroMemory() to "clear" that memory location.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
as i have told u that i get data range from 4 to 10k at random , so heap is the only solution.
Well what if i use malloc and free for allocating and deallocating memory.
No Worries!
|
|
|
|
|
You can also let someone else do the tiresome work of memory management: The STL:
By defining
std:vector<BYTE> buffer;
buffer resize(4000); you get 4000 BYTEs of memory with at
BYTE* adress = &buffer[0]; .
The length of the buffer is given by std::vector::size() , and you can reallocate using buffer.resize() .
To free the memory, you can always let the buffer go out of scope.
Hope this does help you a little
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Your last question was about "overwriting" memory. By suggesting the use of memset() or ZeroMemory() , I did not imply that the heap should be avoided. I was merely indicating that you can continue to use the same block of memory, rather than multiple calls to the memory manager. Since you indicate that the largest packet is 10KB, you could make things a lot simpler by creating a 10KB buffer on the stack.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Ok it looks right that , i should take 10k Static buffer but for example if i get the 5k binary jpeg data , what will happen that first 5 k of the buffer will conatin the right data and remaining 5k invalid data, cauz it is binary data so we cannot place null at the end the end of original 5k(As JPEG Data might oroginally cconatin many nulls).So what will happen that the API which are loading JPEG will simply crash or display incorrectly.
what u say...............
No Worries!
|
|
|
|
|
Presumably the code that is used to display the JPEG picture will want to know the size of the image. The fact that a 5KB image is in a 10KB buffer is irrelevant.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi
(Please let me know if there's a better group to post
this to)
Is there an easy way to extract error messages for a
build started via the VCConfiguration.Build method ?
The ReportError event in VCProjectEngineEvents doesn't
seem to ever be fired for build errors.
.
|
|
|
|
|
Hi!
Is it possible to import for example a Dialog recource from another project. Must I add the .h and .cpp files for the generated Dialog-classes?
APe
|
|
|
|
|
d00_ape wrote:
Is it possible to import for example a Dialog recource from another project.
Yes. If you have two instances of Visual Studio open, you can use drag/drop. If you have one instance of Visual Studio open, you can use copy/paste.
d00_ape wrote:
Must I add the .h and .cpp files for the generated Dialog-classes?
Yes, unless you are going to create new ones.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|