News:

OS2World.com Forum is back !!!

Remember to visit OS2World at:
http://www.os2world.com

Main Menu

Copying text strings to AOS-5.1 clipboard in 'C'

Started by Andrew Stephenson, November 13, 2023, 09:44:57 AM

Previous topic - Next topic

Andrew Stephenson

While waiting for my new m/c && AOS-5.1 to arrive, I've been keeping my brain busy outlining an app which, if it works nicely, I'd like to offer to the AN Free Fun Stuff section.  May I keep its nature vague for now?  I'm hoping someone can show me some simple 'C' code that copies text to the AOS (5.1, if it matters) clipboard.  I admit to being lazy but I do want to get it right (and safe) and researches suggest clipboard interfacing can be a can of worms.

Essentially, my app supplies char *pText where the string pointed to can be up to 200 chars (plus final \0) long.  If commanded, the app generates the string and copies it; otherwise, the string is only displayed on screen, allowing it to be redirected or piped in the usual way.

Maybe this has been asked before.  I did look but maybe in too much haste.

Dave Yeo

What compiler? GCC at least would just use putenv()

Roderick Klein

Quote from: Andrew Stephenson on November 13, 2023, 09:44:57 AM
While waiting for my new m/c && AOS-5.1 to arrive, I've been keeping my brain busy outlining an app which, if it works nicely, I'd like to offer to the AN Free Fun Stuff section.  May I keep its nature vague for now?  I'm hoping someone can show me some simple 'C' code that copies text to the AOS (5.1, if it matters) clipboard.  I admit to being lazy but I do want to get it right (and safe) and researches suggest clipboard interfacing can be a can of worms.

Essentially, my app supplies char *pText where the string pointed to can be up to 200 chars (plus final \0) long.  If commanded, the app generates the string and copies it; otherwise, the string is only displayed on screen, allowing it to be redirected or piped in the usual way.

Maybe this has been asked before.  I did look but maybe in too much haste.

If you are writing a program with Open Watcom or Visual Age: try one of the following programs:
http://www.altsan.org/programming/os2/index.html#dbcsmap
Sources included.

Roderick



Martin Iturbide

#5
Hello Andrew

I'm not a developer, but I tried to compile some little Presentation Manager (PM - our GUI) samples with gcc, just for my personal learning.
The community helped me on this forum thread. "Compiling a PM sample with GCC (2023) ", but it is too long to read.

Maybe you can check the OS2World Github repository (filtered by the PM Samples) and check some samples there to help your learning. I included also a screenshot on the samples I was able to compile (with the help of the people here).  I didn't used OpenWatcom (it is on my wishlist to learn that), I just used make, gcc and other open source tools.

If you want to develop something, and don't mind sharing the source code, I would recommend you to post here your sample and what error/stopper you get, and see if we can help.

Sorry If I drift too much of the subject.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

David Graser


Rich Walsh

With all due respect to others who have responded, I have to say that the only way you'll really know how things work is if you RTFM (a term, BTW, that had a long history on Usenet and was NEVER taken to be offensive).

To that end, I've attached the complete "Presentation Manager Programming Guide and Reference". Unzip it somewhere convenient then create a program object for it like so:

File name:     VIEW.EXE
Parameters:  pm1.inf+pm2.inf+pm3.inf+pm4.inf+pm5.inf
Working dir:  <directory containing these files>

Tom

Quote from: Rich Walsh on November 15, 2023, 11:20:00 PM
With all due respect to others who have responded, I have to say that the only way you'll really know how things work is if you RTFM (a term, BTW, that had a long history on Usenet and was NEVER taken to be offensive).

You mean Read The Fine Manual? (eg,d&rfc)