The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Updating layers from a DLL in Origin 8
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cjbf

UK
8 Posts

Posted - 09/20/2008 :  9:05:42 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cjbf

UK
8 Posts

Posted - 09/30/2008 :  07:37:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000