|
Ya.. previously I didnt set the font to "Lucida san Unicode" After i set that too the text came as you said
But I dont understand what wrong with your settings... I started a dialog based application a put the below code in the oninitdialog function
wchar_t str[10];<br />
str[0]=0x41;<br />
str[1]=0x42;<br />
str[2]=0x284;<br />
str[3]=0x44;<br />
str[4]=0x45;<br />
str[5]=0x46;<br />
str[6]=0x47;<br />
str[7]=0x48;<br />
str[8]=0x49;<br />
str[9]=0x00;<br />
CClientDC dc(this);<br />
LOGFONT lf;<br />
memset(&lf, 0, sizeof(lf)); <br />
lf.lfHeight = MulDiv(12, ::GetDeviceCaps(dc.m_hDC, LOGPIXELSY), 72);<br />
lf.lfWeight = FW_NORMAL;<br />
lf.lfOutPrecision = OUT_TT_ONLY_PRECIS;<br />
_tcscpy(lf.lfFaceName, _T("Lucida Sans Unicode")); <br />
static CFont m_font;<br />
m_font.CreateFontIndirect(&lf);<br />
HWND hEdit = CreateWindowExW( 0, L"Edit", str, WS_CHILD|WS_VISIBLE|WS_BORDER, 0,0, 300,50, m_hWnd, 0, AfxGetInstanceHandle(), 0 );<br />
::SendMessage( hEdit, WM_SETFONT, (WPARAM)m_font.m_hObject, (LPARAM)TRUE );
|
|
|
|
|
Hi Naveen,
It's working fine in my app too. Thanks a lot.
For setting the font to EditBox I was trying :
SelectObject(::GetDC(hEdit),m_font.m_hObject);
But after using your code. My application was displaying that char.
::SendMessage( hEdit, WM_SETFONT, (WPARAM)m_font.m_hObject, (LPARAM)TRUE );
again thanks a lot. And keep up good work....
Regards,
Nilesh.
|
|
|
|
|
Hi Naveen,
Just a question?
Is it possible to do the same with EditBox created by resource file?
Regards,
Nilesh.
|
|
|
|
|
nilesh.gawade wrote: Is it possible to do the same with EditBox created by resource file?
Sorry that I dont know.
|
|
|
|
|
Hi,
I am able to display the unicode string in EditBox only after creating the EditBox using CreateWindowExW() API.
Now I want to display the same string in EditBox Created using Resource Editor.
May be While creating EditBox through rc file. It might call API in following sequence.
CEdit::Create() => CWnd::Create() => CWnd::CreateWindow() => ::CreateWindow() or ::CreateWindowEx()
Can we modify this flow so that ultimately last call will be ::CreateWindowW() or ::CreateWindowExW()?
Plz Help...
__________________
Regards,
Nilesh Gawade
|
|
|
|
|
nilesh.gawade wrote: CEdit::Create() => CWnd::Create() => CWnd::CreateWindow() => ::CreateWindow() or ::CreateWindowEx()
No this is not correct. The dialog is created using the createdialog() API. inside this api it creats all the controls inside it internally. So the creation of edit control using ::CreateWindow() is done inside the createdialog itself. and it doesnt call the CWnd::Create() at all. After creating all the controls, it subclasses each control if you have made a control variable for it. For this purpose it uses the SubClassWindow() function. So thats how your edit control becomes an object of CEdit.
|
|
|
|
|
nilesh.gawade wrote: Can we modify this flow so that ultimately last call will be ::CreateWindowW() or ::CreateWindowExW()?
Some thing that you can do is create the dialog by your self using the CreateDialogW() function.
|
|
|
|
|
Hi Nave,
Thanks buddy.
I will work on the same.
Regards,
Nilesh.
|
|
|
|
|
For a runtime error to my IVRS application , i found a solution as 'increase the application buffer allocated by the OS' in the internet. I want to know whether there is a way to increase the buffer size of the application?
Thank you
KIRAN PINJARLA
|
|
|
|
|
What buffer are you referring to? Stack space, perhaps?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes.I thing so. I was told that for every application running, a defult memory is allocated by the os. Is it like that?
KIRAN PINJARLA
|
|
|
|
|
The default stack size for a VS6 application is 1MB. I'm not sure if that has been changed in VS200x.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks everybody, but I solved it by doing ... nothing. After a while staring at the code, I hit ... Rebuild, and it worked like a charm. Ahhh VC++6 and templates Sorry for the hassle, thanks again for your answers.
-> Orignial post:
Here is my code:
for(int i=0;i<3;i++)
{
BYTE *pbMessage= new BYTE[12];
st.push(pbMessage);
}
BYTE *pbTest;
while(st.getSize()>0)
{
pbTest=st.pop();
printf("%s\n",pbTest);
delete[] pbTest;
st is a sort of stack (which works). The push function saves the pointer, the pop function returns the pointer. How can I make the compiler understand that the pbTest points on 12 elements ?
BYTE pbTest[12];
pbTest=st.pop();
Note that delete pbTest does not work either in the first example.
Thanks,
-- modified at 9:55 Tuesday 16th October, 2007
~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
|
|
|
|
|
pbTest is allocated as a BYTE *pbTest (not an array) so why would you free it using delete[] pbTest
|
|
|
|
|
toxcct wrote: ...why would you free it using delete[] pbTest
Because it points to an array?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
isn't delete[] useful only when the memory is allocated with new[] and simple delete useful when simple new used ?
|
|
|
|
|
toxcct wrote: isn't delete[] useful only when the memory is allocated with new[]
Yes, and that's what he has here:
BYTE *pbMessage= new BYTE[12];
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Rage wrote: Note that delete pbTest does not work either in the first example.
Is it throwing exception right from the first element in the loop while deleting? Are you sure pop is working correctly?
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
How is your "sort of stack" declared? Template argument, if any, and push/pop functions...
I wonder since the stack::pop() function of the usual STL stack is declared as void pop() , so you must be using something else. The equivalent function in the STL stack would be <YourType>& top() .
If your pop() works like you think it should work, I can't see why you would get the exception...
But perhaps it's still too early in the morning for me...
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello again,
If that's one of my stacks you're adapting the chances are it takes the address of what you pass to it, so it would actually be storing a BYTE** in this case, requiring you to dereference the result of pop back to a BYTE* with something like BYTE* pData = *pPopResult . You definitely need to check this if you adapted one of my data structures. I tend to make containers store the addresses of contained items to avoid copying.
Remember BYTE[15] and BYTE* are the same type so delete [] pbTest is correct if pbTest is BYTE*. If it's BYTE** then it will be trying to delete an array of 4 byte BYTE* pointers hence the exception.
If the stack comes from elsewhere then feel free to ignore all this rambling.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks, but I only took a few ideas from your article, and the implementation is indeed different here.
~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
|
|
|
|
|
Yes you must check them else you have trouble code.
|
|
|
|
|
Ok, thanks.
I appreciate your help all the time...
Eranga
|
|
|
|
|
|
now that i am displaying the designators in a combo box. i used recursive function to display that in the combo box. the next thing that i need to do is when i click on the designator the files and folders in that designator should display in a list box. what needs to be done for that?
chandru080
|
|
|
|