NTK and The NTK Project
are properties of Jn Dechereux
Home | Documentation | FAQ.

Vanilla 1.1.8 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentTimeNov 19th 2021

    Please accept my apologies if the answer is obvious as I am not particularly adept when it comes to understanding the internal mechanics of Win32 messaging functions, but I have run into a problem where I do not know how to translate the following type of code (from an old Clipper / Clip4Win application) into NTK / XHARBOUR:

    [within a function which is the procedure passed to a NTK_SUBCLASSWINDOW command for the window receiving the event messages]
    case nMsg == WM_COMMAND
    if nwParam == ID_NEWCLOD
    cClodName := C4W_Peek(nlParam)
    if !Empty(oStock:oClod) .and. ValType(oStock:oClod) == "O"
    ___ [etc.]

    it is specifically / only this line that I am struggling with:

    cClodName := C4W_Peek(nlParam)

    "C4W_Peek" does not exist in NTK; according to my Clip4Win documentation it returns a string containing the bytes of memory, where the first parameter is a pointer to the start of the memory and the second optionally specifies the number of bytes

    The code which generates the message being intercepted is elsewhere within the application code itself:


    if !Empty(cClodName) .and. ValType(cClodName) == "C"

    if anyone has any ideas this would be very helpful. "C4W_Peek" does also exist in one or two other areas of the application I am translating, again used in a similar way
    • CommentTimeNov 20th 2021
    i bypassed the above "C4W_Peek" requirement in my code by using static / public variables to store the string values which were being passed via the NTK_SENDMESSAGE calls

    however it would be nice to know the answer here - i think my question boils down to this:

    if we use the "NTK_SENDMESSAGE" function to pass a string via its fourth "cnlParam" parameter (from the NTKPROJECT documentation: "An numeric or string value specifying an additional and specific information to be passed with the message. (a string value must be passed by reference)" - then how would our own window sub-classing code later read that string value 'back' again, when intercepting that message? i.e. surely not simply cString := STR(nlParam)
    • CommentTimeNov 22nd 2021
    hi poke45

    below a code snippet in C i found 10+ years ago when starting migrating to ntk but cannot remember where or in which tutorial. anyway works well as replacement for cw4_peek func - just paste it at the end of your prg.
    also this old post might help too... shows how to export extra vars to a subsclassed proc:

    #pragma BEGINDUMP
    #include <windows.h>
    #include "hbapi.h"
    #include "hbvm.h"
    #include "hbstack.h"
    #include "hbapiitm.h"
    // ---------------------------------------------------------
    // my_peek(<nPtr>,[<nCnt>]) --> cStr
    // ---------------------------------------------------------
     if ( hb_pcount()==2 )
        hb_retclen( (char *) hb_parnl(1), hb_parni(2) );
        hb_retc( (char *) hb_parnl(1) );
    #pragma ENDDUMP
    • CommentTimeNov 25th 2021
    thanks xbasefan: i had not considered this "peek" functionality might be more a HARBOUR/XHARBOUR thing (and to research within that) than a windows / NTK_PROJECT thing.

    i notice now there is also what appears to be a direct replacement within harbour itself: