|
You need to change the dialog font to MS Shell Dlg, instead of MS Sans Serif which is the font generated by the resource editor. MS Sans Serif doesn't display double-byte characters. In VC 6 you need to open the .rc file as plain text and change the font. No idea how to do it in VC 7.
--Mike--
"I'm working really, really fast at the moment, so a 3 minute outage becomes, due to time dilation, a 5 minute outage."
-- Chris Manuder, relativistic system administrator
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Hi,
Thanks for your suggestion.I use Arial 9 for my dialog.I tried changing the font to ms shell dlg.but this doesn't serve the purpose.Can you tell me how this is done in IE and other microsoft applications
|
|
|
|
|
Using MS Shell Dlg makes the OS use the "Default dialog font", which differs among languages. Setting it to Arial only works if the version of Arial you have on your system contains the DBCS characters. If you get only ||||| then the font doesn't have them.
As a last resort you can always set the font of just the control to SimSun or whatever font you want that can show DBCS chars.
--Mike--
"I'm working really, really fast at the moment, so a 3 minute outage becomes, due to time dilation, a 5 minute outage."
-- Chris Manuder, relativistic system administrator
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Hi guys,
This is a question on Load Icon in VC 6.
I am giving the code snippet.
This code I have put in OnDraw() function
HICON hicon1;
CDC WordkDC;
HINSTANCE instance;
WorkDC.CreateCompatibleDC(pDC);
instance=AfxGetInstanceHandle();
hicon1=::LoadIcon(instance,MAKEINTRESOURCE(IDI_ICON3));
WorkDC.DrawIcon(100,200,hicon1);
pDC->BitBlt(0,0,1012,668,&WorkDC,0,0,SRCCOPY);
AfxMessageBox("In ondraw if condition");
I am seeing only the MessageBox but not the icon why ??
Instead of the WorkDC if I use pDC I could see the icon.
Can anybody tell what's wrong with my code.
Thanks
Satya
|
|
|
|
|
WorkDC is a memory device context - it's not associated with a display device. In order to be able to draw anything in it, it has to be associated with a bitmap for it to draw on. Using pDC works because the device context has somewhere to draw - the screen. To make this section of code work, you'll have to create a bitmap for it:
HICON hicon1;
CDC WordkDC;
HINSTANCE instance;
CBitmap bitmap;
CBitmap *pBitmap;
WorkDC.CreateCompatibleDC(pDC);
bitmap.CreateCompatibleBitmap(pDC, 1012, 668);
pBitmap = WorkDC.SelectObject(&bitmap);
instance=AfxGetInstanceHandle();
hicon1=::LoadIcon(instance,MAKEINTRESOURCE(IDI_ICON3));
WorkDC.DrawIcon(100,200,hicon1);
pDC->BitBlt(0,0,1012,668,&WorkDC,0,0,SRCCOPY);
WorkDC.SelectObject(pBitmap);
bitmap.DeleteObject();
AfxMessageBox("In ondraw if condition"); Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks Ryan,
It's working
Satya 
|
|
|
|
|
You're welcome
BTW, instead of hardcoding the width/height of the bitmap, you might want to use GetClientRect() to get the dimensions of the client area, and specifiy the height and width from that instead.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I'm using dtpcustom to specify my own format od date and time display.(yyyy-mm-dd':'dddd)
English (US) is set as default language of my system.when the locale is set to English(US) the date time picker can show the dddd part as "saturday" in english correctly.when i change the locale to Chinese(PRC),some junk characters are displayed instead of displaying "saturday" in chinese.
|
|
|
|
|
Hi!~
The problem is:
in VC++, I created a dialog using the dialog editor, and add a CEdit to it.
From the main program, I want to call and DoModal() this dialog. Before I DoModal it, I want to hide the CEdit control. I am doing it like this:
dlg.m_cedit_control.ShowWindow(SW_HIDE);
if (dlg.DoModal()==IDOK)
{
......
};
However, the debug assert at the above ShowWIndow line.
Any one know by which way I can get what I want?
Thanks a lot and have a nice day.
(Actually, the dialog is created for multi purposes. So sometimes, before it is shown, I want to display the CEdit to the user so that user can input. But sometimes, I want to hide it.)
|
|
|
|
|
You can't call ShowWindow() until the edit control is created, ie. until DoModal() is called. Set a flag in the dialog box, and then show/hide the window in OnInitDialog() in the dialog:
dlg.m_bShowEditControl = FALSE;
dlg.DoModal();
...
CMyDialog::OnInitDialog()
{
...
if(!m_bShowEditControl)
m_cedit_control.ShowWindow(SW_HIDE);
...
} Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I created an MFC Extension DLL that when calls checks a file, and condictionally displays a dialog box and quits. It compiled fine.
But
When I went to create a sample app, I added the lib to the project and included the header file from the MFC Extension DLL.. Called teh function:
CPluginMessage mPIM;
mPIM.CheckForInformation("asdf.exe","ASDF","None");
But when I compile the app it throws a fit and says:
--------------------Configuration: asdf - Win32 Release--------------------
Compiling...
asdfDlg.cpp
Linking...
asdfDlg.obj : error LNK2001: unresolved external symbol "public: int __thiscall CPluginMessage::CheckForInformation(class CString,class CString,class CString)" (?CheckForInformation@CPluginMessage@@QAEHVCString@@00@Z)
asdfDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall CPluginMessage::CPluginMessage(class CWnd *)" (??0CPluginMessage@@QAE@PAVCWnd@@@Z)
Release/asdf.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
asdf.exe - 3 error(s), 0 warning(s)
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Compile the DLL using multithreaded DLL linking.
Kuphryn
|
|
|
|
|
Where under Project Settings would I find that? I looked but couldn't find it.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Nevermind, I saw where Multithreaded DLL linking was, but thats how its been compiled, and the sample app still puts out the error message (its a new MFC Dialog app (its nothing wrong with the rest of the program).
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Did you add the AFX_EXT_CLASS macro to the class declaration in your MFC Extension DLL code?
<code>
class AFX_EXT_CLASS CPluginMessage
{
CPluginMessage();
~CPluginMessage();
}
</code>
Kelly Herald
Software Developer
MPC
|
|
|
|
|
Hiya I am having a serious problems with this. I have to read in records from a file that are formatted like this example:
"don't,need,this,\r23,this_record_could_be_any_size_1k_or_100k,\r45,don't,need,this,either,\r23,this_record_could_be_any_size_1k_or_100k,\45,don't,need,this,either....and so on.
The start of each record is \r23 and each record ends with \r45...
My problem is that I am using MFC function 'file.Read' to read in a certain amount of data, 1kb. But what if my record was longer than 1k, I would have serious problems.
What I would like to do is read in a certain amount of the data, find the start of the record i.e \r23, set the file pointer to that position and read the file until I find the end of the record i.e \r45.
And then position the file pointer to start looking for the next record.
But I can't get it to work for me at all.
Could someone help me on this plz..very urgent.
Thanks.
|
|
|
|
|
I did something almost exactly like this once except my data was not as variable. The format was:
WORD (record id)<br />
WORD (index)<br />
unlimited number of characters up to a \0 character<br />
WORD (record id)<br />
WORD (index)<br />
unlimited number of characters up to a \0 character<br />
WORD (record id)<br />
WORD (index)<br />
unlimited number of characters up to a \0 character<br />
...
So when the file pointer was at the beginning of the characters, I read something like 2,000 characters knowing that I would find the \0 character 99.99% of the time. Taking the difference between the two file positions, I knew the length of the data. I did all this via a memory-mapped file so it was very fast.
|
|
|
|
|
Hiya, yes thats exactly what I did e.g
file.Read( buffer,2000 );
But thats my problem. I don't actually know the maximum the record could be. It could be 2k or 200k.
I don't know how to read in a file, searching for a specific string??
Or if I can't do it that way, how could I read in the string and keep checking it for the end of record.
Does anyone know??
|
|
|
|
|
Given the variableness of the data, it doesn't appear that CString::Find() will be of any benefit to you. However, you can still use a memory-mapped file so that you only have to access the disk once.
CFile file;
LPBYTE lpBuffer;
CMemFile fileMem;
if (file.Open(...) == TRUE)
{
lpBuffer = new BYTE[file.GetLength()];
file.Read(lpBuffer, file.GetLength());
file.Close();
fileMem.Attach(lpBuffer, file.GetLength());
...
fileMem.Detach();
delete [] lpBuffer;
}
|
|
|
|
|
Hi,
What messages do I need to use (if this is the way) to set the position and size of dialog controls if I am not using MFC.
Thanks in advance
Zak
|
|
|
|
|
SetWindowPos() and/or MoveWindow()
--Mike--
"I'm working really, really fast at the moment, so a 3 minute outage becomes, due to time dilation, a 5 minute outage."
-- Chris Manuder, relativistic system administrator
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Suppose I have a dll containing the implementation of a logging tool.
I also have another dll containing the implementation of an exception class.
Now, I would like any external object INCLUDING an instance of the logging tool to be to throw exceptions using my excpetion class.
I also want the Exception class to log every exception thrown into a log file.
So, the dilemma is two dlls that depened on each other.
Obviously, there are many hackish way of getting around this, but is there a standard and eloquent way of dealing with a situation like this?
|
|
|
|
|
I am in desperate need of being able to increase the height of my statusbar in an Doc/View MFC application. I need to owner draw the whole thing as well, but I don't think that is much of a problem. I tried looking into code like CSizingControlBar but I wasn't able to figure out what is relevant and what is not as it is extremely complicated. I would have never thought that something that should be as trivial as resizing a statusbar would be so difficult.
Cheers,
Clint
|
|
|
|
|
m_wndStatusBar.GetStatusBarCtrl().SetMinHeight(nMinimumHeight) in CMainFrame::OnCreate() after the status bar has been created.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
How can I set the key states that GetAsyncKeyState() returns?
SetKeyboardState only sets the ones that the other keyboard functions return, but GetAsyncKeyState() is global it seems.
|
|
|
|
|