|
I think there is a file dialog control you can use. you can use that to make your life easier. I,m a newbie too but im using C# at the moment. ^_^
|
|
|
|
|
thanks, i'm slogging through the IDE's HELP section. This is pretty blasted complicated.
|
|
|
|
|
Hello!
I use an ActiveX component, that have function, that creates new object and returns LPDISPATCH pointer. In MSDN i'm read that IDispatch::Invoke provides access to properties and methods exposed by an object. But there is so many parameters, strange structs, etc... Can somebody explain me that or give URL with guid for dummies or give sample?
|
|
|
|
|
|
Thx, its really helpfull.
|
|
|
|
|
hey all
CryptAcquireContext(hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)
The above function fails one computer out the hundreds we have tried on. Does anyone know of a reason why getting the default provider would fail on a particular computer.
Thanks for any insight
|
|
|
|
|
CryptAcquireContext
If the function succeeds, the function returns nonzero (TRUE).
If the function fails, it returns zero (FALSE). For extended error information, call GetLastError.
Also:
CryptAcquireContext() use and troubleshooting
Montreal great Guy Lafleur, quoted by CBC on being mugged while vacationing recently in Buenos Aires: "I didn't have any time to react before I got a sucker-punch in the eye. It was like one of the players from the Bruins."
|
|
|
|
|
That will fail if you've never used the CryptoAPI on the machine (or you've cleared out the key store). If the last error is NTE_BAD_KEYSET , call CryptAcquireContext() again with the CRYPT_NEWKEYSET flag.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I have used these operators numerous times without any problems at all. Until today that is.
char *bin;
int size = rec.comment[x].size();
bin = new char[size];
strcpy(bin,rec.comment[x].c_str() );
blob.setBinary((unsigned char*)bin, strlen(bin) );
sprintf(tmp,"update data set data=%% where student_id=%i and exam=%i;",
rec.student_id,
x );
buf.format(tmp,blob.getEncoded() );
db.execDML(buf);
delete bin;
Maybe I am doing something wrong, but all works well until it comes to delete bin. The program crashes with an error I have never seen before "DAMAGE: after normal block(#9160)".
Could somebody please point out what I may be doing wrong and what is the meaning of this error.
Thankyou.
|
|
|
|
|
In debug builds, new allocates more memory than requested and fills it with a certain byte pattern. When deleted, it checks to see if this byte pattern is still there, if not, you've written past the memory that you've requested. In other words, you didn't request enough memory and written past your buffer.
I think
bin = new char[size];
should be
bin = new char[size + 1];
to take into account the terminating null.
|
|
|
|
|
Aahhh, it all makes sense now. So this would only effect debug builds?
|
|
|
|
|
waldermort wrote: So this would only effect debug builds?
Actually no. It does affect release builds as well. Even more seriously than a debug build if you manage to trample on a protected memory space.
This happened to me recently where I could not figure out why my application only crashed on release builds only.
<EDIT>
waldermort wrote: So this would only effect debug builds?
I just re-read your question. If you meant if the memory safety net only gets applies to debug builds, then yes.
</EDIT>
I Dream of Absolute Zero
-- modified at 13:34 Sunday 26th March, 2006
|
|
|
|
|
In addition to what hfry said you have to take into account the difference between delete and delete[] . If you allocate an array with new[] delete it with delete[] .
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Should read:
bin = new char[size+1];
You need to allocate space for the NULL terminator.
Steve
|
|
|
|
|
The main reason you're getting the crash is because you're using the wrong deallocator.
If you use new[] to allocate memory, than you need to use delete[] to deallocate the memory.
The debug version will give you a runtime error, where as the release version will ignore the problem.
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Axter wrote: The main reason you're getting the crash is because you're using the wrong deallocator.
If you use new[] to allocate memory, than you need to use delete[] to deallocate the memory.
The program will not crash due to mismatch b/w new[] and delete but there will be memory leak
never say die
|
|
|
|
|
sunit5 wrote: The program will not crash due to mismatch b/w new[] and delete but there will be memory leak
Then how do you define a memory leak?
VuNic
|
|
|
|
|
No doubt memory leak can cause crash.
Axter wrote:
The main reason you're getting the crash is because you're using the wrong deallocator.
but i wanted to highlight the using delete in place of delete[](when using new[])the program will not crash when executing it.
never say die
-- modified at 6:59 Monday 27th March, 2006
|
|
|
|
|
using delete[] as opposed to delete made no difference. You also mention that it can cause memory leaks, yet none of my leak detectors can find any. I suppose if I were to allocate multidimentional arrays then I may have a problem with leaks, but I'm not doing that here.
As a previous poster said, the problem was due to not allocating enough space. Adding the +1 fixed everything.
|
|
|
|
|
using delete instead of delete[] with new[] will delete only the first memory location (returned by new[]).What about the rest of the memory.Can u use it?
never say die
|
|
|
|
|
Using the sprintf and printf functions, the %s,%i.. flags are normally replaced. Hey no problem, But what If I want a Percent sign '%' in the string?
escaping it '\%' gives errors, and simply leaving it causes the function to remove it.
|
|
|
|
|
to print a percent-sign character, use %%
|
|
|
|
|
Hi,
I know that if you want to put a '\' character in your string ,you should use "\\" instead(e.g. fprintf("c:\\"program files" , ...)) , so try use double % in your string(i'm not sure it's working but give it a try....).
Regards,
Eli
|
|
|
|
|
Thankyou guys, I finaly got that thawn out my backside. the %% worked, but I first did it another way: sprintf("percent '%s","%");
It worked but now I know the right way.
|
|
|
|
|
Hi,
I've got a (probably) common problem: I want to create a several unmanged C++ DLLs in VS2005, most of them shall export functions with strings (best CString), like this:
void TestFunc1(int a, CString b);
void TestFunc2(int a, LPCTSTR b);
CString TestFunc3(int a);
All these DLLs compile and link well, but when I try to use them in my applications, I always receive a linker error (LNK2019: undefined external symbol). Obviously, this problem is related to the use of strings as arguments (or return values), because if I remove them as arguments, everything works fine...
any ideas how to solve this?
Greetings,
Peter
|
|
|
|