 |
|
 |
The Article describes how to copy images to clipboard and how to copy tabledata.
I want to copy tabledata consisting of text and images (some cells contain text and others images). The data is in datagridview and should be copied to word.
Any suggestions how to realize?
Thank You!
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
//This is my Copy file function. void CMyAppView::OnEditCopy() { TCHAR szFiles[MAX_PATH]; CString str = "D:\\my application.xls"; int n = str.GetLength(); strcpy(szFiles, str);
if (OpenClipboard()) { EmptyClipboard();
int nSize = sizeof(DROPFILES) + n; //sizeof(szFiles); HANDLE hData = GlobalAlloc(GHND, nSize); LPDROPFILES pDropFiles = (LPDROPFILES)GlobalLock(hData); pDropFiles->pFiles = sizeof(DROPFILES); pDropFiles->fWide = FALSE; LPBYTE pData = (LPBYTE) pDropFiles + sizeof(DROPFILES); CopyMemory(pData, szFiles, n); //sizeof(szFiles)); GlobalUnlock(hData); SetClipboardData(CF_HDROP, hData); CloseClipboard(); } } Sometimes result is : 1. There are 4 files in clipboard: D:\my application.xls i j k (-> incorrect) 2.there are 1 file in clipboard: D:\my application.xls (->correct) Any ways? Can you help me? Thanks a lot.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
In Office 2003, the inbuilt clipboard viewer shows all the data that has been copied to the clipboard. My question is, Is the Clipboard capable of handling multiple "CTRL+C"s? I mean if I copy some text then I copy another set of text, will the previous one be overwritten or will it remain in the clipboard at a different index( like in an array )?
My situation is such that I want to use the clipboard but not lose the previous data which was there. i.e. After my work with the clipboard is done, it should be set with the previous data which was there, irrespective of the type of data. How do I achieve it?
---  Hakuna-Matada It means no worries for the rest of your days... It's our problem free, Philosophy<marquee behavior=alternate scrollamount=5 scrolldelay=50>  </marquee>
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
HI! Nice article.
How it eplained in Microsoft`s MSDN Knowledge Base Q148455 there is a problem with CSharedFile.
And as resolution you may do following things:
CSharedFile file;
// Do stuff to fill in the CSharedFile
HGLOBAL hGlob = file.Detach(); #if _MFC_VER <= 0x0600 ::GlobalUnlock(hGlob); #endif
May it helps you
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Thanx a Lot mate. You have helped me save a lot of my time. I wanted to get Client Area on to the clipboard and you have done it fantastically. Thanx Again.
Regards, Aamir
Imagine that you are creating a fabric of human destiny with the object of making men happy in the end, giving them peace and rest at last, but that it was essential and inevitable to torture to death only one tiny creature..and to found that edifice on its unavenged tears, would you consent to be the architect on those conditions? Tell me, and tell me the truth!
-Fyodor Dostoevsky, The Brothers Karamazov
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello,
I have a simple question about OnDraw(), I want to draw BackGroud to the default window.
Below is my code:
RECT rct; GetClientRect(&rct); CRect rect(rct); HDC hdcMem = ::CreateCompatibleDC(pDC->m_hDC); HBITMAP hBM = ::CreateCompatibleBitmap(pDC->m_hDC,rect.Width(),rect.Height()); HBITMAP hOldBM = (HBITMAP)SelectObject(hdcMem,hBM); CBrush brush(RGB(255,0,0)); ::FillRect( hdcMem,&rect,brush ); SelectObject(hdcMem,hOldBM); DeleteObject(hBM); DeleteObject(hdcMem); brush.DeleteObject();
it dosn't work, but if I do the other way, it works fine. RECT rct; GetClientRect(&rct); CRect rect(rct); CBrush brush(RGB(255,0,0)); pDC->FillRect(&rect,&brush ); brush.DeleteObject();
I want to know why? could you help me out? I really appreciate.
Yours Quin
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I wrote a little clipboard application and I want that every time a CTRL+V is pressed to perform some action in my application that will affect the data in the clipboard, repost it to the clipboard and display it on the screen.
lets say, that I did CTRL+C on "hello" and now pressed CTRL+V. my application will convert to upercase "HELLO" and I want it pasted on screen (of course without the smallercase "hello")
I have talked to people who said maybe catching an interrupt of CTRL+V and creating one after manipulation - but, can I make sure my CTRL+V interrupt is done before it is pasted by the OS on the screen ?
if so, how do I catch and throw such an interrupt ?
thank you in advance, MA.
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
hi,
i have a process that needs to give its clipboard information (contents, size of contents) to another process on another machine. These 2 processes communicate via sockets. If the clipboard has data in text format, i am able to convert that to characters and send it across to receiving process. However, the problem comes when clipboard data is in CF_BITMAP form. How can i convert this into raw bytes and send it across using sockets?
Thanx,
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Dear Sir and Madam
I have some Word files stored in Database. I want to output them into one Word file without changing its format.
Could you mind telling me the solutions for this.
I look forward to receiving reply.
Thank you very much for your help.
Sincerely yours,
LAITHETHOI
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
I'm using an activeX control of type microsoft web browser and i want to disable copy paste can anybody help me?
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
|
 |
 | Multiple  Konstantin S. Diguine | 5:02 6 Apr '01 |
|
 |
How can I place the same data in the multiple formats on the clipboard? It would be best of all if someone knows how to do this using pure WinAPI ot at least without "COleDataSource" (without OLE at all). And why Corel(9) does not "understend" CF_ENHMETAFILE???
konst
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
You're right. I was teaching an MFC class when I wrote up this example for CodeProject. The group project was to create a cross stitch editor. The theory being that this was a program that was feasible for a 400 level group project that had the following properies:
1) None of the students probably knew anything about cross stitching. 2) I could readily explain to them what cross stitching was in a few minutes. 3) All of the student's probably knew someone who did cross stitch. 4) The knowledge of MFC required for this project could be taught in just a few weeks.
The result was, shall we say, interesting. I think it was a learning experence for everyone (including my self). For the most part a cross stitch editor was the right level of project an met my goals. I'm not sure that the students found it terribly interesting though. They seemed to like the screen saver individual project best.
Keith
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
LOL Well, at least your goal was reached. I will be teaching students in a few months from now, do you have any suggestions for me? (Besides not being nervous ) Or maybe even a link where I can find interesting material on this topic, or even examples? Tnx!
-- Alex Marbus www.marbus.net
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
...copy selected/marked text from the currently active foreground window (e.g. in an Internet Explorer or Outlook window) into the clipboard from within my own application?
I tried this way:
CMyDialog::OnSomeAction() { CWnd *pWnd = GetForegroundWindow(); // Get the desktop's foreground window if (NULL != pWnd) { DWORD ProcID; // Get the foreground window's thread ID DWORD ThreadID = GetWindowThreadProcessId(pWnd->GetSafeHwnd(), &ProcID);
// Attach other thread's message queue to our own to ensure GetFocus() is working properly BOOL ARes = AttachThreadInput(ThreadID, GetCurrentThreadId(), TRUE); if (0 != ARes) { // Get the other thread's focussed window CWnd *pWnd2 = pWnd->GetFocus(); if (NULL != pWnd2) { OpenClipboard(); ::EmptyClipboard(); CloseClipboard();
pWnd2->SendMessage(WM_COPY); // Now doing something with the clipboard contents.. } // Detach other thread's message queue from our own again ARes = AttachThreadInput(ThreadID, GetCurrentThreadId(), FALSE); } } // if (NULL... }
However, this seems to work only successfully if the window (pointed to by pWnd2) is derived from CEdit or CRichEditCtrl (e.g. while using Notepad or a MS-Office document). It does NOT work with marked/selected text for instance in an Internet Explorer or Outlook window. How could I retrieve such text data?
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
WM_COPY is specific to Edit and Combo controls. You will need to send a WM_COMMAND with the ID of the Copy option. Umm... not that simple. MFC defines ID_EDIT_COPY as 0xE122, so this will work for any MFC application using the defaults, but it is extremely hit-and-miss. If you are targeting only specific applications, then this method could work, but it is not at all generic.
Another alternative could be to simulate the target app's Copy key-stroke. Generally Ctrl+Ins and/or Ctrl+C, but again it can be application specific.
Hope this kinda helps  Craig
|
| Sign In·View Thread·PermaLink | 3.50/5 |
|
|
|
 |