|
Search for CF_TEXT and SetClipboardData in your Visual C++ help.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Basically, you want to copy the text to an area allocated with GlobalAlloc, then send that to the clipboard.
Here's some basic code, without error checking - you might want to get fancier if you have to deal with unicode etc.
CString strCopyTest;
strCopyTest = "I want to be a clipboard text virus! Please copy me to the clipboard!";
HANDLE hGlobal = ::GlobalAlloc(GMEM_MOVEABLE, strCopyTest.GetLength()+1);
LPSTR lpszData = (LPSTR) ::GlobalLock(hGlobal);
lstrcpy(lpszData,strCopyTest);
::GlobalUnlock(hGlobal);
::OpenClipboard(this->m_hWnd);
::EmptyClipboard();
::SetClipboardData(CF_TEXT, hGlobal);
::CloseClipboard();
|
|
|
|
|
How can i change the color(foreground & background) of column header of a List Control?
|
|
|
|
|
You can do this easily with custom draw. Check out the "NM_CUSTOMDRAW (header)" page in MSDN.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
Hi All,
How can I ensure that only a single instance of a control be created. I used DECLARE_CLASSFACTORY_SINGLETON but it doesn't work. Is there anymore I should do to achieve it?Thanx in advance.
Uday Bhaskar
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
I want to start my programming by DAO,
I want to know, which is better to use ?
Using Access 97 or Access 2000 ?
Please write your comment, and please write DAO version in Access 97 and 2000 ...
Thanks for helps ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hello.
How can I sort List Control lines to reverse order? My program reads these lines from a textfile, and they appear in the list control in wrong order. The first line in the textfile becomes now the last line in the list control. It should be just opposite. These lines contain such information that it's important that they are in the same order as in the textfile.
I've used InsertItem() and SetItemText() -methods to add these lines to the list control.
Here is the code that adds a line.
nItem = m_List.InsertItem(0, text1);
m_List.SetItemText(nItem, 1, text2);
m_List.SetItemText(nItem, 2, text3);
It's in a while-loop, in order to add all necessary lines to the control.
So if anyone can help me, please do so.
Thanx,
paanane
|
|
|
|
|
What's the value of item index you're passing to CListCtrl::InsertItem?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Yeah.
I modified the original question. Is there now enough information to solve the problem?
Thanks to Tomasz for paying attention.
paanane
|
|
|
|
|
m_list.InsertItem(0, text1) inserts item at the zero index - at the very top of the list. Change this to m_list.InsertItem(m_list.GetItemCount(), text). I'm assuming that your list does not have LVS_SORTxxx style set.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I enumerate the encoders registered on my computer(such as:Cinepak Codec by
Radius, MJPEG Compressor,DivX MPEG-4 Fast-Motion...).Then how can I select one
of them (Such as DivX MPEG-4 Fast-Motion) to compress the timeline using
DirectShow
filters?
Note:
These encoder have the same CLSID(CLSID_AVIC0),only FccHandler and ridenlyName
are different.How to select one of them?
Thanks
.
|
|
|
|
|
How do I have my combo box add certain strings in red, others in blue,etc.
I would appreciate something simple, that I should call right before I call AddString() and then to reset before my next call to AddString()
|
|
|
|
|
you have to implement an owner-draw combobox ... look on the relevant section here to find one or some clues
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Isn't there some way to overwrite the dialogs OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) method and to get at each item in the combo box and at the Cedit and set the brush while it's drawing that item????????????
|
|
|
|
|
in essence that is what owner draw is
check it out and you will find it isnt too difficult to do
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
i created my own button class, using CWnd as base class. and by using the AfxRegisterWndClass function, i registered this button class with the hCursor parameter set to NULL. and then, within the button class' OnSetCursor member handler function, i change the default mouse cursor with the cursor i loaded thru LoadCursor by using the SetCursor function. so within my program, whenever the mouse pointer is on top of a button, the mouse cursor changes to the cursor i've set, but the problem is, the mouse cursor flickers. the flickering stops when the mouse pointer is not on top of the button and the mouse cursor returns to the normal arrow cursor.
i don't know what the problem is. can someone please explain.
|
|
|
|
|
Hmmm... what is the return value of your OnSetCursor member? it should be TRUE, if its not I think Windows is probably re-setting the cursor right after you set yours -- thus the flicker.
Have a good one,
-Ben
"Its funny when you stop doing things not because they’re wrong, but because you might get caught." - Unknown
|
|
|
|
|
i explicitly return the value TRUE.
by the way, thanks for the reply.
|
|
|
|
|
The it could be a drawing problem with the button you created.
-Ben
"Its funny when you stop doing things not because they’re wrong, but because you might get caught." - Unknown
|
|
|
|
|
Try using SetCapture when the mouse is over the button.
Don't forget to relese the capture when you are done.
|
|
|
|
|
I use VFP98 open a database named abc.dbf,only spend 5 second include show all the data in database.
But,when I use ODBC API (VC++6.0)open the abc.dbf,and show all the data ,It spend much more times,and make the computer shutdown!!(There is not enough memory!!)
Thanks!
hi
|
|
|
|
|
I have this Date and Time display in my window. Im using the Ontimer() / SetTimer() routine to update it... but the problem is the "second" display's interval is not consistent. It is not actually noticeable but when you compare it with the computers clock you can see it ticking ahead sometimes. what can i do to solve this?
Hope you can help me guys.
Thank You!
Rachel Sy
|
|
|
|
|
How about a second thread that uses Sleep() or SleepEx() instead.
Then every, let's say, 15 seconds, you could do a sync with the computer clock, checking the clock, and checking that your thread is on the right time...
Anyway, just an idea, there may be smarter ways...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Don't rely on intervals between WM_TIMER messages that your program receives. They're just a chance for your program to update date/time display - you should call ::GetSystemTime or CTime/COleDataTime methods in the handler, then output the text if string representing current time changes.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
here is what my program looks like
LONG xxxxxx::OnPageChange(UINT lPageNo, LONG lValue)
{
.
.
//Timer
SetTimer(1, 400, NULL);
.
.
}
void xxxxxx::OnTimer(UINT nIDEvent)
{
TimeDisplay();
CWnd::OnTimer(nIDEvent);
}
void xxxxxx::TimeDisplay()
{
SYSTEMTIME osTime;
GetLocalTime(&osTime);
//YEAR
.
.
//MONTH
.
.
//DAY
//HOUR
//MINUTE
//SECOND
if(oldtime[5] != osTime.wSecond){
oldtime[5] = osTime.wSecond;
//Display second here//
}
}
i tried making a new thread and call TimeDisplay(). But created a while loop inside the TimeDisplay because i dont know a way to update the clock(since i cant use the WM_TIMER here or i can?) i just dont know how....
whats the problem with my program? thanks to everyone who replied to this question. sorry for takign your time... i really appreciate your help....
Rachel
|
|
|
|