Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MS-VC++ 6.0 "new" Works Fine

Author: Odd Gunnar Malin

Date: 00:35:49 12/08/03

Go up one level in this thread


On December 07, 2003 at 08:58:32, Dieter Buerssner wrote:

>On December 06, 2003 at 07:14:04, martin fierz wrote:
>
>>if your engine is for windows only, you should switch to the windows memory
>>allocation functions, as there you know exactly what the OS is doing.
>
>I try to program it as portable as possible, and it is not for Windows only
>(previous versions actually ran on Atari ST, VAX/VMS, ... . It still runs under
>DOS, with DOS extender). I think, I will ignore this specific problem for now.
>Although it would certainly be not too difficult to just switch to VirtualAlloc
>for the HT only.
>
>Another off topic question - perhaps your book can help, too (mine doesn't). I'd
>like to have one Windows specific feature - namely accessing the clipboard. I
>know, how it is done for GUI applications, but how to do it for Win32 console
>applications. OpenClipboard() wants a handle (why?) as parameter. How to get
>this handle for a console mode program?
>
>I would like to use the clipboard for pasting PGN.
>
>Regards,
>Dieter

Just use NULL as windowshandle.

Ex.

void cmdPgnFromClipboard()
{
  if (IsClipboardFormatAvailable(CF_TEXT))
  {
    if (OpenClipboard(NULL))
    {
      HGLOBAL hg=GetClipboardData(CF_TEXT);
      if (hg)
      {
        char* cd=(char*)GlobalLock(hg);
        if (cd)
        {
          cout << cd;
          GlobalUnlock(hg);
        }
      }
      CloseClipboard();
    }
  }
}

Odd Gunnar



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.