도스창에 입력한 문자열을 그대로 클립보드로 옮기는 프로그램
키움
질문 제목 : 도스창에 입력한 문자열을 그대로 클립보드로 옮기는 프로그램질문 요약 :도스창이 뜨고 하나의 문자열을 입력하면 그 문자열이 클립보드에 입력되는 것질문 내용 :
쉽게 설명해드릴게요... (쉽게 설명한건지는 모르지만...)
┌도스창──────────┐
│
│클립보드에 복사할 문자열 :
│안녕하세요
│
└─────────────┘
이렇게 하고 엔터를 치면...
클립보드에는 안녕하세요 라는 문자가 복사되는 프로그램 소스좀 알려주세요...
전에 수다님이 알려주신 링크 소스는 빌드는 되는데 실행이 안되네요 ㅇㅅㅇ;;
private:
void button1_click( object^ /*sender*/, system::eventargs^ /*e*/ )
{
// takes the selected text from a text box and puts it on the clipboard.
if ( !textbox1-selectedtext-equals( ) )
{
clipboard::setdataobject( textbox1-selectedtext );
}
else
{
textbox2-text = no text selected in textbox1;
}
}
void button2_click( object^ /*sender*/, system::eventargs^ /*e*/ )
{
// declares an idataobject to hold the data returned from the clipboard.
// retrieves the data from the clipboard.
idataobject^ idata = clipboard::getdataobject();
// determines whether the data is in a format you can use.
if ( idata-getdatapresent( dataformats::text ) )
{
// yes it is, so display it in a text box.
textbox2-text = (string^)(idata-getdata( dataformats::text ));
}
else
{
// no it is not.
textbox2-text = could not retrieve data off the clipboard.;
}
}
이 소스는 발견했는데...
c++ 에서 쓰는건지 mfc에서 쓰는건지.. api 에서 쓰는건지 모르겠네요..
c소스에 이것만 붙여넣기해서 빌드하니까... 안되고요;;
-
모은 2024-03-03
MC++ 인가??;;; 당연히 안될껍니다;;;
OpenClipboard, SetClipboardData, CloseClipboard, EmptyClipboard... 등등이 사용될건데..
완전하게 작성된 예제를 한번 찾아보세요.. 위 함수들이 사용될 겁니다. 물론 Win32에서 말입니다.