Hi all,
I've succesfully implemented a MYSQL access using mysql.h. I'm only doing SQL INSERT kind-of queries and they are being inserted nicely in the MYSQL engine.
Latter on I've realized that...
Type: Posts; User: laimaretto
Hi all,
I've succesfully implemented a MYSQL access using mysql.h. I'm only doing SQL INSERT kind-of queries and they are being inserted nicely in the MYSQL engine.
Latter on I've realized that...
Ok, so here are the functions freeing (and deleting) the memory used:
string2bstr:
BSTR string2bstr(string input_string)
{
// MultyBytetoWideChar converts ANSI strings to UNICODE
...
@adeyblue/bithub:
Sorry if this question is somehow silly or generic but: how do you know or what did you do to see/test/findout that the functions are leaking memory? How do I prevent this memory...
Hi All,
After searching for info, I came out with two functions to come and go from BSTR to std::string and vice versa...
The functions work fine for me and I can call them directly from a Cell...
Hi tabstop, this function works nice. I have some questions though:
1) How did you know that you had to use the MultiByteToWideChar function? I assume by this then that VBA expects...
Ok, just to clarify:
0) I understand that wide-char=two-byte per char=Unicode while char=one-byte per char=ANSI. Please, correct me if I'm wrong.
1) A VBA Variant that contains a string is...
Hi, thanks ... and yes, I do realize, the thing is I want to do it via a C++ DLL ... :-)
Cheers!
Hi everyone:
I'm dealing with some DLLs that I'm trying to call from Excel.
The issue is that, depending on how I call from VBA the DLL then it works or it does not:
Here's the c++ code:
No, it does not. This is the output:
=string_test1(): 敔瑳湩㈱3
=string_test2("Lucas"): Lucas
string_test1 returns a string longer than 1 char, but not "Testing123" as you have put in the code of...
Actually, I've tried this as well ...
BSTR string_ex(BSTR stringVar)
{
string buffer((char*)stringVar);
// code. here we work with 'buffer'. once done
// copy its content to...
Yes and no: it does compile well with no errors, but, when I call the function from Excel like this =string_ex("Lucas") I can only see "L" as a result.
The returned string is being stripped: I do...
Yeap ... "-Wl,--add-stdcall-alias" did the trick ... now I can call the simple function from Excel and I got a result ...
Now I'm going back to the old BSTR problem ... :)
Thanks!
Lucas
...
Ok, I'm trying to do the simplest code ...
VBA:
Public Declare Function mult Lib _
"d:\datos\doc\tech\c++\excel\ipfnc_dll\ipfnc.dll" _
(ByVal x As Integer) As Integer
C++:
Ok, solved it.
I did as you suggested. Removed every IDE and also MinGW (there was only one version of it). I did remove the calls to MinGW in the path variable. Finally reinstalled only...
Hi All,
I was using Dev-C++ 4.9.9.2 under Windows Xp-SP2 and I could at the time compile some console applications and also some basic DLLs that I would call from Excel (by using VBA).
By...
Hi,
After downloading Code::blocks and wxDev-C++, I can no longer use successfully the DLL in Excel, even with a simple function.
I had this simple function ...
VBA:
Declare Function...
Thanks, I got to link the code with the library ... and it compiles now ...
However, when calling the DLL from within VBA, Excel returns #VALUE! ... there is still something wrong with the types,...
Thanks, but, where do I get that library from? I was expecting to find it within wxDev-C++ or Codeblocks ... :-S
Hi ...
I've downloaded both code::blocks and wxDec-C++ but compilation failed with both of them ...
Same error as before ...
- Output Codeblocks:
- Output xwDev-C++:
Elysia/Codeplug:
Thanks for your quick answers .... I'm already downloading these IDEs ...
After that I'll retry and let you know how did all go ...
Many thanks and BRs,
Lucas
@Codeplug:
Thanks! let me have a look a those ... any preference?
Cheers!
Lucas
Hi Codeplug,
Thanks for the reply and for your suggestion.
I've tried before what you suggest but I cannot compile your code. This is the compiler's output:
Compiler: Default compiler...
Yes, I've seen this. If declare my C++ function with input parameter of type LPSTR then I can send BvVal a string from VBA and that will work (which is what I want).
Then, since I have a char*...
Hi!
So, some new and fresh information (at least for me).
Just for information, I've found this link very useful:
Passing Strings to a DLL Procedure
Now, going to the matter. I've managed...
Hi All,
Thanks everyone for the replies.
I've been reading some information on the web but I'm somehow confused (actually: a lot).
As far as I've read, the following occurs:
VBA, when...