I am trying to access a c++ created DLL from within Excel, with semi-success only:
I've followed the following tutorial EXACTLY: http://newtonexcelbach.wordpress.com...ng-excel-to-c/
Now, when I try and use the dll-functions that I've declared in the VB code, the function GetPrice(), which takes no arguments and simply returns a number, works fine.
However, as soon as I create a dll-function which takes input arguments, I get a #VALUE error in the cell in Excel ("A value used in formula is of the wrong data type" ).
I've downloaded the complete sample from the URL above and get the same error when running it (after recalculating the formulas).
I've created a test 'proxy' function (in which the code can be stepped through, which calls the dll function) to ensure that values sent to the dll function are indeed of type double and that seems to be the case ...
Hmmm that was a bit schoolboy of me not to spot that error, thanks Garth!
I've actually just built the same functionality in a C# dll, works like a bomb!
Now I have a little design problem: I'd like the function I call in the dll to KEEP a cell dynamically updated (it fetches a security's price
from a local db).
1) Loop within excel and keep calling the dll function (which queries the db and returns the result)
2) Loop within the dll and *somehow* keep the value of the cell WHICH CALLED IT, up to date. (this is how bloomberg's API functions to keep excel cells dynamically updated, very nifty !
I'm thinking that efficiency-wise, 2) would be better (something tells me that having 200 cells repetitively calling a function will cause Excel to hang ... is my hunch correct?)
I am a beginner but I would like to learn.
I would like to use a new thread to read some data with an USB-module and to print it out in a CViewForm.
Now I have a total working program that can read and print when I click on the start button, but an infinit loop under the startbutton is written to read data until I click on Stop.(the data is real-time printed on the screen in a graph) This ofcourse is not possible because I stay in the loop under the startbutton. I can't click anything.
This logic problem I want to solve with strating a new thread just for collecting data from the USB-module and printing a graph on screen.
Now to use my old program is it possible to make an extra class derivaded from CWinThread and just call or postmessage the CView and CDocument members or functions ? If I could use my CView and CDocument members and functions in the InitInstance I thing I have a solution.
Could someone help me? I'm trying to write an algorith tht returns all the possibilities of the letters in a string, that starts at the initial word, then works its way down to all comniations of 2 letters.
To say it another way... if I have "ABCDEF", the function will return "ABCDEF" first (as there is only one of these), then return 6 strings of 5 letters each ("ABCDE", "BCDEF", "ACDEF", "ABCDF", "ABDEF" and "ABCEF"), as only 6 exists, then return 15 strings of 4 letters each, then 20 of 3 each, 15 of 2 each, and stop.
C++ or C# or just an idea of how to accomplished this would be great.
By 'bucket' I think he means an array of integers where each entry represents one of the letters of the string. "Pooring into the right bucket" means incrementing the count of that letter's entry in the array.
That was a good hint but I think it is best that you figure it out from there.