|
markkuk wrote: ...and 666 octal is 101101101 in binary.
Correction. 666 in base 8 is 110110110 in base 2.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I have an SDI app with several views (mostly CFormView), one of which is a CEditView class. From this class I need to add a "centered" heading with a larger font and set a decent margin to print only text.
I would like some help understanding how to use OnPreparePrinting, OnBeginPrinting, and OnEndPrinting functions that are already in my edit class. I know there are a few classes for printing but if I don't understand how it all works, they are of little value to me.
Another problem is that the book stores in my area have mostly .NET stuff and I'm using VC++ 6.0.
Thanks!
Mark
|
|
|
|
|
Printing in an MFC app is supposed to be just like drawing on the screen. The On...Printing functions are there to help you in the places that drawing during printing is different. The main difference is that, when printing, you probably want to keep track of pages. For example, if you're printing text, you wouldn't want to print the top half of a line on one page, and the bottom half on the next.
If your view class is derived from CEditView, you might look to see if CEditView has any printing support built-in.
Software Zen: delete this;
|
|
|
|
|
I've got two structs that I want to be able to typecast to one another, so I have something like this:
struct S1
{
S1( const S2 &s2 ) { a = s2.b }
float a;
};
struct S2
{
S2( const S1 &s1 ) { b = s1.a }
float b;
}; But each struct needs to know about the other, so I can't get this to compile. Is there a way to tell each class the other exists or some other way to get around this?
- Steve
|
|
|
|
|
use a "forward declaration" of S2 prior to defining S1:
struct S2;
struct S1
{
//
};
struct S2
{
//
};
http://www.catch22.net
|
|
|
|
|
Hi,
I have a CFormView-based SDI project in which I need to programmatically create & update an array of buttons in a view window. It seems that a CFormView would be the best class to use for this window, but I can't seem to create the window. What type of parent should the window have? I need to create it in the app's main CFormView window. Can that be done? Can anyone point me to a sample project?
Thanks,
Royce
|
|
|
|
|
A CFormView is basically a modeless dialog. It's nothing special really. What window fails to create? The buttons, or the CFormView?
--
Pictures[^] from my Japan trip.
|
|
|
|
|
The CFromView fails to create a window when the class ctor is called.
|
|
|
|
|
You cannot create child controls in the constructor, because the window is not created yet. You see, the CFormView object is nothing but a wrapper around a HWND (window handle). You will have much better luck if you create the child controls in OnInitialUpdate() (that is a virtual method which you can override, and is found in the classwizard).
All MFC window/control* classes are only wrappers around window handles, they are not windows themselves. They merely present a C++-friendly interface (some may disagree with this) to the messaging protocols which the window supports.
--
Pictures[^] from my Japan trip.
-- modified at 8:56 Sunday 4th December, 2005
|
|
|
|
|
Jörgen Sigvardsson wrote: They merely present a C++-friendly interface (some may disagree with this)
Aw, don't spoil his fun, Jörgen .
Software Zen: delete this;
|
|
|
|
|
Yes, I understand all that. It is the creation of the CFormview window that I am having trouble with. How and when do I create it? Must it be a child of a CFrameWnd? Can it be a child of another CFormView?
|
|
|
|
|
Hi, everyone!
My current project is an application to control the 3-axis table for the optical microscope. The each stepping motor can be controlled by the serial communication port using the ASCII text format.
Now, I would like to know which COM port is connected or not.
Is there any method to list the connected USB or COM port?
BaySeagull
|
|
|
|
|
Hi all:
I am writing a program which is a opengl like library. Finally I need to generate a bmp file to display the result. Does anybody know how to make a bmp file from c++ please???
Thanks a lot
Asura
|
|
|
|
|
Well, I guess a lot of examples you can get through the internet.
Anyway, the followings are my humble example.
<br />
<br />
BITMAPFILEHEADER bfh;<br />
BITMAPINFOHEADER bih;<br />
char* pBuffer;
<br />
<br />
bfh.bfType = ((WORD) ('M' << 8) | 'B');; <br />
bfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + lBuffer; <br />
bfh.bfReserved1 = 0; <br />
bfh.bfReserved2 = 0; <br />
bfh.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); <br />
<br />
bih.biSize = sizeof(BITMAPINFOHEADER);<br />
bih.biWidth = pvih->bmiHeader.biWidth;<br />
bih.biHeight = pvih->bmiHeader.biHeight;<br />
bih.biPlanes = pvih->bmiHeader.biPlanes;<br />
bih.biBitCount = pvih->bmiHeader.biBitCount;<br />
bih.biCompression = BI_RGB;<br />
bih.biSizeImage = 0; <br />
bih.biXPelsPerMeter = 0;<br />
bih.biYPelsPerMeter = 0;<br />
bih.biClrUsed = 0;<br />
bih.biClrImportant = 0;<br />
<br />
CFileDialog dlg(FALSE, _T("bmp"), NULL,<br />
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,<br />
"BMP (*.bmp)|*.bmp|All Files (*.*)|*.*||");<br />
<br />
if(dlg.DoModal()==IDOK)<br />
{<br />
CFile file(dlg.GetPathName(), CFile::modeCreate|CFile::modeWrite);<br />
file.Write(&bfh, sizeof(BITMAPFILEHEADER));<br />
file.Write(&bih, sizeof(BITMAPINFOHEADER));<br />
file.Write(pBuffer, lBuffer);<br />
file.Close();<br />
} <br />
BaySeagull
|
|
|
|
|
Hai,
Please tell me that how to save a picture from client enviornment(CFormView) as Bitmap.
regards,
Jeeva
|
|
|
|
|
Hi, suprise! BN_DOUBLECLICKED wouldn't work! I want a button when single click do one thing, and when double clicked do another thing. but it never hit OnButtonDoubleclicked().
I search on Web, some one said, should change the button style to BS_NOTIFY, then I did check this style on property page. It made no difference.
Any one can help?
Thank you in advance.
|
|
|
|
|
|
Yes I went there before. I don't like the way to check double click. and I tried to check Notify option in property page, OnDoulbleClick() still could not be called. I still think there should be a better to do it. otherwise Wizzard should remove DoubleClicked notification from CButton.
MSDN says BS_USERBUTTON can get BN_DOUBLECLICKED notification. how to create BS_USERBUTTON?
|
|
|
|
|
Did you select Notify in Puch Button Properties - Styles dialog box?
|
|
|
|
|
Try to subclass the button and handle the double click
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I am converting an appln to unicode.
I use the code as follows
HtmlHelp(pWnd->GetSafeHwnd(), strHelpPath+="::/Popuptext.txt",
HH_DISPLAY_TEXT_POPUP, (DWORD)&popup);
but it throws up the following error
ExportDlg.obj : error LNK2001: unresolved external symbol _HtmlHelpW@16
ImportDlg.obj : error LNK2001: unresolved external symbol _HtmlHelpW@16
ReleaseUMinSize/ImportExport.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
when i include HtmlHelp.lib it says
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
i have the htmlhelp.lib in current directory
what do i need to remove this error??
thanx in advance
|
|
|
|
|
actually u r linking with incompatible libraries for example
if you compiled one file to use one kind of run-time library and another file to use another kind (for example, single-threaded versus multithreaded) and tried to link them, you’ll get this warning.
You should compile all source files to use the same run-time library.
-- modified at 0:51 Saturday 3rd December, 2005
|
|
|
|
|
how to display a transparent gif picture
|
|
|
|
|
Can a C++ DLL developed with Microsoft Visual Studio .NET 2003 be used by Delphi, Borland C++ and other object-oriented languages? I am hoping to write a C++ DLL with ADO and CAsynSocket capability wrapped in some classes. Would there be any problem with Delphi, VB.NET, Borland C++ etc., e.g. name mangling due to different compiler vendors, if I export the classes in the C++ DLL? Can the Delphi, VB.NET, Borland C++ access and those exported classes? Thanks.
|
|
|
|
|
If you want cross platform/language, without giving into .NET, I advise you to go the COM route, as that's the only common denominator between the languages you mention (AFAIK).
--
Pictures[^] from my Japan trip.
|
|
|
|