Skip to main content

[Migrated content. Thread originally posted on 07 March 2006]

I am looking to populate the clipboard with some text. I have an example of where the clipboard is populated with the command line being used. This works perfectly on Windows, however I'm having problem with thin client.

I've used the "@[DISPLAY]:" syntax with all of these dll calls and that seems to work fine. I run into a problem at the C$MEMCPY call. I get a MAV and I'm assuming this is because it's not using the client machine. I couldn't use the "@[DISPLAY]:" syntax here. Is there another way to accomplish this?

Here is a code snippet from the portion that is getting the command line into memory. Later, it's placed on the clipboard.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 1.
           CALL    "KERNEL32.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "MSVCRT.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "GetCommandLineA"
                   GIVING           MEM-PTR
                   ON EXCEPTION     GO TO ERR-CALL.

           IF      MEM-PTR          = 0
                   GO               TO ERR-CALL.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 0.
           CALL    "strlen"         USING
                   BY VALUE         MEM-PTR
                   GIVING           VAR-SIZE.

           IF      VAR-SIZE         = 0
                   EXIT             PARAGRAPH.

           CALL    "C$MEMCPY"       USING
                   BY REFERENCE     CMD-LINE
                   BY VALUE         MEM-PTR
                   VAR-SIZE.

           CANCEL  "MSVCRT.DLL".
           CANCEL  "KERNEL32.DLL".
           ADD     1                TO VAR-SIZE.
           MOVE    LOW-VALUES       TO CMD-LINE(VAR-SIZE:1).
           DISPLAY MESSAGE          BOX
                   CMD-LINE
                   TITLE            "Command line"
                   TYPE             1
                   ICON             1.


Any suggestions on how to do this would be great.

Thanks,
Rob

[Migrated content. Thread originally posted on 07 March 2006]

I am looking to populate the clipboard with some text. I have an example of where the clipboard is populated with the command line being used. This works perfectly on Windows, however I'm having problem with thin client.

I've used the "@[DISPLAY]:" syntax with all of these dll calls and that seems to work fine. I run into a problem at the C$MEMCPY call. I get a MAV and I'm assuming this is because it's not using the client machine. I couldn't use the "@[DISPLAY]:" syntax here. Is there another way to accomplish this?

Here is a code snippet from the portion that is getting the command line into memory. Later, it's placed on the clipboard.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 1.
           CALL    "KERNEL32.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "MSVCRT.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "GetCommandLineA"
                   GIVING           MEM-PTR
                   ON EXCEPTION     GO TO ERR-CALL.

           IF      MEM-PTR          = 0
                   GO               TO ERR-CALL.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 0.
           CALL    "strlen"         USING
                   BY VALUE         MEM-PTR
                   GIVING           VAR-SIZE.

           IF      VAR-SIZE         = 0
                   EXIT             PARAGRAPH.

           CALL    "C$MEMCPY"       USING
                   BY REFERENCE     CMD-LINE
                   BY VALUE         MEM-PTR
                   VAR-SIZE.

           CANCEL  "MSVCRT.DLL".
           CANCEL  "KERNEL32.DLL".
           ADD     1                TO VAR-SIZE.
           MOVE    LOW-VALUES       TO CMD-LINE(VAR-SIZE:1).
           DISPLAY MESSAGE          BOX
                   CMD-LINE
                   TITLE            "Command line"
                   TYPE             1
                   ICON             1.


Any suggestions on how to do this would be great.

Thanks,
Rob
instead of c$memcpy, you can use strncpy which is in the C runtime library together with the strlen function. Actually you can just use strcpy and not use strlen either.


CALL "strcpy" USING BY REFERENCE target, BY REFERENCE source.

Assuming C calling convention and zero terminated strings.

[Migrated content. Thread originally posted on 07 March 2006]

I am looking to populate the clipboard with some text. I have an example of where the clipboard is populated with the command line being used. This works perfectly on Windows, however I'm having problem with thin client.

I've used the "@[DISPLAY]:" syntax with all of these dll calls and that seems to work fine. I run into a problem at the C$MEMCPY call. I get a MAV and I'm assuming this is because it's not using the client machine. I couldn't use the "@[DISPLAY]:" syntax here. Is there another way to accomplish this?

Here is a code snippet from the portion that is getting the command line into memory. Later, it's placed on the clipboard.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 1.
           CALL    "KERNEL32.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "MSVCRT.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "GetCommandLineA"
                   GIVING           MEM-PTR
                   ON EXCEPTION     GO TO ERR-CALL.

           IF      MEM-PTR          = 0
                   GO               TO ERR-CALL.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 0.
           CALL    "strlen"         USING
                   BY VALUE         MEM-PTR
                   GIVING           VAR-SIZE.

           IF      VAR-SIZE         = 0
                   EXIT             PARAGRAPH.

           CALL    "C$MEMCPY"       USING
                   BY REFERENCE     CMD-LINE
                   BY VALUE         MEM-PTR
                   VAR-SIZE.

           CANCEL  "MSVCRT.DLL".
           CANCEL  "KERNEL32.DLL".
           ADD     1                TO VAR-SIZE.
           MOVE    LOW-VALUES       TO CMD-LINE(VAR-SIZE:1).
           DISPLAY MESSAGE          BOX
                   CMD-LINE
                   TITLE            "Command line"
                   TYPE             1
                   ICON             1.


Any suggestions on how to do this would be great.

Thanks,
Rob
instead of c$memcpy, you can use strncpy which is in the C runtime library together with the strlen function. Actually you can just use strcpy and not use strlen either.


CALL "strcpy" USING BY REFERENCE target, BY REFERENCE source.

Assuming C calling convention and zero terminated strings.

[Migrated content. Thread originally posted on 07 March 2006]

I am looking to populate the clipboard with some text. I have an example of where the clipboard is populated with the command line being used. This works perfectly on Windows, however I'm having problem with thin client.

I've used the "@[DISPLAY]:" syntax with all of these dll calls and that seems to work fine. I run into a problem at the C$MEMCPY call. I get a MAV and I'm assuming this is because it's not using the client machine. I couldn't use the "@[DISPLAY]:" syntax here. Is there another way to accomplish this?

Here is a code snippet from the portion that is getting the command line into memory. Later, it's placed on the clipboard.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 1.
           CALL    "KERNEL32.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "MSVCRT.DLL"
                   ON EXCEPTION     GO TO ERR-LOAD.
           CALL    "GetCommandLineA"
                   GIVING           MEM-PTR
                   ON EXCEPTION     GO TO ERR-CALL.

           IF      MEM-PTR          = 0
                   GO               TO ERR-CALL.

           SET     ENVIRONMENT      "DLL-CONVENTION" TO 0.
           CALL    "strlen"         USING
                   BY VALUE         MEM-PTR
                   GIVING           VAR-SIZE.

           IF      VAR-SIZE         = 0
                   EXIT             PARAGRAPH.

           CALL    "C$MEMCPY"       USING
                   BY REFERENCE     CMD-LINE
                   BY VALUE         MEM-PTR
                   VAR-SIZE.

           CANCEL  "MSVCRT.DLL".
           CANCEL  "KERNEL32.DLL".
           ADD     1                TO VAR-SIZE.
           MOVE    LOW-VALUES       TO CMD-LINE(VAR-SIZE:1).
           DISPLAY MESSAGE          BOX
                   CMD-LINE
                   TITLE            "Command line"
                   TYPE             1
                   ICON             1.


Any suggestions on how to do this would be great.

Thanks,
Rob
instead of c$memcpy, you can use strncpy which is in the C runtime library together with the strlen function. Actually you can just use strcpy and not use strlen either.


CALL "strcpy" USING BY REFERENCE target, BY REFERENCE source.

Assuming C calling convention and zero terminated strings.