|
Hi!
I am using the DHTML editing control and I want to add a table so I want to add the code into the html code of the control myself? How can I do it?
Thank you very much for your future answers!
Well... I am a beginner ...
|
|
|
|
|
I/m new to VC++. I developed a program which receives a float value via a dialog box (derived from CDialog). This value is a Fahrenheit temparature. Next it performs some mathematics and successfully finds out Centigrade equivalent (a float again). I want this value displayed on the Windows Client Area. How can I? So far I have used CDC::TextOut(int,int," "); this shows a string message but doesn't show the variable's value. Even type casting hasn't helped.
LOOKING FOR YOUR GUIDANCE
|
|
|
|
|
To convert a float to a string, use
CString str;
str.Format(_T("%f"), (double)MyFloatValue); [edit]If this doesn't work, remove the (double) cast:
CString str;
str.Format(_T("%f"), MyFloatValue); [/edit]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"
|
|
|
|
|
You've mixed types there. %f is for floats, no need for the cast to double . In fact, the code will break because Format() will expect a float value on the stack, but it will see a double and generate an incorrect string.
--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
|
|
|
|
|
Michael Dunn wrote:
%f is for floats
That's what I thought, but because I don't usually use float s, I checked MSDN, and the documentation for printf said %f expected a double. Perhaps the docs are wrong.
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"
|
|
|
|
|
I'm grateful to u Ryan for your help. I hope this is going to work. I'll like to stay in touch with you in future and I'm going to rate your message # 1.
Bye Bye and Thanks again.
|
|
|
|
|
SheheerZahid wrote:
I'm going to rate your message # 1
Ummmm, perhaps you don't realise that 1 is the lowest rating and 5 is the highest
If it doesn't work remove the (double) cast (see Michael Dunn's message above).
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 characters. But if i change the default language of the system to Chinese(PRC) and reboot the machine,the date time picker can show chinese characters.
Thanx in advance
|
|
|
|
|
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.
|
|
|
|
|