|
M. Atul wrote: Microsoft Unicode Layer
It is Microsoft Layer for Unicode. If your application is going to run on Windows 98 or other versions of windows that doesn't support unicode, you need to install MSLU on that machine in order to get your unicode application run on it. Read about MSLU here[^]
If your application is going to run on 2000 or above which already supports unicode, then you don't need MSLU.
Last but not least: For your application to support unicode, define _UNICODE in your precompiled header.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
The following applies to VC++ 6.0:
First you need to add the preprocessor definition _UNICODE to your project settings. Then make all your character types TCHAR; when compiled for Unicode TCHAR becomes a wide character (wchar_t); otherwise it is a char. If you are using the MFC CString then just use as you normally would. If you are using C functions like strlen, then you need to use the Microsoft equivalent functions that begin with _ts. These functions take TCHAR arguments and will change based on whether you specified _UNICODE or not. That means when you compile for Unicode they expect wchar_t types and in non-Unicode they expect char types.
If you are planning to use C++ strings (std::string) then the simplest solution is to use basic_string<TCHAR> as the string type.
Do not for get to use the _T macro wherever you type in a string, this adds an ‘L’ before the string when compiled for Unicode: _T(“This is a string”).
For more information check the MSDN and you might want to grab a copy of ‘Agent Ransack’ off the Net, you can use it to search for all the places that _UNICODE is used in the files that come with VC to see how it is being used.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I changes my application to UNICODE compatible.
First i got Above 300 errors.
The through reading some articles in Code Project and MSDN and changed.
Now i got all similar types of errors.
i.e.1. cannot convert parameter 1 from 'unsigned short *' to 'const char *'
2.cannot convert parameter 1 from 'const char *' to 'const unsigned short *'
|
|
|
|
|
Hi.,
use TCHAR* instead of char*
bye.
|
|
|
|
|
I used LPTSTR instead of char*.
Even though i used TCHAR*, i got the same problem
|
|
|
|
|
Show some code where these error occurs.
|
|
|
|
|
CString str = _T("http://www.microsoft.com/india office/beta/thank you.aspx");
HRESULT hRes = CreateShortcutToURL(str.GetBuffer(0),_T("f:\\mssupportthanks.url"));
if (SUCCEEDED(hRes))
{
}
CoUninitialize();
Error is like this.
'CreateShortcutToURL' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
|
|
|
|
|
CreateShortcutToURL takes LPCSTR , not LPCWSTR , which is what you get when you use LPCTSTR with a Unicode build.
What I mean is that you try to call CreateShortcutToURL with a const wchar_t* parameter instead of a const char* parameter, which obviously will fail to compile.
The wide string must be converted to a narrow one before the call.
|
|
|
|
|
as stated by Johann Gerell you cannot pass a wide-string to CreatedShortcutToURL .
However you can change your code as follows
LPCSTR str = "http://www.microsoft.com/india office/beta/thank you.aspx";
HRESULT hRes = CreateShortcutToURL(str,"f:\\mssupportthanks.url");
if (SUCCEEDED(hRes))
{
}
CoUninitialize();
if you are not scared by the _T fundamentalists...
-- modified at 8:57 Friday 22nd December, 2006
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I tried this way also. but iam geeting the same problem
|
|
|
|
|
Sorry, You have to remove _T everywhere in the call.I modified the posted code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
LPCTSTR lpTest = _T("Sample text");
LP_FUNCTION_ACCEPTING_ONLY_LPCSTR pfnFuncA = getFromSomewhere();
#ifdef _UNICODE
int pwLen = _tcslen(lpTest);
CHAR *pch = new CHAR[1 + pwLen];
memset(pch, 0, (1 + pwLen));
WideCharToMultiByte(CP_ACP, 0, lpTest, pwLen, pch, pwLen, NULL, NULL);
pfnFuncA(pch);
delete []pch;
#else
pfnFuncA(lpTest);
#endif
|
|
|
|
|
I have a dialogbox application having Two Edit boxes Node ID and Node Name.
and One browse Button. If i click the Browse button one Tree should open ( Iam calling another Dialogbox with Tree control ).
If i selecte any root item in the tree and double click it The selected node Name should come in the Node Name Edit Box.
Iam Ok till Now.
But I need to fill Node ID Editbox.
If i Doubleclick the Root Node Name , Then Node Id also should Fill
How can i do that ?
That Id sholdnt display in the Tree.
My code For Node Name is like this.
BOOL CTreeItem::OnInitDialog()
{
CDialog::OnInitDialog();
TVINSERTSTRUCT tvInsert;
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = NULL;
tvInsert.item.mask = TVIF_TEXT;
tvInsert.item.pszText = _T("United States");
HTREEITEM hCountry = m_Tree.InsertItem(&tvInsert);
HTREEITEM hPA = m_Tree.InsertItem(TVIF_TEXT,
_T("Pennsylvania"), 0, 0, 0, 0, 0, hCountry, NULL);
// Insert the "Washington" item and assure that it is
// inserted after the "Pennsylvania" item. This override is
// more appropriate for conveniently inserting items with
// images.
HTREEITEM hWA = m_Tree.InsertItem(_T("Washington"),
0, 0, hCountry, hPA);
// We'll add some cities under each of the states.
// The override used here is most appropriate
// for inserting text-only items.
m_Tree.InsertItem(_T("Pittsburgh"), hPA, TVI_SORT);
m_Tree.InsertItem(_T("Harrisburg"), hPA, TVI_SORT);
m_Tree.InsertItem(_T("Altoona"), hPA, TVI_SORT);
m_Tree.InsertItem(_T("Seattle"), hWA, TVI_SORT);
m_Tree.InsertItem(_T("Kalaloch"), hWA, TVI_SORT);
m_Tree.InsertItem(_T("Yakima"), hWA, TVI_SORT);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CTreeItem::OnDblclkTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
HTREEITEM hItem = m_Tree.GetSelectedItem();
BOOL bFlag = m_Tree.ItemHasChildren(hItem);
if (bFlag)
{
m_strNodeName.Empty();
m_Tree.Expand(hItem, TVE_EXPAND);
}
else
{
m_strNodeName = m_Tree.GetItemText(hItem);
OnOK();
}
*pResult = 1;
}
void CTreeItem::OnOK()
{
if(m_strNodeName.IsEmpty())
{
AfxMessageBox("Select Datanode!!!");
}
else
CDialog::OnOK();
}
void CTreeItem::OnNodeSelChanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hItem = m_Tree.GetSelectedItem();
if (m_Tree.ItemHasChildren(hItem))
{
m_strNodeName.Empty();
}
else
{
m_strNodeName = m_Tree.GetItemText(hItem);
}
*pResult = 0;
}
|
|
|
|
|
The code you areshowing is the one where the selected node name is put inside the variable m_strNodeName when you double click. Create another member variable in your CTreeItem class, for instance m_strNodeID, retrieve the ID (I do not exactely know what you mean with "ID", but you must know it) at the same places where the m_strNodeName gets its value.
Then, after your child tree dialog is dismissed, you must have somewhere code in your parent dialog where the content of m_strNodeName is copied inside the Editbox. Simply do the same with your second variable.
Hope this helps.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Thanks Boss, iam trying what u said.
|
|
|
|
|
Hi
Can anyone help me capturing a part of the window as a bitmap? Currently, the code i wrote captures the top-lying windows as well. I dont want it to capture them.
HGDIOBJ prev = SelectObject(memdc, mybitmap);
//Drawing functions.
BitBlt( memdc, 0, 0, w, h, sourcedc, SRCCOPY);
SelectObject(memdc, prev);
Thanks
cheers
rajesh.r
|
|
|
|
|
With GDI, I am honestly not sure you can blit a window if it is hidden behind others (since you do not blit a window but a device). What you can do (if this is not unituitive for the user) is bring the window as topmost, and blit it.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
If you get the device context of an underlying window, shouldn't it output the display of that window?
i.e. if you have the handle to the window you want to bitblt, you should be able to do a GetDC() on that window, then blit from that dc... It should blit what is being displayed on that window, regardless of a window is over top of it. I think.
Where are you getting the sourcedc in the example?
|
|
|
|
|
Greg Daye wrote: It should blit what is being displayed on that window, regardless of a window is over top of it.
Not so. Once it's on the screen it's on the screen. Device contexts obtained for windows
represent the device the window is rendered on (the screen).
|
|
|
|
|
Yeah. Greg is right. Blitting somehow doesn't restrict itself to the lower level window dc. It takes information from the top level window as well. What I felt was, to somehow update the memory dc after the draw operation. I tried sending WM_PRINT message, which I found in msdn said, it updates the dc. This too doesn't help me. Anymore insights or workarounds to do the job?
Thanks
cheers
rajesh.r
|
|
|
|
|
Hello all,
I am facing a problem in replacing a view to display the output.
I have a pieceof code as follows ::
**************************************************************************
///
some print statements;;
...
...
//////
CRuntimeClass *ptr = RUNTIME_CLASS(COutputRichEditView);
pMainFrame->ReplaceView(0,1,ptr,CSize(200,200));
///
again some print statements;;
...
...
//////
CRuntimeClass *ptr = RUNTIME_CLASS(COutputRichEditView);
pMainFrame->ReplaceView(0,1,ptr,CSize(200,200));
***************************************************************************
The above code initially prints a set of statements and displays them to the user. Then it takes some other input from the user.Calculates the values.It again has some print statements. The second set of print statements are to be displayed after the first set. So i need to write the
following 2 lines again.
CRuntime....
pMainFrame....
As soon as i repeat the above statement, access violation occurs.
I tried using following code as well. I defined a class COutputRichEditView1.
CRuntimeClass *ptr = RUNTIME_CLASS(COutputRichEditView1);
pMainFrame->ReplaceView(0,1,ptr,CSize(200,200));
But its not working...
Any help in this context will be useful.
I have already hunted information,but doesn't prove to be useful.
Please help..Its urgent.
Regards,
shraddha
|
|
|
|
|
Shraddha Gautam wrote: i repeat the above statement, access violation occurs
What does debugger says ?
Shraddha Gautam wrote: pMainFrame->ReplaceView(0,1,ptr,CSize(200,200));
what does ReplaceView does ?
|
|
|
|
|
Have you declared you COutputRichEditView with DECLARE_DYNAMIC ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
i want to get a unique sign as the encryption code~
but i doubt there do not have the unique sign to specific the certain Floppy Disk.
who have the idea?
|
|
|
|
|
The best solution I can think of is to use the serial number of the floppy disk. It's meant to be (fairly) unique.
The reason why the "unique" serial numer exists is, AFAIK, the only way for the floppy driver (in the OS) to find out that the diskette has been replaced in the floppy drive, and hence, the directory structure has to be reloded by the driver/OS.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|