Author |
Topic  |
|
cjbf
UK
8 Posts |
Posted - 09/20/2008 : 9:05:42 PM
|
For Origin 7.5 I wrote a DLL to send data to an Origin worksheet. It works fine, but now that I have Origin 8 I wish to use layers within a worksheetpage, and to send data to a specified column in a layer. So how do I name the column when using WM_DLL_OPEN_DATA? In Origin 7.5 it's wksname_colname, but in Origin8Pro SR2 I've tried everything I can think of, having assumed it should be [wksname]layername!colname . What am I doing wrong?
I use the following in the DLL to update an existing column (called AA) in wksname: char tmp[512],colname[512]; unsigned long dw; double FAR *lpDestination; wsprintf(colname,"%s_%s",wksname,"AA"); // colname=wksname_AA in Origin 7.5, what in 8? dw=SendMessage(hWnd,WM_DLL_OPEN_DATA,0,(LONG)(LPSTR)colname); if (dw==0) {wsprintf(tmp,"type \"Error: could not get memory address in Origin from DLL!\""); SendMessage(hWnd, WM_USER, 0, (LONG)(LPSTR)tmp); return; } lpDestination = (double FAR *)dw; lpDestination[0]=12.3;//etc for other rows too dw=SendMessage(hWnd,WM_DLL_CLOSE_DATA,1,(LONG)(LPSTR)colname); // 1 = data changed
Also, I have the following includes in the DLL C++ file: #include "C:\Program Files\OriginLab\OriginPro75\ATI\include\labstr.h" #include "C:\Program Files\OriginLab\OriginPro75\ATI\include\orgdll.h" //DLL related messages
I can't find the equivalent in Origin 8 Pro SR2, though orgdll.h is the only place I've found any documentation for the DLL messages. Where can I get them from?
Thanks in advance, Chris. |
|
Echo_Chu
China
Posts |
Posted - 09/26/2008 : 11:06:09 PM
|
Hi, Chris
If in your assumption, wksname = workbook name, layername=worksheetname. Then it should be corret.
You can use following testing code to check whether the dataset exists in your Origin.
void test_in_80()
{
Dataset ds("[Book1]Sheet1!A"); // note, the default name of book/sheet already change to Book1 and Sheet in 80
if( ds )
out_str("ok");
}
void test_in_75()
{
Dataset ds("Data1_A");
if( ds )
out_str("ok");
}
I am sorry that we have removed ATI folder from 80. We are considering to bring it back in SR5.
Echo OriginLab Corp |
 |
|
cjbf
UK
8 Posts |
Posted - 09/30/2008 : 07:37:06 AM
|
Thanks, Echo. I've found just one name that works from a DLL, whereas all the others, that appear valid according to the Origin C test you suggested, do not work. I think that must be a bug. The one that works is wksname_colname@layernumber , except if layernumber=1, in which case it has to be left out! All the others give 0 as the address of the column. So, problem solved, for me, byt it would be helpful to fix the bug or doument things better. |
 |
|
|
Topic  |
|
|
|