|
Hi All,
How can i convert LPWSTR to CString. Can anyone please help.
Thanks,
Arun.
|
|
|
|
|
arunperi wrote: convert LPWSTR to CString
LPWSTR pwStr;
CString s = pwStr;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Actually I am not getting the whole text instead i'm getting only the first character.
---Arun.
|
|
|
|
|
(Voting you 5 because you answer was correct but you had two 1 votes for some reason.)
|
|
|
|
|
Look at one of the constructor of CString,
CString( LPCWSTR lpsz );<br />
throw( CMemoryException );
PS. Where are you seeing the only one char ?
Regards,
Paresh.
|
|
|
|
|
Paresh Chitte wrote: PS. Where are you seeing the only one char ?
you didn't get it.
his project certainly doesn't define UNICODE, so his CString is actually CStringA (ansi string - char*).
but he assigns a wide characters string into an ansi string; and wide string contain \0 bytes into some characters, that's why he sees only the first one...
BTW, see my other reply to have a working solution for this pb
|
|
|
|
|
The ANSI/Unicode setting doesn't affect the CString ctor that accepts an LPCWSTR .
|
|
|
|
|
then why does the OP get only the first character of his original string ?
|
|
|
|
|
LPWSTR pwStr;
CString s = <code>CW2T</code>(pwStr);
|
|
|
|
|
Or you can just use the CString ctor that accepts an LPCWSTR , as the other posters said.
|
|
|
|
|
arunperi wrote: How can i convert LPWSTR to CString. Can anyone please help.
CString::Format with L"%s"
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
hi all,
Actually i have made a sdi application and started various number of thread inside it.
Now what i want is to close all thread simultaneously at ExitInstance().
Can anybody please help me in this..
Thanks in advance
|
|
|
|
|
Are they worker threads or UI-threads?
What mechanism do you use to stop any of them?
Perhaps some excellent articles about how to use threads can be of service: worker threads[^], UI-threads[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
They are all UI threads
Is it possible to close all of them without using their objects..
like
PostThreadMessage(WM_QUIT,NULL,NULL);
|
|
|
|
|
PostThreadMessage(...) is the correct way to end a UI-thread, you're right about that.
It usually desired and considered good practice to wait on the thread handle to make sure that the thread has finished and delete the CWinThread object afterwards.
The articles I linked to in my previous post will show you how.
However, this requires that you keep track of all threads in some kind of container, e.g. std::vector .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
neha.agarwal27 wrote: PostThreadMessage(WM_QUIT,NULL,NULL);
yeah you have to post same to all the object which are representing the UI thread
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi
Can u send partial code so that i can give u solution.
In which company ur working now.
Thanks and Regards
Atul
Atool
|
|
|
|
|
Keep the boolean var that keeps the loop running global. It does the job for you.
Use the same variable to control the loops in all the threads. Setting that to false would let every thread jump out of the loops. And in the end you can check using the Wait functions to see if everything's closed properly. For that you need to maintain the handles in a structure as Roger just mentioned.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
I used RegisterDeviceNotification()for getting USB Ins/Eject messages.
But I didn't get the drive letter for the device, am getting the class UID. Please help me to get the drive letter.
rgds
aneesh
|
|
|
|
|
The GetLogicalDriveStrings() function specifies the valid drives in the system.
|
|
|
|
|
hi,
How can we pass more than one Query String in the site map
<b> this is the exmaple for one query string :</b>
<siteMapNode url="~/Members/Membersmails.aspx?otherCall=No" title="Inbox" description="Inbox"></siteMapNode>
now i want to pass 3 query strings:
<b>this is my code:</b>
<siteMapNode url="~/Members/Memberscomposemail.aspx?otherCall=No&email=k.pulpa@gmail.com&k=7 title="Inbox" description="Inbox"></siteMapNode>
but this is not working
Can any one help me out with this.
Thanx in Advance
|
|
|
|
|
Hi
use & instead of &
<siteMapNode url="HoroscopeDetail.aspx?sid=43&nm=kundli" title="Kundli" description="Kundli Dekhe" />
|
|
|
|
|
I can't subclass the Button on MessageBox. Why ??
...............
SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTProc.........
...............
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode == HCBT_CREATEWND)
{
HWND hWnd = (HWND) wParam;
LPCBT_CREATEWND pcb = (LPCBT_CREATEWND) lParam;
CWnd * pWnd = NULL;
TCHAR szClassName[255] = _T("\0");
GetClassName( hWnd, szClassName,sizeof(szClassName) / sizeof(TCHAR) );
if(! lstrcmp(szClassName, _T("Button")))
{
CButtonST pNewButton = new CButtonST;
if( pNewButton )
pNewButton->SubclassWindow( hWnd );
}
}
return CallNextHook( nCode, wParam, lParam);
}
But, I can't subclass MessageBox's Button. Why ??
Sorry, I'm a chinese, And my english is very poor..
-- modified at 1:27 Friday 20th April, 2007
|
|
|
|
|
Hello all,
I would like to Design and write an application that does the editing of a document (almost like an MS Word, but a with a lot cut down functionality of it). The components of the document can only be known at run time, like adding a text box, adding a Image, field, text, etc..,
I Started to design assuming its a simple task, but now I realize its a lot more than what I thought.
can any body please help me with some ideas such as how to keep track of objects inserted, with their properties, (of course I can think up to some extent, such as maintaining a list of them along with a lot of attributes)...
and maintaining them in a file and reconstructing on a file load... and so on..,
but I am curious to know how it is done in a standard industry? are there any standards defined for this purpose.. like how a document (*.doc)is stored?
Hope this stupid question is not annoying,
Haribabu
|
|
|
|
|
I developed a paint software. I load bitmap image and can edit it.
But when I want to remove image, I can't.
So what can i write in OnNewDocument() ?
Can any one help me?
Regards
Mazhar
|
|
|
|