|
I have just used your Greek phrase to set my dialog title and it appears correctly (font is MS Sans serif), so I cannot see what is different between your code and mine. Maybe you could show a bit more of your code as there may be a clue that you have missed.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi, thanks for the reply. Here is my code.
WCHAR* chr = L"Επιλογή Εκτυπωτή";
HWND hWnd = ::GetDlgItem(m_hWnd, IDC_BUTTON);
::SetWindowTextW(m_hWnd, chr);
::SetWindowTextW(hWnd, chr);
>> Where m_hWnd is handle to the Dialog and hWnd is handle to the Button.
>> Output
>> Button - "Επιλογή Εκτυπωτή"
>> Dialog's Title - "?p????? ??t?p?t?"
Regards
msr
|
|
|
|
|
That is basically what I did and it worked fine. It would appear that the system is trying to translate the characters to a different font in the title of the dialog bar. I can only suggest rechecking your dialog settings, including verifying that the system is not sending a WM_SETFONT message which is changing it from your original font selection. Other than that I'm a bit lost I'm afraid.
I am often reminded of a sentence in "Programming Windows 3.1" by Charles Petzold where he says (if I remember correctly): "No-one said it has to be to be easy".
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Same happen to me when i tried to load "Chinese" string, But changing locale works for me..
|
|
|
|
|
Hi,
Even I have tried by changing local, but it didn't work for me.
Can you just brief me how did you change your locale. Give me some steps.
Thanks in advance...
Regards
msr
modified on Thursday, October 21, 2010 4:47 AM
|
|
|
|
|
I understand the FILETIME structure and how data is stored.
However I called a Filename's attributes and retrieved the time/date attributed to it.
Then calling FileTimeToLocalFileTime function converts from UTC to LocalTime.
However I'm seeing a weird anomaly, it appeared to occur on the 24 hour conversion.
Time during the day (AM) was missing an hour, but on special folders by located for Windows.
Even files located in the root I created during the day were correctly timed?
|
|
|
|
|
if you have FILETIME structure, then
use this function FileTimeToSystemTime();
in this function pass the SYSTEMTIME as sencond argument.
like this:
FileTimeToSystemTime(&fileTime,&systemTime);
szString.Format (_TEXT("%02d-%02d-%d"),systemTime.wMonth,systemTime.wDay,systemTime.wYear);
Regards,
Srinivas
|
|
|
|
|
You haven't read my problem, maybe took a good look than a glimpse at it!
FileDetails is Structure used in FindFile function.
FILETIME UTCTime = FileDetails.ftCreationTime;
FILETIME LocalTime;
FileTimeToLocalFileTime( &UTCTime, &LocalTime);
SYSTEMTIME HumanReadableForm;
FileTimeToSystemTime(&LocalTime, &HumanReadableForm);
|
|
|
|
|
Fareed Rizkalla wrote: Time during the day (AM) was missing an hour...
This makes no sense. Please explain.
Fareed Rizkalla wrote: Even files located in the root I created during the day were correctly timed?
Are you asking or telling?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I'm telling my problem, and asking for a possible cause!
If you don't have AM/PM in a time format you assumed it's using the 24 hour format.
I was mapping files on my drive, when I suddenly found a deviation between the time listed in Explorer and my output. It seemed to occur randomly and it was related to time during AM and only files related to the OS, not the files which I had created which were also during the same period AM.
Is this clearer?
|
|
|
|
|
Hi all,
I have made a edit control in my application, in that i have selected multiple line option. My problem is if i copy paste some data in that edit control it takes only 1108 lines or approx 28000 characters. Is there any kind of upper limit for edit box.
Thanks in advance
|
|
|
|
|
|
Here is a snippet from the documentation of EM_SETLIMITTEXT.
Before EM_SETLIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters.
|
|
|
|
|
With same code and same AVI file, the intensity value read are different on different machine.
On some machine black area is read as 0 and on some machine it is read as non zero value (viz. 4, 5, 7 etc)
Both the machines uses Main Concept MJPEG codec for reading of AVI files.
Below is code snippet used to open the AVI file
HRESULT hResult = 0;
AVIFileInit() ;
hResult = AVIFileOpen( &m_AviFile, m_strAVIFileName, OF_READ, NULL ) ;
if(hResult != 0)
{
TRACE( _T("AVIFileOpen() Error!!\n") ) ;
}
hResult = AVIFileGetStream(m_AviFile, &m_Stream, streamtypeVIDEO, 0);
if(hResult != 0)
{
TRACE( _T("AVIFileGetStream() Error!!\n"));
}
AVIStreamAddRef(m_Stream );
hResult = AVIStreamInfo(m_Stream, &m_StreamInfo, sizeof(AVISTREAMINFO));
if(hResult != 0)
{
TRACE( _T("AVIStreamInfo() Error!!\n") ) ;
}
m_nEndFrame = (short)((AVIStreamEnd( m_Stream )) - 1) ;
long nLength = AVIStreamLength(m_Stream);
long lSize;
hResult = AVIStreamReadFormat(m_Stream, 0, NULL, &lSize);
m_pBitmapInfoHeader = (BITMAPINFOHEADER*)GlobalAllocPtr(GHND, lSize);
hResult = AVIStreamReadFormat(m_Stream, 0, (LPVOID)m_pBitmapInfoHeader, &lSize);
if(m_pBitmapInfoHeader->biBitCount == 16)
{
m_pBitmapInfoHeader->biBitCount = 24;
}
m_pBitmapInfoHeader->biCompression = BI_RGB;
m_pBitmapInfoHeader->biSizeImage = (DWORD)m_StreamInfo.dwSampleSize;
m_pBitmapInfoHeader->biSize = sizeof(BITMAPINFOHEADER);
m_GetFrame = AVIStreamGetFrameOpen( m_Stream,m_pBitmapInfoHeader);
Below function is used to retrieve the starting address for particular Frame
BYTE* GetFrameAVI(UINT nFrameNumber)
{
return (BYTE*)AVIStreamGetFrame(m_GetFrame,nFrameNumber);
}
Starting address of bit data is calculated as follows
BYTE* GetBitAddress( BYTE* pDIB )
{
TRY
{
if ( pDIB == NULL )
{
return NULL ;
}
WORD wBitCount = ((BITMAPINFOHEADER*)pDIB)->biBitCount ;
DWORD dwNumColors = 0 ;
if ( wBitCount != 24 )
{
dwNumColors = ((BITMAPINFOHEADER*)pDIB)->biClrUsed ;
if ( dwNumColors == 0 )
{
switch ( wBitCount )
{
case 1 :
dwNumColors = 2 ;
break;
case 4 :
dwNumColors = 16 ;
break;
case 8 :
dwNumColors = 256 ;
break;
default:
dwNumColors = 0;
break;
}
}
}
DWORD dwColorTableSize = (dwNumColors * sizeof( RGBQUAD )) ;
DWORD dSize = 0;
dSize = ((BITMAPINFOHEADER*)pDIB)->biSize ;
return ((BYTE*)pDIB + dSize + dwColorTableSize) ;
}
CATCH (CException, pEx)
{
return NULL;
}
END_CATCH
}
What is the possible reasons for intensity being read differently?
(Does it had something to do with the Luminance from HSL?)
In case you need sample application, do let me know, so that I can mail the same.
|
|
|
|
|
Hi,
while using the function LPtoDP i am getting the error "Arithmetic result exceeded 32 bits".
I am not able the find the root cause of the problem. I am using x = 1000 in SetViewportExt and
x = 500 * (some dynamic value) in SetWindowExt. Is it Ok if i reduce x = 100 in SetViewportExt and x = 50 * (some dynamic value) in SetWindowExt.
|
|
|
|
|
ashtwin wrote: Is it Ok if i reduce x = 100 in SetViewportExt and x = 50 * (some dynamic value) in SetWindowExt.
Certainly it is, but that does not necessarily solve your problem; in my own experience LPtoDP works fine.
The first thing you should be doing is to use your debugger to find out why the overflow is occurring and fix that problem. Then you can decide whether you need to reduce or possibly increase some of your parameter values.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Thanks for replying.
Actually this error occured only twice and i am not able to reproduce it.
I have the following traces
Conversion from LPtoDP failed.
>::LPtoDP(dc.GetSafeHdc(), points, noPoints);
noPoints = 2.
ViewportExt.cx: 1000
ViewportExt.cy: 616
ViewportOrg.x: 0
ViewportOrg.y: 0
WindowExt.cx: 500
WindowExt.cy: 1000
WindowOrg.x: 68207250
WindowOrg.y: 0
points[0]: x = 68207250 y = 0
points[1]: x = 68207742 y = 1000.
But i am not able to find out which parameter value is exceeding.
|
|
|
|
|
Your x values do indeed seem rather large, and it may be that when converting to the device co-ordinates you have exceeded the limit of 27 bits. For example if your mapping is 2 device points to 1 logical, then your x value in device co-ordinates will immediately overflow into 28 bits.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi,
You are correct the x value is the root cause of the problem but i can't avoid this value. Is there any way to avoid overflow by doing some changes.
|
|
|
|
|
Simple mathematics would suggest that the only way to improve this situation is to find a way of ensuring that the x-value is within a reasonable range. The rules are the rules I am afraid.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi,
I am trying to enter some messages in the static text box.
But the messages are coming continously.
How can i display the messages to the newline.
Thanks
Raj
|
|
|
|
|
you can use newline '\n' constant in your string where you want to break the string.
Regards,
Srinivas
|
|
|
|
|
I want to use class CMFCPropertyGridProperty to add a button,and when i click the button,it can pop a dialog which
i defined it by myself.
it trobuled me a long time.
when i see the information online,it told me that i can use CMFCPropertyGridProperty::hasbutton method,but it's a protect member,and i am new do this,i really don't know how to do it.
help me...
thanks a lot
|
|
|
|
|
As a minimum you create a new class that inherits from the base class. Then you can override the HasButton method and get it to return true.
Now you will get a small … button when you use this new class for your property. If you look at the MFC source code you will see that you can also override OnButtonClick to detect when the button is clicked.
This is as much as I have found out so far.
|
|
|
|
|
Hello,
this is a bit of a strange question: I have a CTabCtrlEx class
that was passed to me for doing tabbed dialog forms: in substance
it is a class that allows dialogs to be inscribed inside a
tabbed control. It is probably a well known class but I cannot find
the origin of it (maybe Jeff Prosise's, but I don't know for certain).
Hence the question is, do you know any reference to this class in
the literature ?
I attach here the class itself
---- header ----
#if !defined(AFX_TABCTRLEX_H__INCLUDED_)
#define AFX_TABCTRLEX_H__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define TBC_NO_IMAGE -1
class CTabCtrlEx : public CTabCtrl
{
private:
BOOL m_bDeleteItemDlg;
BOOL m_itemRectIsValid;
CRect m_itemDlgRect;
CDialog* m_pLastSelDlg;
public:
CTabCtrlEx(BOOL bDeleteItemDlg = FALSE);
~CTabCtrlEx();
BOOL InitItem(UINT nIDTemplate, CDialog* pDlg, CDialog* pParent);
int AddItem(LPTSTR lpczText, CDialog* pDlg, int nImage = TBC_NO_IMAGE);
int GetItem(CDialog* pDlg);
int GetItem(LPCTSTR lpczText);
CDialog* GetNextItem(int nItem);
BOOL RemoveItem(CDialog* pDlg);
BOOL RemoveItem(LPCTSTR lpczText);
void RemoveAllItems(BOOL bDeleteDlg);
CDialog* GetSelectedItemDlg();
BOOL SetSelectedItemDlg(CDialog* pDlg);
void SetItemDlgRect(LPRECT lprect);
BOOL GetItemDlgRect(LPRECT lprect);
BOOL ShowSelectedItemDlg();
virtual BOOL DestroyWindow();
protected:
afx_msg void OnTcnSelchange(NMHDR *pNMHDR, LRESULT *pResult);
DECLARE_MESSAGE_MAP()
};
#endif // !defined(AFX_TABCTRLEX_H__INCLUDED_)
---- header ----
---- body ----
#include "stdafx.h"
#include "TabCtrlEx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
CTabCtrlEx::CTabCtrlEx(BOOL bDeleteItemDlg )
{
m_bDeleteItemDlg = bDeleteItemDlg;
m_itemRectIsValid = FALSE;
m_pLastSelDlg = NULL;
}
CTabCtrlEx::~CTabCtrlEx()
{
}
BEGIN_MESSAGE_MAP(CTabCtrlEx, CTabCtrl)
ON_NOTIFY_REFLECT(TCN_SELCHANGE, OnTcnSelchange)
END_MESSAGE_MAP()
BOOL CTabCtrlEx::DestroyWindow()
{
if(m_bDeleteItemDlg)
RemoveAllItems(m_bDeleteItemDlg);
return CTabCtrl::DestroyWindow();
}
int CTabCtrlEx::AddItem(LPTSTR lpczText, CDialog* pDlg, int nImage )
{
int nItem = GetItemCount();
TCITEM item;
item.mask = TCIF_TEXT|TCIF_PARAM;
item.pszText = lpczText;
item.lParam = (DWORD) pDlg;
if(nImage != TBC_NO_IMAGE)
{
item.mask |= TCIF_IMAGE;
item.iImage = nImage;
}
return InsertItem(nItem, &item);
}
BOOL CTabCtrlEx::InitItem(UINT nIDTemplate, CDialog* pDlg, CDialog* pParent)
{
if(!pDlg->m_hWnd && !pDlg->Create(nIDTemplate, pParent))
return FALSE;
if(m_itemRectIsValid)
pDlg->SetWindowPos(NULL, m_itemDlgRect.left, m_itemDlgRect.top, m_itemDlgRect.Width(), m_itemDlgRect.Height(),
SWP_NOZORDER|SWP_HIDEWINDOW);
return TRUE;
}
int CTabCtrlEx::GetItem(CDialog* pDlg)
{
TCITEM item;
item.mask = TCIF_PARAM;
int nCount = GetItemCount();
for(int i = 0; i < nCount; i++)
if(CTabCtrl::GetItem(i, &item) && item.lParam == (DWORD) pDlg)
return i;
return -1;
}
int CTabCtrlEx::GetItem(LPCTSTR lpczText)
{
TCHAR czText[MAX_PATH];
TCITEM item;
item.mask = TCIF_TEXT;
item.pszText = czText;
item.cchTextMax = MAX_PATH - 1;
int nCount = GetItemCount();
for(int i = 0; i < nCount; i++)
if(CTabCtrl::GetItem(i, &item) && _tcscmp(item.pszText, lpczText) == 0)
return i;
return -1;
}
CDialog* CTabCtrlEx::GetNextItem(int nItem)
{
int nCount = GetItemCount();
if(nItem >= nCount)
return NULL;
TCITEM item;
item.mask = TCIF_PARAM;
if(!CTabCtrl::GetItem(nItem, &item))
return NULL;
return (CDialog*) item.lParam;
}
BOOL CTabCtrlEx::RemoveItem(CDialog* pDlg)
{
int nItem = GetItem(pDlg);
return nItem >=0 ? CTabCtrl::DeleteItem(nItem) : FALSE;
}
BOOL CTabCtrlEx::RemoveItem(LPCTSTR lpczText)
{
int nItem = GetItem(lpczText);
return nItem >=0 ? CTabCtrl::DeleteItem(nItem) : FALSE;
}
void CTabCtrlEx::RemoveAllItems(BOOL bDeleteDlg)
{
int nItem = 0;
CDialog* pDlg = GetNextItem(nItem);
while(pDlg)
{
CTabCtrl::DeleteItem(nItem);
if(bDeleteDlg)
{
if(m_pLastSelDlg == pDlg)
m_pLastSelDlg = NULL;
pDlg->DestroyWindow();
delete pDlg;
}
pDlg = GetNextItem(nItem);
}
}
CDialog* CTabCtrlEx::GetSelectedItemDlg()
{
int nSel = GetCurSel();
if(nSel == -1)
return NULL;
TCITEM item;
item.mask = TCIF_PARAM;
if(!CTabCtrl::GetItem(nSel, &item))
return NULL;
return (CDialog*) item.lParam;
}
BOOL CTabCtrlEx::SetSelectedItemDlg(CDialog* pDlg)
{
int nItem = GetItem(pDlg);
nItem = SetCurSel(nItem);
return nItem >= 0 ? TRUE : FALSE;
}
BOOL CTabCtrlEx::ShowSelectedItemDlg()
{
CDialog* pCurSelDlg = GetSelectedItemDlg();
if(m_pLastSelDlg == pCurSelDlg)
return TRUE;
if(m_pLastSelDlg)
m_pLastSelDlg->ShowWindow(FALSE);
m_pLastSelDlg = pCurSelDlg;
if(m_pLastSelDlg)
m_pLastSelDlg->ShowWindow(TRUE);
return m_pLastSelDlg != NULL;
}
void CTabCtrlEx::SetItemDlgRect(LPRECT lprect)
{
m_itemDlgRect = lprect;
m_itemRectIsValid = TRUE;
}
BOOL CTabCtrlEx::GetItemDlgRect(LPRECT lprect)
{
if(!lprect || !m_itemRectIsValid)
return FALSE;
lprect->top = m_itemDlgRect.top;
lprect->left = m_itemDlgRect.left;
lprect->bottom = m_itemDlgRect.bottom;
lprect->right = m_itemDlgRect.right;
return TRUE;
};
void CTabCtrlEx::OnTcnSelchange(NMHDR *pNMHDR, LRESULT *pResult)
{
ShowSelectedItemDlg();
*pResult = 0;
}
---- body ----
|
|
|
|