• Advertisement

Archived

This topic is now archived and is closed to further replies.

OLE Clipboard :: Win32 API vs. MFC

This topic is 5675 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I use Programming Windows with MFC, Second Edition by Jeff Prosise as a reference for the OLE Clipboard. Prosise demonstrates both Win32 API method and MFC simple classes encapsulating the Win32 API method for the OLE Clipboard. The Win32 API method is not difficult, just takes up a little bit more code than if you use MFC. I would like to know is there any advantage to using Win32 API instead of MFC for OLE Clipboard and even COM? I enjoy working with Win32 API, but not for GUI. Thanks, Kuphryn

Share this post


Link to post
Share on other sites
Advertisement
Okay. I tested an OLE Clipboard implementation with some lines of text. Everything works good, except for that fact that the data buffer ingored all newlines. For example, let this copy the following data, which I first save in a string object, to the OLE Clipboard.

-----
Test
1
2
3
Testing Completed
-----

This is what I would see when I paste to Notepad.

-----
Test[]1[]2[]3[]Testing Completed
-----

I am using the OLE Clipboard strictly for text. I would like to know is it possible to copy data to the clipboard so Windows would recognize all new lines?

Thanks,
Kuphryn

Share this post


Link to post
Share on other sites
Some text editors need ''\r'' ''\n'' as new line. Some need just ''\n'' as new line... or some even just need ''\r'' for new line... complicated, isn''t it?

Share this post


Link to post
Share on other sites
I''m guessing what you''ve got typed as [] is really a box in Notepad? If so, that''s a character that''s unprintable in the current character set. Most likely either a linefeed or carriage return. Some systems (I believe mostly Unix? Anyone?) use both CR (carriage return; 0x0d) and LF (linefeed; 0x0a), while most Windows machines use only 0x0d. So possibly your program is only writing one and not the other, while Notepad is expecting both? Try what Dereksaw has suggested, I''d expect this to fix the problem.

Share this post


Link to post
Share on other sites
Thanks. "\r\n" is the solution. I used "\n," but I really needed "\r\n."

Kuphryn

Share this post


Link to post
Share on other sites

  • Advertisement