|
I have code written as below :
CString csText;
HANDLE hData=NULL;
m_emailAddress.GetWindowText( csText );
if( (hData=GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, (csText.GetLength()+1) )) )
{
LPVOID lpLockedMemory=NULL;
lpLockedMemory = GlobalLock( hData );
CopyMemory( lpLockedMemory, csText.GetBuffer(csText.GetLength()), csText.GetLength() );
if( SetClipboardData( CF_TEXT, lpLockedMemory ) == NULL )
{
AfxMessageBox( "Unable to set Clipboard data" );
GlobalUnlock( lpLockedMemory );
lpLockedMemory = NULL;
CloseClipboard();
return;
}
}
Now, this code works fine on Winxp, but for Win98 I get NULL as return value of SetClipboardData(). Can anyone help on this?
-- modified at 4:03 Thursday 24th August, 2006
|
|
|
|
|
Yes, but not in the Lounge. That's why there's a red "No Programming Quesions, Please" sign at the top of the page...
Post in the correct forum and you might just get some assistance with your problem.
Anna
Currently working mostly on: Visual Lint
Anna's Place | Tears and Laughter
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
|
|
|
|
|
|
I'm going to save you from yourself and move this to the right forum. In future, please don't ask programming questions in the lounge.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: move this to the right forum
What work does this require ? I mean, I have no knowledge of databasis and SQL and so, but is this done easily or do you have to dig somewhere to find the thread and reput it in another table ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Well, the first step would be to work here
I made the comment because I thought I was going to be the first ( and only lounge ) reply, and I wanted the OP to know that they had posted in the wrong spot still.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: would be to work here
It was not my intention to do it myself, only wanted to nkow how this works...
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Fair enough - well, as an employee, I get UI to do that, I don't need to be messing with any DB tables directly.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
sachinbhave wrote: but for Win98 I get NULL as return value of SetClipboardData().
No win98 system , to check this.
Can you use GetLastError to check what error its returning.
|
|
|
|
|
Your memory management is a bit off. Call GlobalUnlock() before SetClipboardData() . If SetClipboardData() succeeds, the clipboard owns the memory, so you're done. If it fails, you need to GlobalFree() the memory.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
sachinbhave wrote: CopyMemory( lpLockedMemory, csText.GetBuffer(csText.GetLength()), csText.GetLength() );
It is not necessary to call GetBuffer() since you are not modifying csText .
sachinbhave wrote: I get NULL as return value of SetClipboardData().
Which means you should be calling GetLastError() to find out why.
sachinbhave wrote: GlobalUnlock( lpLockedMemory );
You should be calling this function regardless of whether SetClipboardData() fails or not.
sachinbhave wrote: CloseClipboard();
There's no reason to call this if SetClipboardData() fails. Nothing is open at that point.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Did you use from GetLastError for see error
|
|
|
|
|
Hi all,
I am creating a Edit Box Dynamically in CDialog Box. And when i Right Click on the Edit Box what i have created i want to show a Menu.
//===========================================================================
//Source for Creating the Edit Box when mouse is clicked.
CEdit *ptr = new CEdit;
ptr->Create(WS_VISIBLE|WS_CHILD|WS_BORDER|WS_TABSTOP|ES_AUTOHSCROLL,CRect(point.x,point.y,point.x +100, point.y +20),this,NULL);
Note : the Last Parameter is the ID for the Edit Control in Create(...) Api.
//===========================================================================
Now i am not able to handle an event to this dynamically created Edit Box. I want to Handle the RButtonDown Event for every Dyanmically Created Edit Box. i Mean when ever i Right Click on the EditBox what i have Created i want to Populate a Menu using TrackPopUpMenu(...) Api.
please help me out.
Uday kiran
|
|
|
|
|
You need to add the entries of the control in the message map manually. The best way to do it is to look how class wizard does and do the same for your control.
So, add an edit box to your dialog, add the handler with classwizard look at the message maps entries (in the dialog class header file and source file) and see what has changed. Now you can do the same for your control.
|
|
|
|
|
Hi Cedric Moonen,
My Doubt is that the CEditBox doesn't Handle the WM_RBUTTON_DOWN Event. The Events handled for the Edit Box are.
EN_CHANGE,EN_ERRORSPACE,EN_HSCROLL,EN_KILLFOCUS,EN_MAXTEXT,EN_SETFOCUS,EN_UPDATE.
What about the Event Handler of WM_RBUTTON_WOWN Event.
please tell me your suggestions.
Uday kiran
|
|
|
|
|
uday kiran janaswamy wrote: The Events handled for the Edit Box are.
EN_CHANGE,EN_ERRORSPACE,EN_HSCROLL,EN_KILLFOCUS,EN_MAXTEXT,EN_SETFOCUS,EN_UPDATE.
These aren't events handled by the edit control. These are notifications posted by the edit control to it's parent. In that case you can use WM_PARENTNOTIFY[^]. Or if your only interested in a right-click there is NM_RCLICK[^] notifications.
|
|
|
|
|
i made an application which used a dll and loads it dynamically. If dll is not present an exception raises. All i want is if dll is not present it should be known at the Loadlibrary(..) call and i could handle that exception.
Is my question meaningfull? If yes please help me.
Thank you
KIRAN PINJARLA
|
|
|
|
|
|
Hi all,
I have created a device independent driver. For which i want a application launcher. My drivers name is "TestIOCTL" and its symbollic link is "\Device\TestIOCTL ". I now want to open this driver file for which i have used the following code segment.
hDevice = CreateFile ("\\DosDevices\\TestIOCTL",
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
);
The hDevice returns 3 thro GetError() Method meaning File not found. Can anyone tell me how to open this driver file.
Thanks In advance.
Regards
Kenny.
|
|
|
|
|
Correction:
Error 3 means ERROR_PATH_NOT_FOUND
(Error 2 means ERROR_FILE_NOT_FOUND)
Just a hint, I never opened a driver myself.
But I suggest you try these for the "file" name:
L"\\\\.\\Device\\TestIOCTL"
L"\\\\.\\TestIOCTL"
L"\\\\.\\DosDevices\\TestIOCTL
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
|
Hi all,
I have disabled my grid lines of ListCtrl, so that it is not visible now.But I need to draw a border line(should be splitted line) between some items ie my listCtrl will looks like this
col1 col2 col3 col4 col5
itm1 itm2 | itm3 itm4 itm5
itm1 itm2 | itm3 itm4 itm5
itm1 itm2 | itm3 itm4 itm5
itm1 itm2 | itm3 itm4 itm5
itm1 itm2 | itm3 itm4 itm5
itm1 itm2 | itm3 itm4 itm5
And also I dont want to show the partition lies between the column heading
Can anybody tell a solution to this,
Thanks in Advance
George K JOlly
-- modified at 2:27 Thursday 24th August, 2006
|
|
|
|
|
I see two solutions:
1. Make an ownerdrawn control derived from the CListCtrl.
2. Use a grid control
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Hi Rage,
How can i make an ownerdrawn listcontrol,
Thanks
George K Jolly
|
|
|
|
|