Click here to Skip to main content
15,917,862 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Change the bitmap in a Toolbar? Pin
Robert A. T. Káldy19-Feb-04 3:16
Robert A. T. Káldy19-Feb-04 3:16 
GeneralRe: Change the bitmap in a Toolbar? Pin
LittleYellowBird19-Feb-04 4:41
LittleYellowBird19-Feb-04 4:41 
GeneralRe: Change the bitmap in a Toolbar? Pin
l a u r e n19-Feb-04 8:39
l a u r e n19-Feb-04 8:39 
GeneralShellExecuteEx multiple selection Pin
Aviv Halperin18-Feb-04 23:04
Aviv Halperin18-Feb-04 23:04 
GeneralPush Buttons Pin
ffazly18-Feb-04 21:31
ffazly18-Feb-04 21:31 
GeneralRe: Push Buttons Pin
P-Rex18-Feb-04 22:30
P-Rex18-Feb-04 22:30 
GeneralRe: Push Buttons Pin
ffazly19-Feb-04 19:25
ffazly19-Feb-04 19:25 
GeneralRtf editor in a dialog based app Pin
Filomela18-Feb-04 21:15
Filomela18-Feb-04 21:15 
I have a rtf editor in a dialog based app and while somebody seaches on the net and copy the information needed he wants not to switch between apps and not to press Ctrl+V , but when he selects and copy he wants the text to be pasted into my rtf editor. I did this but the text is pasted over and over and over again. How can I paste the text, img, text+img just one single time?
When I copy from other app than IE the text is pasted one single time but when I copy from IE the text is pasted over and over again.
The code is the following:
void CMyRtfDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if ( nIDEvent < 900)
{
COleDataObject oleTarget;
oleTarget.AttachClipboard ();

if(oleTarget.IsDataAvailable(CF_TEXT) || oleTarget.IsDataAvailable(cfRTF))
{
if ( MyChangeClip() )
{
PasteText ();
UpdateData();
InsLineBreak();
}
}
CDialog::OnTimer(nIDEvent);
}
bool CMyRtfDlg::MyChangeClip()
{
int nValue;
bool bContent;

// Test to see if we can open the clipboard first.

if (OpenClipboard())
{

// Retrieve the Clipboard data (specifying that
// we want ANSI text (via the CF_TEXT value).

HANDLE hClipboardData = GetClipboardData(CF_TEXT | cfRTF);

// Call GlobalLock so that to retrieve a pointer
// to the data associated with the handle returned
// from GetClipboardData.

char *pchData = (char*)GlobalLock(hClipboardData);

// Set a local CString variable to the data
// and then update the dialog with the Clipboard data

strFromClipboard = pchData;

// Unlock the global memory.

GlobalUnlock(hClipboardData);

// Finally, when finished I simply close the Clipboard
// which has the effect of unlocking it so that other
// applications can examine or modify its contents.

CloseClipboard();
}//end open clipboard
else
{
AfxMessageBox("Can't open the clipboard!!!");
//return true;
}

// -1 if the substring or character is not found
// this means that clipboard content has changed

m_rtf.GetWindowText(m_strFromRtf);
//AfxMessageBox(m_strFromRtf);

nValue = m_strFromRtf.Find(strFromClipboard);

if ( nValue == -1 )
bContent=true;
else
bContent=false;

return bContent;
}
nValue is always -1 when I paste from IE.Can anyone tell me why?
And other question : How can I paste img from Word?
Thank you,
Adriana
GeneralSerial Communication - Laptop and PDA Pin
Deepa Gopal18-Feb-04 20:47
Deepa Gopal18-Feb-04 20:47 
GeneralRe: Serial Communication - Laptop and PDA Pin
J.B.19-Feb-04 3:39
J.B.19-Feb-04 3:39 
GeneralCalculate file size while creating avi video Pin
oliverlin18-Feb-04 20:31
oliverlin18-Feb-04 20:31 
GeneralCan anyone help me ? Pin
oliverlin19-Feb-04 15:30
oliverlin19-Feb-04 15:30 
GeneralNeed help with C++ vs C# resource problem Pin
Matt Philmon18-Feb-04 19:32
Matt Philmon18-Feb-04 19:32 
GeneralApplication Priority - when minimized Pin
krithika_Ramanujam18-Feb-04 19:21
krithika_Ramanujam18-Feb-04 19:21 
Questionneed sql query? Pin
murali_utr18-Feb-04 18:48
murali_utr18-Feb-04 18:48 
AnswerRe: need sql query? Pin
22491719-Feb-04 0:49
22491719-Feb-04 0:49 
GeneralEdit Control - Word Wrap Pin
monrobot1318-Feb-04 17:53
monrobot1318-Feb-04 17:53 
GeneralRe: Edit Control - Word Wrap Pin
Paul Hooper18-Feb-04 21:38
Paul Hooper18-Feb-04 21:38 
GeneralRe: Edit Control - Word Wrap Pin
monrobot1320-Feb-04 7:03
monrobot1320-Feb-04 7:03 
GeneralCommunication with Splitters Pin
telstar18-Feb-04 17:30
telstar18-Feb-04 17:30 
Generalclistbox greying Pin
SVPG18-Feb-04 17:02
SVPG18-Feb-04 17:02 
GeneralRe: clistbox greying Pin
sps-itsec4619-Feb-04 3:20
sps-itsec4619-Feb-04 3:20 
Generaluse a dll to link 2 diff Static Lib Pin
braderbear18-Feb-04 16:59
braderbear18-Feb-04 16:59 
GeneralRe: use a dll to link 2 diff Static Lib Pin
Prakash Nadar18-Feb-04 19:11
Prakash Nadar18-Feb-04 19:11 
GeneralComboBox display problem on Windows 98 Pin
J.B.18-Feb-04 16:25
J.B.18-Feb-04 16:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.