|
I suggest you read some about how to automate Excel.
Have a look in the references section in this article[^] and see if you can find anything useful for you.
I don't think the article itself is of any use for you, but the links may very well be.
Hope this helps
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Can somebody help me ...
In my FTP application i need to get the size of the file or bytes transferred in uploading or downloading .
What is the suitable API for achieving this???
Thanks in advance
Shikha
|
|
|
|
|
the total size of file or bytes transfered(i.e. file size = 32kb), or the constantly updated size(i.e. 0% - 100%)?
I win because I have the most fun in life...
|
|
|
|
|
Thanks sir for ur reply....Actualy i need to know both that is
How can i get the total size of file also the bytes transferred ? because i need to calculate the time to set the range of progress indicator.
Thanks
Shikha
|
|
|
|
|
Thanks sir for ur reply....Actualy i need to know both that is
How can i get the total size of file also the bytes transferred ? because i need to calculate the time to set the range of progress indicator.
|
|
|
|
|
Hi all,
thanks all (cedric,toxxct,and brainley) for ur help. This is in response to my post some 5hrs ago.
I do in C. I have corrected the code and i get no warnings now. but i would like to know if the following way of coding and passing the address of the first pointer to funcB is threadsafe in multithreaded environment.
is the follwing way of coding correct?Any help?
funcA{
char * Names[] = {};
int next = 0;
char * list = "Abc";
Names[ next ] = malloc( sizeof( char )*( strlen( list ) + 1 ) );
memcpy( Names[ next ],list,sizeof( char )*( strlen( list ) + 1 ) );
list = "cdefg";
Names[ next+1 ] = malloc( sizeof( char )*( strlen( list ) + 1 ) );
memcpy( Names[ next+1 ],list,sizeof( char )*( strlen( list ) + 1 ) );
printf("vsp list got is %s\n", Names[0] );
printf("vsp list got is %s\n", Names[1] );
funcB(....,...,(const char**)&Names);
}
funcB(...,...,const char ** names)
{
....
//the actual values names[0] and names[1] are to be accessed and used.
...
//free names[0] and names[1]
free( (char*)names[0]);
free( (char*)names[1]);
}
|
|
|
|
|
thathvamsi wrote: passing the address of the first pointer to funcB is threadsafe in multithreaded environment.
Not inherently, nothing is. You must provide the safety using synchronization.
led mike
|
|
|
|
|
how to provide safety using synchronisation?
Can you please explain a bit more? as this is my first attempt /project on multithreaded environments.
|
|
|
|
|
thathvamsi wrote: Can you please explain a bit more?
Multi-threading and Synchronization is two large a subject to introduce in a forum. Do some reading on the subject. I can recommend Jeffery Richter's books.
led mike
|
|
|
|
|
An interface to an application is being written based on supplied examples that compile and execute. When the following code is used, a complier error results. The only difference is that in lieu of returning from a function, an error message is diplayed in a window followed by a goto to CoUninitialize().
HRESULT Result=NOERROR;<br />
Result = ::CoInitialize (NULL);<br />
if ( FAILED (Result) ) {<br />
DisplayStatus("Error: Failed to CoInitialize COM inteface.");<br />
goto wrap_up;<br />
}<br />
<br />
CLSID AppClsid;<br />
Result = ::CLSIDFromProgID (L"Inventor.Application", &AppClsid);<br />
if ( FAILED (Result) ) {<br />
DisplayStatus("Error: Failed to obtain CLSID. Check registration.");<br />
goto wrap_up;<br />
}<br />
<br />
IUnknown *pAppUnk = NULL;
wrap_up:
::CoUninitialize();
error C2362: initialization of 'pAppUnk' is skipped by 'goto wrap_up'
C:\Documents and Settings\Jon\My Documents\MSCSource\IV_Revision\Tab2.cpp(146) : see declaration of 'pAppUnk'
Any clues on why this error is being generated? Thanks in advance.
|
|
|
|
|
You could move this line above the "goto"s
IUnknown *pAppUnk = NULL;
|
|
|
|
|
|
I would like to add embedded codes to learn the status of memory consumption by my program. What function or APIs are avaiable for this.
I am working on a MFC project (Windows 2000 Pro. Visual C++ 6.0 SP6).
Someone suggested me to use GetProcessMemoryInfo().
I put
#include "psapi.h" in the *.cpp file. However, I got the following error
D:\练习\Test1\Test1View.cpp(9) : fatal error C1083: Cannot open include file: 'psapi.h': No such file or directory
|
|
|
|
|
example of MSDN:
#include windows.h
#include stdio.h
#include "psapi.h"
void PrintMemoryInfo( DWORD processID )
{
HANDLE hProcess;
PROCESS_MEMORY_COUNTERS pmc;
printf( "\nProcess ID: %u\n", processID );
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID );
if (NULL == hProcess)
return;
if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) )
{
printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount );
printf( "\tPeakWorkingSetSize: 0x%08X\n",
pmc.PeakWorkingSetSize );
printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize );
printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n",
pmc.QuotaPeakPagedPoolUsage );
printf( "\tQuotaPagedPoolUsage: 0x%08X\n",
pmc.QuotaPagedPoolUsage );
printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n",
pmc.QuotaPeakNonPagedPoolUsage );
printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n",
pmc.QuotaNonPagedPoolUsage );
printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage );
printf( "\tPeakPagefileUsage: 0x%08X\n",
pmc.PeakPagefileUsage );
}
CloseHandle( hProcess );
}
void main( )
{
DWORD aProcesses[1024], cbNeeded, cProcesses;
unsigned int i;
if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
return;
cProcesses = cbNeeded / sizeof(DWORD);
for ( i = 0; i < cProcesses; i++ )
PrintMemoryInfo( aProcesses[i] );
}
Hope it helps....
Regards
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
« Programm3r » wrote: Hope it helps....
I'm curious how a code snippet is supposed to help. The problem is that the preprocessor is unable to find the psapi.h file.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I don't know David ... I just thought the guy tried to complie and saw that the header file was missing ... Why not give a sample so long?? But I could have said something like ... "google the header file" or something like that, but I decided to give a code snippet ...
O Yes and I quote "... I would like to add embedded codes to learn the status of memory consumption by my program. What function or APIs are avaiable for this...."
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
cy163@hotmail.com wrote: I put
#include "psapi.h" in the *.cpp file.
Unrelated, but your compiles will be somewhat faster if you put it in stdafx.h instead.
cy163@hotmail.com wrote: Cannot open include file: 'psapi.h': No such file or directory
Have you verified that the file exists on your machine, in the Platform SDK\Include folder?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi all,
How can one test for a bad pointer (0xcccccccc)
I have this pointer array, but not all of the element contain data.
<br />
char *SendFiles[10];<br />
I have tried the following, without success...
<br />
if (SendFiles[y] == NULL)<br />
{<br />
...<br />
Thanx in advance
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Always always always (and many more ) initialize your variables and pointers in your constructor (or at the start of your program). In your case, loop through the array and set all the pointers to NULL:
for (int i=0;i<10;i++)<br />
{<br />
SendFiles[i] = NULL;<br />
}
|
|
|
|
|
Many, Many Thanx Cédric, never knew that .. kinda
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Cedric,
After doing what you said (and it works of course).
The very last element has these characters "ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ".
I assume it is garbage or something ... how can I test for this...
Just to let you know I'm retrieveing data from a file, and putting it into the char array.
If I press enter on the very last entry in the text file, the last element in the array is: ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
And if I don't press enter I get someting like this:
dataline1ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
Thanx in advance ... again
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Check your code that you add a '\0' at the last character of each string if it's not there.
|
|
|
|
|
|
IsBadWritePtr and IsBadReadPtr can tell you if your process can legally use that pointer, but they won't tell you if the pointer is pointing to the place it should be pointing - it could be pointing anywhere in your process' address space and still be valid for read/write.
Cedric is right - you should always initialize pointers to NULL, and use that as your good/bad test.
|
|
|
|