|
Hi guy,
does someone know some tricks to increase the time performance
of a VC++ application that need to write a large amount of data
into an Excel Sheet ?
Thanks
|
|
|
|
|
Yup!
Use a multidimensional safearray.
Once upon a time I was filling an Excel sheet with ~10Mb and it took about 40 minutes addressing one cell at a time. With a multidimensional safearray it took ~10 seconds.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks a lot !
I try immediately
|
|
|
|
|
That's a nice suggestion.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Rajesh R Subramanian wrote: That's a nice suggestion.
Well, actually it's all the out-of-process calls that are the culprits here. They are ~2000 times slower than ordinary function calls in comparison. Knowing that, it's no rocket science figuring out that making less calls of this type will improve performance.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Overclocking?
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 All, Good Morning.
I am facing compilation errors but I have declared everything properly. Something is missing Please help me. I declared a declared class having 3-4 member functions n variable in header file and defined its functions in source file. Everything was working fine. But Now if I add some #define statements in header file and use those in source file , It is giving error undeclared variable. also if I put the mouse on #define statement it showing the variable with _CURSOR_ appended with.
eg.
#define TRADE_TAG "trd"
if I put the mouse on TRADE_TAG then it will show like TRADE_TAG_CURSOR_ "trd".. dont know why.. also if I right click on TRADE_TAG n then look for declaration then msg box appears variable TRADE_TAG not declared ... can u guide me here.
Second issue.
If I add a member variable or member function to the class declaration n then define in source file , it again gives compilation errors. dont identify class member variables n function. strange thing is that in one function it is recongnising member variables n in the another it is not.. both functions are member of the class. putting mouse on member function defination shows it as member. but on compilation it is giving error then function is not a member of class see the declartion.I m pasting code here. Please help
Header file Kccdatabase.h
#ifndef __KCCDATABASE_INCLUDE__
#define __KCCDATABASE_INCLUDE__
#pragma once
#include "afxdb.h"
class CKccDatabase : public CDatabase
{
private:
char sTradeXML[500];
char sTradeKcc[150];
public:
CKccDatabase();
virtual ~CKccDatabase();
BOOL ConnectKccDatabase(CKccDatabase &;
void InsertTrade(CKccDatabase *);
void ConvertTrdToXML(long RowIndx , bool IsRegularTrade = 1);
void ConvertTrdToKccFormat(long RowIndx , bool IsRegularTrade = 1);
};
source file
#include "KccDatabase.h"
void CKccDatabase::ConvertTrdToXML(long RowIndx , bool IsRegularTrade)
{
sTradeXML="Hello";
}
void CKccDatabase::ConvertTrdToKccFormat(long RowIndx, bool IsRegularTrade)
{
sTradeXML = "Hello";
sTradeKcc= " yes";
}
when I compile this source file cntl+f7 then it gives these errors in
KccDatabase.cpp(126) : error C2039: 'ConvertTrdToKccFormat' : is not a member of 'CKccDatabase'
1> f:\kats_clients_local\kats32\kats32\KccDatabase.h(4) : see declaration of 'CKccDatabase'
1>.\KccDatabase.cpp(151) : error C2065: 'sTradeKcc' : undeclared identifier
1>.\KccDatabase.cpp(152) : error C2065: 'sTradeXML' : undeclared identifier
please note that it is recongnising variable xTradeXML in upper ConvertTrdToXML but not in ConvertTrdToKccFormat ... also when I put cursor on the ConverTrdToKccFormat function defination then It shows this as member of CKccDatabase class ..
the only difference is that i have defind ConvertTrdToXML 4-5 days ago .. and otherone today.. :-9
Can anybody help
thx
|
|
|
|
|
I cannot spot any error in your code. Did you copy pasted this code or typed it yourself in the browser?
-Saurabh
|
|
|
|
|
param_joshi wrote: ...strange thing is that in one function it is recongnising member variables...
Not necessarily. When the compiler sees that a duplicate error would be generated, it will supress the extra ones. For example:
class David
{
int name;
void foo1()
{
naame = 12;
}
void foo2()
{
naame = 13;
}
}; This will only generate one compiler error. Once I fix foo1() , only then will the compiler start complaining about foo2() .
That aside, I see 2-3 syntax errors with your code snippet. The first is ConnectKccDatabase() is missing a closing parenthesis. The second is that you cannot assign sTradeXML and sTradeKcc to string literals like that. Either make them pointers, or use strcpy() . Since you are using MFC, I'd opt for CString variables instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Another suggestion: You're using MS Visual Studio right? Try saving cleaning the solution, save everything, close the program, then re-open. Sometimes Visual Studio failes to update intermediate files correctly. Cleaning the solution should delete those. The Re-start the program step is an unfortunate occurance, but I've known it to fix problems. Not sure why, but particularly those having to do with recent changes made in the software not being recognized. Just a thought.
|
|
|
|
|
Hi
Please help me to find out the problem in GetPrinter function.
First I am trying to get the printer handle for the specified printer using OpenPrinter function. .
HANDLE hPrinter = 0;
OpenPrinter ((LPTSTR)(LPCTSTR)strPrinterAddress, &hPrinter, NULL);
This function gets succeed. Using this printer handle I am trying to access the specified printer information’s using the GetPrinter function.
GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded);
if(!dwNeeded)
{
DWORD dwError = ::GetLastError();
ClosePrinter( hPrinter );
}
Even using GetLastError() function I am not able retrieve error message. This function is not failing all the times. When I am trying to print out of 10 times, 6 times the printing is succeed. Only 4 times it’s getting failed. Please help me shoot out this problem.
Thanks
Gokul
modified on Tuesday, October 14, 2008 4:08 AM
|
|
|
|
|
Why do you check dwNeeded instead of GetPrinter return value?
What is GetLastError return value when GetPrinter fails?
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]
|
|
|
|
|
The Get Printer function will return required buffer size in dwNeeded. I hope this should always be greater than zero. So I checked with the buffer size.
When I am trying to print the last error code it is printed nothing (empty).
|
|
|
|
|
I would check the GetPrinter return value, and call GetLastError only when it fails.
Are you aware that (MSDN [^]):
Remarks
Security Alert The pDevMode member in the PRINTER_INFO_2, PRINTER_INFO_8, and PRINTER_INFO_9 structures can be NULL.
When this happens, the printer is unusable until the driver is reinstalled successfully.
?
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]
|
|
|
|
|
Gokul_md wrote: GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded);
if(!dwNeeded)
{
DWORD dwError = ::GetLastError();
ClosePrinter( hPrinter );
}
This should be:
if (! GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded))
{
DWORD dwError = GetLastError();
FormatMessage(..., dwError, ...);
}
ClosePrinter(hPrinter);
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Yes i have formated the dword error code to string in the above mentioned way only. but it return the empty string.
|
|
|
|
|
Gokul_md wrote: Yes i have formated the dword error code...
What was its value?
Gokul_md wrote: ...but it return the empty string.
How are you verifying this?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i have formated the message using the below method.
LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | RMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, MAKELANGID(LANG_NEUTRAL, LANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0,NULL );
CString strMessage = (LPTSTR)lpMsgBuf;
The error message is printed in the log file.
FILE *fp = fopen("C:\\log.txt","a+");
fprintf(fp,"\n Error Occured - %s ", strMessage );
fclose(fp);
in that log file it printer as
Error Occured -
|
|
|
|
|
What is the value of dwError ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
Iam using a c++ dll in my .net application.It is running fine on the system where visual studio 2005 is installled.
In the deployment environment we have only framework2.0 installed on the machine.Then Iam getting a pop-up error as
"Microsoft visual c++ runtime library
Runtime error
c:\testapp\bin\debug\test.exe
The application has requested the application to terminate in the unusual way
Please contact the application's support team for more information"
Please kindly help ASAP
|
|
|
|
|
- Please don't shout.
- Be aware: requests marked as 'urgent' go automatically on the bottom of the stack.
- See here [^].
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,
Thanks for your reply...
If I tried this application the VS2005 machine it is working fine.
But when only .net2.0 framework I got the visual c++ runtime library pop-up error
I tried the following as suggested by you:
1. I have installled the redistributable package suggested by you.
after installing i restarted the PC even now also I got the same runtime pop-up error.
2. Then I checked even with the dependency walker for the dll.
I found that there is no miising dll.
3. Then I tried by installing Visual C++ express edition..even then also i got the same pop-up error.
Kindly help me.....
|
|
|
|
|
Again I must be say one thing requests marked as 'urgent' will be send to Pallini's site. 
|
|
|
|
|
please guide content structural file SCS. Spoolfile for Iseries.
eg:
1
-
-
0 RICHARD ALLEN 1234567 2/14/07
-
-
-
- You certify that:
0 A) You have purchased extended reporting coverage from your
previous carrier; or
0 B) You have decided not to purchase such extended reporting
coverage knowing that you are uninsured for your past medical
professional services; or
0 C) You are aware of your option to purchase suchextended
reporting coverage and realize that there is a time limit on
the purchase; or
0 D) You were insured for your past medical professional services
under an occurance policy.
0 Exclusion: We will not cover claims resulting from medical
professional services provided or withheld prior to your
retroactive date.
|
|
|
|
|
Dear,
expart
I have a digital ink pad (G - Note 7000 of genius). How I interact with the pad when it connected to a pc(i have the driver soft ware).I am writing a MFC application which can do this, but i do this by mouse interact, so the the resolution of the pad scale to the monitor resolution. I want to the same resulution as the pad so that I can get the same ink as it give in off line mode.
please help me how to do this.
tanmay
|
|
|
|