|
In the watch window the value of e doesnt change even after the function is called
|
|
|
|
|
prithaa wrote: In the watch window the value of e doesnt change
It's created on the stack so why would it change? You have to call it's GetErrorMessage() method.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
When i call the GetErrorMessage() the string is blank
LPTSTR f;
e.GetErrorMessage(f,0);
f is blank
|
|
|
|
|
Of course it is! You've not only given it an invalid buffer, you said the buffer's size is 0.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
when i give 50 or 100 it gives me debug assertion failed
|
|
|
|
|
And rightly so since you've given it an invalid buffer. Did it ever occur to you to check here? As this is all elementary stuff, I'm thinking Excel Automation might just be a bit beyond your current skillset.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
sorry i didnt check the documentation
i m getting the following error
coinitialise has not been called
|
|
|
|
|
prithaa wrote: i m getting the following error
coinitialise has not been called
I knew this thread was about 15 posts too long. See here. Since you did not answer, I just assumed you had it right and the problem was elsewhere.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i think it will be done
thnk you
|
|
|
|
|
Hi there,
Is it posible, using vs2008 express, to copile a c++ application (not managed c++).
I don't want a .NET application.
Can that be done? How?
Thanks!
|
|
|
|
|
Hi,
SummerBulb wrote: Is it posible, using vs2008 express, to copile a c++ application (not managed c++).
Yes.
SummerBulb wrote: Can that be done? How?
Simple tutorial -> here[^].
You can find more tutorials by googling.
Nuri Ismail
|
|
|
|
|
I think you might have misunderstood my.
I know how to write c++ code. I also know how to write code in VS2008.
What i am looking for is a way to write code in VS2008 express and compile it using the regular c++ compiler, and not using the managed c++ compiler that comes with the VS2008 express IDE.
Or am i missing something here?
|
|
|
|
|
Hi,
The C++ compiler in VS2008 Express (and other editions) is not a managed compiler. It is regular C++ compiler. For managed C++ there is a C++/CLI . So when you set your project type to Visual C++ , this means that you will use unmanaged C++ compiler.
I hope this helps.
Regards,
Nuri Ismail
|
|
|
|
|
|
I am creating a text file at run time and writing some strings to it but, all strings are coming in one line how to insert blank line in the text file?
i am using following function:
StringCchPrintf(lpBuffer, sizeof(lpBuffer)/sizeof(TCHAR),TEXT("%s"),lpBuffer);
"\n" is not working here..
|
|
|
|
|
\r\n
If you vote me down, my score will only get lower
|
|
|
|
|
Hi all,
I want to copy a large string(2500 chars) to VARIANT data type.
I tried with following function.But it is showing exception.How can i copy large string to a variant?
int n =MultiByteToWideChar(CP_ACP, 0, lpszitems, -1, wchItems,
2500);
lpList->vt = VT_BSTR;
lpList->bstrVal = SysAllocString(wchItems);
i have allocated size to lpszitems variable to 2500.Is it possible to allocate size to variant datatype.
Thanks,
|
|
|
|
|
If a crash is happening then problem is elsewhere. If the function SysAllocString is not able to allocate memory to copy full wchItems then it shoudl return NULL peacefully.
Probably, wchItems is not properly terminated (unicode strings require \0\0) or the problem is elsewhere. I dont think 2500 chars is a very long string but then i dont think in any case,
|
|
|
|
|
the VARIANT has only the pointer to the data, it gets allocated with SysAllocString(wchItems);
Where happened the execption?
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
The following code runs 'exception-free' on my system:
#include <windows.h>
void main()
{
char lpszitems[2500];
wchar_t wchItems[2500];
memset(lpszitems, 'A', 2499);
lpszitems[2499]= '\0';
int n =MultiByteToWideChar(CP_ACP, 0, lpszitems, -1, wchItems,
2500);
if (n==0)
{
DWORD dw = GetLastError();
int k=5;
}
VARIANT * lpList, vt;
lpList = &vt;
VariantInit(lpList);
lpList->vt = VT_BSTR;
lpList->bstrVal = SysAllocString(wchItems);
}
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]
|
|
|
|
|
Hello,
Why doesn´t this code return "sumatorio=5"???
<br />
#include <stdio.h><br />
<br />
int main(void)<br />
{<br />
int sumatorio;<br />
int sum;<br />
<br />
sumatorio=0;<br />
for(sum=0; sum<5; sum++)<br />
{<br />
sumatorio=sumatorio+1 ;<br />
}<br />
<br />
printf("Sum: %i .\n", sumatorio);<br />
<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
the code looks good (tested on xcode on mac); sumatorio is 5 after the loop.
This signature was proudly tested on animals.
|
|
|
|
|
does it return "Sum: 5 ."? sumatorio is indeed 5.
|
|
|
|
|
because the coder wrote "return 0;"
PS: the biggest failure cause sits before the PC
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
The printf statement needs a %d for outputting an integer:
printf("Sum: %d .\n", sumatorio);
|
|
|
|