but once did that... it's actually ridiculously simple and...
if can just get it to actually work... can do some amazing cool things.
think that I am not converting the right size params in the final DLL call... (see below)
the bones of my DDE function for AHK look like this:
; trying to figure out the DLLCALL equivalence... ; ; PLEASE LET ME KNOW IF THIS IS WRONG ?! LPDWORD := "UIntP" PFNCALLBACK := "UInt" ; or should that be Int ? DWORD := "UInt" HSZ := "UInt" ; is that right ? UINTc := "UShort" ; Can this be right ? is it UInt ?? Int ?? NULL := "Int" LPTSTR := "str" INTc := "short" ; maybe Int ??? SEE BELOW FOR MS DEFS... APPCLASS_STANDARD := 0 CP_WINANSI := 1004 CF_TEXT := 1 XTYP_EXECUTE = 0x0050 XTYP_POKE = 0x0090 XTYP_REQUEST = 0x00B0 VarSetCapacity(ddeServer, 256,0) VarSetCapacity(ddeDataE, 256,0) VarSetCapacity(ddeData,33000) VarSetCapacity(ReturnV1,33000) ddeServer = excel ddeTopic = ddeData = [formula(\"SWI-Prolog\",\"r1c1\")] pidInst := 0 if ( DllCall("DdeInitialize" , LPDWORD, pidInst , PFNCALLBACK, 0 , DWORD, APPCLASS_STANDARD , DWORD, 0 ) ) msgbox ERROR with DDEInitialze ! HddeServer := DllCall("DdeCreateStringHandle" , DWORD, pidInst , LPTSTR, ddeServer , INTc, CP_WINANSI ) HddeTopic := DllCall("DdeCreateStringHandle" , DWORD, pidInst , LPTSTR, ddeTopic , INTc, CP_WINANSI ) ddeDataE = HddeDataE := DllCall("DdeCreateStringHandle" , DWORD, pidInst , LPTSTR, ddeDataE , INTc, CP_WINANSI ) HddeConversation := DllCall("DdeConnect" , DWORD, pidInst , HSZ, HddeServer , HSZ, HddeTopic , Null, 0 ) ddeData = [formula(\"SWI-Prolog\",\"r1c1\")] BddeData := StrLen(ddeData) + 1 ddeResult = 0 ; ; THIS IS NOT SEEMING TO WORK ; ReturnV1 := DllCall("DdeClientTransaction" , STR, ddeData , DWORD, BddeData , Uintc, HddeConversation , DWORD , HddeDataE , UINTc, CF_TEXT ; NOTE: should be ZERO with execute , UINTc, XTYP_EXECUTE , DWORD, 1000 , LPDWORD, ddeResult ) ; compare := 0x4000 + 0 msgbox 32,, % DllCall("DdeGetLastError", DWORD, idInst) " :" compare exitapp
note to try this, need to DDE server such as MS excel,
the 'rules' at Microsoft's MSDN
[Moderator's note: I put this super-long link in an URL tag to avoid horizontal scrolling of page]
HDDEDATA DdeCreateDataHandle( DWORD idInst,
[in] Specifies the application instance identifier obtained by a previous call to the DdeInitialize function.
[in] Pointer to a buffer that contains data to be copied to the DDE object. If this parameter is NULL, no data is copied to the object.
[in] Specifies the amount of memory, in bytes, to copy from the buffer pointed to by pSrc. (include the terminating NULL, if the data is a string). If this parameter is zero, the pSrc parameter is ignored.
[in] Specifies an offset, in bytes, from the beginning of the buffer pointed to by the pSrc parameter. The data beginning at this offset is copied from the buffer to the DDE object.
[in] Handle to the string that specifies the data item corresponding to the DDE object. This handle must have been created by a previous call to the DdeCreateStringHandle function. If the data handle is to be used in an XTYP_EXECUTE transaction, this parameter must be 0L.
[in] Specifies the standard clipboard format of the data.
[in] Specifies the creation flags. This parameter can be HDATA_APPOWNED, which specifies that the server application calling the DdeCreateDataHandle function owns the data handle this function creates. This flag enables the application to share the data handle with other Dynamic Data Exchange Management Library (DDEML) applications rather than creating a separate handle to pass to each application. If this flag is specified, the application must eventually free the shared memory object associated with the handle by using the DdeFreeDataHandle function. If this flag is not specified, the handle becomes invalid in the application that created the handle after the data handle is returned by the application's DDE callback function or is used as a parameter in another DDEML function.
If the function succeeds, the return value is a data handle.
If the function fails, the return value is 0L.
The DdeGetLastError function can be used to get the error code, which can be one of the following values:
Any unfilled locations in the DDE object are undefined.
After a data handle has been used as a parameter in another DDEML function or has been returned by a DDE callback function, the handle can be used only for read access to the DDE object identified by the handle.
ps: the error code ("6") is 'improper paramaters' on the last DLL call...
WHAT IS THE DLLCALL EQUIVALENCE FOR:
HCONV (UINT or USHORT ?)
UINT (is this ahk's uint ... or is a SHORT ??)
HSZ (handle is short or UINT ??)
LPBYTE (STR ?? UINT + &Var ?? USHORT + & VAR ? STR* ??)
ps2: have also seen def's as "
void FAR* pData,
DWORD FAR* pdwResult
but am not sure that I have the AHK equivalents correct...
this or... missing something else ?