DDE help please

G

Guest

If anyone can help me it would be greatly appreciated

I am struggling with connection to a DDE server - I have a global variable defined as my conversation handle (newDDE) and the instance defined also as a global variable (dwDDEInst). I get a successful connection, which sits until I want to send a command. When I actually send my command (SendKeystring - which in this case always sends ESC: "^[" through DdeClientTransaction) I get a 16390 error which means Invalid Parameter. If anyone can help me figure out which parameter is invalid it would be greatly appreciated

Thanks in advance
Dal

HCONV newDDE = NULL
DWORD dwDDEInst;
void ConnectNewDDE(

dwDDEInst=0L;
CONVCONTEXT CCFilter = { sizeof (CONVCONTEXT), 0, 0, 0, 0L, 0L };
char msgn[512]

LogFile.Log(1,"[ConnectNewDDE]")

if (DdeInitialize(&dwDDEInst,(PFNCALLBACK)&LWDdeCallback,APPCLASS_STANDARD|APPCMD_CLIENTONLY,0) == DMLERR_NO_ERROR

HSZ szProgMan = DdeCreateStringHandle(dwDDEInst,_T("LCW4"),CP_WINANSI)
HSZ hszTopic = DdeCreateStringHandle(dwDDEInst,"Info",NULL)
newDDE = DdeConnect(dwDDEInst,szProgMan,hszTopic,&CCFilter)
DdeFreeStringHandle(dwDDEInst,szProgMan)

while (newDDE == 0L

newDDE = DdeConnect(dwDDEInst,szProgMan,hszTopic,&CCFilter)
sprintf(msgn,"[ConnectNewDDE] - Failed to connect to Server: Error Code %d",DdeGetLastError(dwDDEInst))
LogFile.Log(1,msgn)
Sleep(1000)

sprintf(msgn,"[ConnectNewDDE] - Connected to DDE!")
LogFile.Log(1,msgn)

els

sprintf(msgn,"[ConnectNewDDE] - Failed to initialize server: Error Code %d",DdeGetLastError(dwDDEInst))
LogFile.Log(1,msgn)



void SendKeystring(char myKeystring[100]

char msgn[512]
char strCmd[256]

HSZ hszItem = DdeCreateStringHandle(dwDDEInst,"Keystring",NULL)

char szText[512]
strcpy(szText,"^[")
int k = strlen(szText)
k++

// int k = strlen(myKeystring)
// k++

HDDEDATA hClientResult

hClientResult = DdeClientTransaction((LPBYTE)"^[", k, newDDE, hszItem, CF_TEXT, XTYP_POKE, 5000, NULL)
if (hClientResult == 0

sprintf(msgn,"[SendKeystring] - Failed to create transaction! Error: %d", DdeGetLastError(dwDDEInst))
LogFile.Log(1,msgn)

els

LogFile.Log(1,"[SendKeystring] - Transaction Sent to LastWord.")

}
 
G

Gary Chang

Hi,

From your description, I understand that you get a 16390 error while
sending a command string to the DDE server,
Please correct me if there is any misunderstand.
hClientResult = DdeClientTransaction((LPBYTE)"^[", k, newDDE, hszItem,
CF_TEXT, XTYP_POKE, 5000, NULL);

How about using the XTYP_EXECUTE instead of CF_TEXT?

Addtional, I noticed in some cases, the hszItem could be NULL.


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top