DDE execute from LiveCode

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode

Post by trevix » Fri Feb 10, 2012 3:39 pm

Update:
When you save a standalone application, the external (at least the DDE execute) does not work anymore.
- In StandAlone application setting, "DDE" appears on the Script Library
- but it does not get saved on the "Externas" folder created with the new Win app
- tried to manually copy the "EXT.dll" file from the LiveCode directory to the "Externals" folder or to the same directory of the new app.
- the "ext_DDEexecute" command inside the LiveCode script simply does nothing (nothing on the result or on it) and it aborts the execution of LiveCode script
- The app does not bomb tough. It simply stops at the line.

Could it be related to the licence issue ?
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: DDE execute from LiveCode

Post by mwieder » Fri Feb 10, 2012 4:59 pm

Ah, got it. OK.

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode

Post by trevix » Fri Feb 10, 2012 6:15 pm

Sorry, I must correct myself.
It works: I just forgot to create the runtime directory for the externals (My Documents\My LiveCode\Runtime\Windows\x86-32\Externals)
It still come up with the dialog asking for a licence, tough...!!!
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode Tuviah's LICENCE

Post by trevix » Thu Feb 16, 2012 11:23 am

PLEASE: nobody seems to know how to buy/get the licence for the old Tuviah external !!!

Do you have any info ?
Do you know how to contact Tuviah ? (if he is still around...)

Thanks for any help
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: DDE execute from LiveCode

Post by bn » Thu Feb 16, 2012 1:59 pm

Hi Trevix,

look at
http://lists.runrev.com/pipermail/use-l ... 66155.html

Kind regards

Bernd

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: DDE execute from LiveCode

Post by Klaus » Thu Feb 16, 2012 4:25 pm

Yep, he is still using that email address!

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode

Post by trevix » Sat Feb 18, 2012 11:00 am

Hi all.
Unfortunately he does not answer...nor does runrev support.
I'm open to suggestions ! Are there other ways to do it ? (Shell? Dos ?)
(I tough that the possibility of firing a DDE execute from LiveCode could be of interest...)
Thanks
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode FAILURE

Post by trevix » Thu Feb 23, 2012 3:15 pm

As of today I've been confirmed that there is no more around any licence or licence generator for the Tuviah' external collection.
Too BAD
Thanks to all, anyway (please, just remember to unlock your things when you decide to make them free...;)
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

paul_gr
Posts: 319
Joined: Fri Dec 08, 2006 7:38 pm

Re: DDE execute from LiveCode

Post by paul_gr » Thu Feb 23, 2012 7:33 pm

Hi Trevix,
Have you tried running a Windows command line tool from LC like ClassExec

http://fvue.nl/wiki/ClassExec

or DDE_Run.
http://www.angelfire.com/linux/myp/DDE_run/dde_run.html

Article on usage of above and other DDE command line tools at
http://www.robvanderwoude.com/ddecommandline.php

cheers
Paul

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode

Post by trevix » Sun Feb 26, 2012 7:46 pm

I'm afraid I am not up to the task...:(

ClassExec: I don't even understand how it works. If i launch the ClassExec app, it shows an OK window ( with available option but no key can be entered) and nothing else. The command line does not reconize it...("ClassExec is not a command or an app..."). When I close the Ok window it just close itself

DD_run.exe: the application is not in the web page and i wouldn't know what to do with the source code (I don't know C/C+/C++)

As for the acticle page, I'm sorry but I dont understand how can it help me...

Remembering that what i need is to send DDEexecute from LiveCode, can you be more of help ?
Thanks
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

paul_gr
Posts: 319
Joined: Fri Dec 08, 2006 7:38 pm

Re: DDE execute from LiveCode

Post by paul_gr » Sun Feb 26, 2012 7:52 pm

Hi Trevix,
I've only used ClassExec from Windows, and that was 5 years ago on XP.
Things appear to have changed since then.
Sorry I can't help.

Paul

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode

Post by trevix » Mon Feb 27, 2012 10:55 am

I don't know if to keep this post on this forum or on "Using externals and plugin"...
I'm asking for a suggestion and help:
- I don't Know C++ and I cannot learn it (beside may be the basics...)
- There is a Microsoft web page with a C++ example of Simple DDE client
http://support.microsoft.com/kb/279721
- Visual C++ 2010 Express is available for free download
- the "Lessons and Tutorial" on building LiveCode externals look fairly easy (?)
http://www.runrev.com/developers/lesson ... externals/

Do you think is out of question to ask here for help on fixing the C++ code in order to build a LiveCode external to send DDEexecute from LiveCode ?
(It could be a command like: ExtCom_DDEexecute TheApp, TheArgument, TheVariables)
Is there someone willing to help me? I would off course post the finished external somewhere for free use by the community...
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: DDE execute from LiveCode

Post by mwieder » Mon Feb 27, 2012 7:00 pm

the "Lessons and Tutorial" on building LiveCode externals look fairly easy (?)
rotfl

Let me take a step back here and ask: do you really need to use DDE to communicate with this program? DDE has been a dead technology for over 15 years.

Do you need to communicate with the program while it's running? or can you just start it by passing arguments to it on a command line?
If you can get by with the latter, then your job just became much easier.
Do you need to send information to the alien program or receive information from it or both?
Do you know the DDE specifications of the program in detail?

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode

Post by trevix » Mon Feb 27, 2012 7:40 pm

I must use DDEexecute.
The alien program is a small "transition" app, always running, to an commercial accounting app. It has been made by developer in order to get data in and out of it (don't ask my why but they are no willing to change that...).
It only accept DDEexecute , in a form like "DDEexecute TheTransApp, TheArg, TheVar", where TheVar is a series of command and data.
It then writes to disk a text file with the answer data.
Do you need to communicate with the program while it's running?
Yes
Do you need to send information to the alien program or receive information from it or both?
Only send info. (I get info back reading the text file)
Do you know the DDE specifications of the program in detail?
Yes, as i said I must be able do define only TheApp, TheArg, TheVar. That's it.

For what I have been reading on the web (tons...) there is still a lot of people that need to send DDE (Microsoft still does...)
Trevix
(P.S. what is "rotfl"? Something like...you got that wrong?)
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: DDE execute from LiveCode STEP 1

Post by trevix » Wed Feb 29, 2012 2:56 am

Hi All.
Waiting for some help, I downloaded the free Visual studio 2010 C++ express and spent a morning getting some basics on C++.
I managed to make a console application that fire DDEexecute with parameters but I am rather confused on what does what...!
Coming from LiveCode, C++ is very cumbersome and I am not sure if I was able to handle correctly all those string conversions. What it does is it opens the console, ask for the name of the application, the topic (for excel is the doc name) and send to it a DDEexecute with the parameters listed on the szCmd1[] string.
1- download Visual Studio C++ express 2010
2 make a new console project and name it DDClient3 (It's my third experiment...)
3- if, like me, you must handle accented chars, you must set the character set (on the DDClient property) to multibyte. I tried with Unicode, but i could not come up of al the mess in the string handling.
4- replace the content of the DDClient3.cpp with the following code:

Code: Select all

// Ask for application and topic and send a DDEexecute to it
//the DDE is the szCmd1
//
#include "stdafx.h"
#include "windows.h"
#include "ddeml.h"
#include "stdio.h"
#include <string>
#include <iostream>
using namespace std;

HDDEDATA CALLBACK DdeCallback(
    UINT uType,     // Transaction type.
    UINT uFmt,      // Clipboard data format.
    HCONV hconv,    // Handle to the conversation.
    HSZ hsz1,       // Handle to a string.
    HSZ hsz2,       // Handle to a string.
    HDDEDATA hdata, // Handle to a global memory object.
    DWORD dwData1,  // Transaction-specific data.
    DWORD dwData2)  // Transaction-specific data.
{
    return 0;
}
	void DDEExecute(DWORD idInst, HCONV hConv, char* szCommand)
{

	HDDEDATA hData = DdeCreateDataHandle(idInst, (LPBYTE)szCommand,
                               lstrlen(szCommand) +1, 0, NULL, CF_TEXT, 0);
    if (hData==NULL)   {
       printf("Command failed: %s\n", szCommand);
    }
    else    {
        DdeClientTransaction((LPBYTE)hData, 0xFFFFFFFF, hConv, 0L, 0,
                             XTYP_EXECUTE, TIMEOUT_ASYNC, NULL);
    }
}

int main(int argc, char* argv[])
{
	char myapp[30];
	char mytopic[80];
		cout << "App name:";
	cin >> myapp;
		cout << "Topic name:";	
	cin >> mytopic;
	//parameters to send (no backslash...)
	char szCmd1[] = "S;C:/archiviMida4/O01820110701.MDB;;C:/CC_SaniMont_DB2012/IOMidaDbFornitura/RisultatoMida.txt;C:/CC_SaniMont_DB2012/IOMidaDbFornitura/EsitoMida.txt;2646_clienteCodice;1014";
   
    //DDE Initialization
    DWORD idInst=0;
    UINT iReturn;
    iReturn = DdeInitialize(&idInst, (PFNCALLBACK)DdeCallback, 
                            APPCLASS_STANDARD | APPCMD_CLIENTONLY, 0 );
    if (iReturn!=DMLERR_NO_ERROR)
    {
        printf("DDE Initialization Failed: 0x%04x\n", iReturn);
        Sleep(1500);
        return 0;
    }

    ////Start DDE Server and wait for it to become idle.
    //HINSTANCE hRet = ShellExecute(0, L"open", szTopic, 0, 0, SW_SHOWNORMAL);
    //if ((int)hRet < 33)
    //{
    //    printf("Unable to Start DDE Server: 0x%04x\n", hRet);
    //    Sleep(1500); DdeUninitialize(idInst);
    //    return 0;
    //}
    //Sleep(1000);

    //DDE Connect to Server using given AppName and topic.
    HSZ hszApp, hszTopic;
    HCONV hConv;
    hszApp = DdeCreateStringHandle(idInst, myapp, 0);
    hszTopic = DdeCreateStringHandle(idInst, mytopic, 0);
    hConv = DdeConnect(idInst, hszApp, hszTopic, NULL);
    DdeFreeStringHandle(idInst, hszApp);
    DdeFreeStringHandle(idInst, hszTopic);
    if (hConv == NULL)
    {
        printf("DDE Connection Failed.\n");
        Sleep(1500); DdeUninitialize(idInst);
        return 0;
    }

    //Execute commands/requests specific to the DDE Server.
    DDEExecute(idInst, hConv, szCmd1); //send the DDE

    //DDE Disconnect and Uninitialize.
    DdeDisconnect(hConv);
    DdeUninitialize(idInst);

    Sleep(3000);
    return 1;
}
Note that I'm not sure if it handles accented chars on the parameters to send. You cannot but backslash also on the parameters, since C++ considers the backslash as a special char, even inside quotes.

NOW, I only need to understand how to transform those input (TheApp, TheTopic, TheParameters) so as to be able to build an external for LiveCode...:(
Please help.
LONG LIFE TO LIVECODE.
Trevix
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

Post Reply