|
Are you serious?
1. A double might contain more bits than an unsigned integer. Hence conversion loss.
2. A double can have decimal places, which an unsigned integer lacks. Hence conversion loss.
--
The Blog: Bits and Pieces
|
|
|
|
|
Hi,
your double num1 contains the number of chars you want to read from pFile.
Since you always want to read a whole number of chars, change double num1 to int num1, and your problem is over.
Ronald.
|
|
|
|
|
The answer, quite simply, is that you can not in general convert from double (or float) to unsigned int with no data loss!
Because double is a floating point format, it might contain a fractional part, which will be discarded in any conversion.
And a double might be very large or very small (because it allows powers of 10.)
If the double represents an integer in the range supported by an unsigned int, then no conversion is necessary - it can be stored.
Lastly, if the double represents something like degrees, with resolution of 0.01 degree and range of 0 to 359.99 degree, you could scale the value - multiply the double by 100.0, add 0.1, then store it in the unsigned int with no data loss.
|
|
|
|
|
Well, a 'double' is 8 bytes length and a 'int' is 4 bytes length.
So, i think, it's impossible to do that. What's with your example?
|
|
|
|
|
Hello:
I have an application which has a problem today, the print out was in the format of horizontal flip, i.e each line would be viewed correctly if a mirror is placed on the top of the line.
This kind of problem has never happened before. The printer is Brother HL-1230 Laser Printer. I have tried to work around the Printer Preference Settings in
Duplex Setting - Flip modes and
Page Setting - Mirror/Reverse print
without success as my print out was flipped horrizontally line by line. And the above two settings would flip or mirrow the whole page, and make the print out upside down, i.e. the first line was at the bottom and the last line was at the top.
The printout image could be found here
www.electrajet.com.au/downloads/flip.jpg
The program was written in MFC and c++. In the program, the document was printed line by line with help of CDC::TextOut(...), mapmode is MM_LOMETRIC.
Any advice or suggestions are appreciated.
Thanks in advance.
Ke
|
|
|
|
|
hi!
Please help!
how to put image in right side of item in listcontrol? in my program, its appears in the left side using this code:
LVITEM lvItem;
lvItem.mask = LVIF_TEXT | LVIF_IMAGE ;
lvItem.iItem = nItem;
lvItem.iSubItem = nSubItem;
lvItem.pszText = (LPTSTR)(LPCTSTR) text;
lvItem.cchTextMax = strlen(lvItem.pszText);
lvItem.iImage = nImage;
CListCtrl::SetItem(&lvItem);
|
|
|
|
|
Hi,
Loading application along with the data from folder.
After file is created from the MFC serialization concepts, how we can load the same file from the folder with mouse double click operation. This is similar to load the .doc file in the word with the data.
Please provide the samples or inputs.
Regards,
Girish K R
Girish
|
|
|
|
|
Giirsh1 wrote: After file is created from the MFC serialization concepts, how we can load the same file from the folder with mouse double click operation. This is similar to load the .doc file in the word with the data.
Hope I understood your question...
You have to associate a particular file extension with your application. So that when you double click the file it will be passed as a command line argument to your application. Now you have to parse your command line to find the name of the file and display it's data accordingly.
But first you have to create an association or mapping between a particular file extension and your application.
Just like .doc is associated with winword.exe .
You can create file associations programmatically or through windows explorer or through Registry .
Nibu thomas
Software Developer
|
|
|
|
|
|
Hi All,
Thanks for the Inputs.
I will explain in detail of the requirements.
1. Lets assume that, from VC++ through serialization i will store the data using CArchive class in file (ex. sample.ddd).
2. From the application, i can load back the file with the data using menu options.
3. But same way, what i want is how to open the sample.ddd file from mouse double click or keyboard enter from the folder. This needs to open the application first and then file data needs to open.
Pl. let me know the solution or sample code.
Regards,
Girish K R
|
|
|
|
|
Hi,
Check this
this[^]
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Create registry value for associate editor to file type.
first add subkey to HKEY_CLASSES_ROOT with default value:
[HKEY_CLASSES_ROOT\.ddd]
@="DDDSampleFile"
second add subkey to HKEY_CLASSES_ROOT with default file type description:
[HKEY_CLASSES_ROOT\DDDSampleFile]
@="Sample File of Mine"
you can provide DefaultIcon which displayed by Explorer:
[HKEY_CLASSES_ROOT\DDDSampleFile\DefaultIcon]
@="C:\\windows\\notepad.exe,0"
then tell shell how to open this file:
[HKEY_CLASSES_ROOT\DDDSampleFile\shell]
[HKEY_CLASSES_ROOT\DDDSampleFile\shell\open]
[HKEY_CLASSES_ROOT\DDDSampleFile\shell\open\command]
@="\"C:\\windows\\notepad.exe\" \"%1\""
Of course you can do these actions by RegCreateKey and RegSetValue in your app.
at last ,you can double click the .ddd file in explorer to see the effect.
|
|
|
|
|
Hello
I have a program written in Borland c++. It uses graphics.h to draw some rectangles and lines on console. Can this program run on MS Visual C++.
I tried it but it does not recognize graphic.h
Thank you
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
no way. VC++ dosen't support this class
nave
|
|
|
|
|
long time back, madly i tried to do this, but was in vain.
VuNic
|
|
|
|
|
Aqueel wrote: I tried it but it does not recognize graphic.h
graphics.h is borland properitary header file... which doesn't come with visual studio... now you either have to give up dos programming or stay with borland compiler
|
|
|
|
|
OK i gave up dos programming...
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: i gave up dos programming...
i already given
|
|
|
|
|
Hi,
I'm new to Visual C++ database programing.
I'm using ODBC cursor to connect to an Access database *.mdb file.
retcode = SQLSetStmtAttr(hstmt1, SQL_ATTR_CURSOR_SCROLLABLE,SQLPOINTER)SQL_SCROLLABLE, SQL_IS_INTEGER);
I used the above line of code to make the cursor scrollable to I can do SQLFetchScroll to go backward and forward.
However I got the following error message: Optional feature not implemented.
Please help.
Thank you very much
nhuythanh@gmail.com
nhuythanh@gmail.com
|
|
|
|
|
It probably means access doesn't support scrollable cursors.
|
|
|
|
|
Dear friends,
Do you know how to change the text color in an Edit box m_EdControl?
this->m_EdControl.???;
Thanks and regards,
Joy Anne
|
|
|
|
|
In MFC handle the WM_CTLCOLOR . Use class wizard then add code like the following:
HBRUSH CMFCDialogDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor == CTLCOLOR_EDIT)
{
pDC->SetTextColor(RGB(255,0,0));
}
return hbr;
}
Steve
|
|
|
|
|
//======================== Member variables ===========================//
CFont m_Font;
CEdit m_Eidt;
//====================== Some where ===================================//
m_Edit.Create(WS_VISIBLE|WS_CHILD|WS_BORDER|ES_AUTOHSCROLL,
CRect(100,100,500,150),
this,
8888);
//============================== Set the font of a control ===================//
LOGFONT lf;
//===== Initialize the LOGFONT structure =============//
lf.lfHeight = 0 ;
lf.lfWidth = 0 ;
lf.lfEscapement = 0 ;
lf.lfOrientation = 0 ;
lf.lfWeight = 400 ;
lf.lfItalic = FALSE ;
lf.lfUnderline = 0 ;
lf.lfStrikeOut = 0 ;
lf.lfCharSet = ANSI_CHARSET ;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf.lfQuality = DEFAULT_QUALITY ;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
lstrcpy(lf.lfFaceName, "CommercialScript BT") ;
//============= Set the font of the control ===============//
m_Font.CreateFontIndirect(&lf);
m_Edit.SetFont(&m_Font);
///// The end /////
|
|
|
|
|
The above code change the font in an edit box not color
nave
|
|
|
|
|
Using Visual C++ (6.0) MFC, there is more than one way. If you search for "CEdit background", you will find 17 possible answers (see "Change the Background Color of an MFC Edit Control" ID: Q117778).
At the current time I am studying VB.Net (no choice) and in that you just call "sender.BackColor = color" ("sender" is an object derived control), which probably applies to C# as well (through the framework).
You could derive a class from a CEdit control and override the "OnEraseBkgnd" method, but there should be a better way.
That is the best I can do at the moment.
INTP
Every thing is relative...
|
|
|
|