|
not much difference, the first is class members are by default private, and struct members are public, unless you explicitly change their access level.
http://www.priyank.in/
|
|
|
|
|
Members of a class are by default private whereas members of a struct are by default public. Apart from that, there is not much of a difference.
Usage wise, structs are generally used to represent PODs (Plain Old DataType) whereas classes are used to more complicated datatypes (with constructors/virtual functions...)
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello,
There is no 'real' difference in these types. The only reason that there is a struct in C++ is because it was there in C. It's there for backwards compatability.
As other members stated, the little difference between the two is the default access of members.
I also got the blogging virus..[^]
|
|
|
|
|
There is a lot of difference b/w struct in C and in C++.
The first and the fore most thing is that C++ structure are nearly equivalent to the classes with some exceptions. They are active data structures.
but in C the structures is a grouping data, they are as passive as any other data types;
binding of code and data is not possible in C structures. this makes them to remain passive.
|
|
|
|
|
Anonymous wrote:
There is a lot of difference b/w struct in C and in C++.
I believe that the original quesion was: The differences between "class" and "struct" in C++
I know that you cannot have member functions and such in C, but in C++ you can, either with a struct or a class. There is really no behavioral difference between them in C++
I also got the blogging virus..[^]
|
|
|
|
|
Hi All,
I am trying to specify the output tray (output bin) for specific printer. It is quite easy to specify the input tray but I couldn't find the way to specify the output tray. I can specify the output tray within PCL printer by sending the PrintString (Escape sequence: ESC&l#L)
Is any of the Master/Guru can help me? Thank you in advance
Cheers...
|
|
|
|
|
Anyone??? Master/Guru, please help...
|
|
|
|
|
Hi All,
When I am using CDC::StartPage() and CDC::EndPage() it does NOT honour the setting of "Start Printing Immediately". It means that if I have 10000 pages job, I must wait until it spooled completely before it starts printing to the printer.
I know that StartPagePrinter() and EndPagePrinter(), it does print the page even though the print job is not completely spooled. That means for 10000 pages job, the printer is start printing as soon as the first page is completely spooled.
Is this a bug in CDC::StartPage() and CDC::EndPage()? I do not want to use StartPagePrinter() and EndPagePrinter(). Is there any way around it so I still can use CDC to do an immediate printing?
Thanks for any help in advance
|
|
|
|
|
You also need to do a CDC::StartDoc() which informs the device a new job is starting. Then you do a CDC::StartPage() which informs the device a new page is being printed.
When don, you need to do an CDC::EndPage() for the end of a page and CDC::EndDoc() to inform the device that it has everything.
Take a look at the MSDN CDC::StartDoc documentation. There is an example in there.
Hope this helps.
Larry J. Siddens
|
|
|
|
|
Hi Larry,
Sorry if I wasn't make my question clear. What happen is that the page is start printing when it reaches CDC::EndDoc(). What I want is that the page starting to print as soon as it reaches CDC::EndPage() (NOT CDC::EndDoc()). Therefore if I have 10000pages job, I do NOT want to wait until it completely spooled before it starts printing.
The only way that I know to do this is using StartPagePrinter() and EndPagePrinter(). Of course, I need to get the printer handle by calling OpenPrinter() to get the printer handle, StartDocPrinter() before calling StartPagePrinter() and EndPagePrinter(), and finally EndDocPrinter() to indicate end of print job.
With this way, as soon as it reaches EndPagePrinter(), it will start printing. That means if I have 10000pages job, I can start printing as soon as the first page is completely spooled. (Please note that this will depend of the setting of your printer. Set your printer setting to "Start printing immediately").
Since my application is using a CDC to draw rectangle, etc... I do not want to change my application from using CDC.
Thanks for any help again in advanced...
Cheers
|
|
|
|
|
If I understand you correctly, you have a handle to a printer and want to use the CDC.
Look at CDC::Attach(). This takes the handle (HDC) and attaches it to the CDC so you can use it just like any other CDC. When you get done, you can use the CDC::Detach(). Unless you wish the ~CDC() to close it for you.
Hope this helps.
Larry J. Siddens
|
|
|
|
|
Hi Larry,
(No offence), but you are totally miss-understand my question. My CDC print is working perfectly. The only problem I have is when I need to print, say, 100000pages report (a hundred thousand pages report).
Currently if I wanted to print 100000pages report, I have to wait until 100000pages report to be COMPLETELY spooled before start to print the 1st page.
What I really need when I print 100000pages report is that as soon as the 1st page is spooled, I can print it straight away. So, I do NOT need to wait until 100000th pages is COMPLETELY spooled before printing the first page.
Now, this feature is currently supported by StartPagePrinter() and EndPagePrinter(). Unfortunately, I can’t use these two functions because I need to use CDC to draw text, rectangle, etc…
I know that I am still be able to draw the text, rectangle, etc, by passing the HDC, but it will involve too much modification on the application. Therefore, I must stick with CDC.
Do you know how to do this? Thanks again for any help in advanced
|
|
|
|
|
Friends,
AfxGetAppName() is an MFC function.
What is the API equivalent of this function ?? There is an API GetModuleFileName() but unlike AfxGetAppName() it returns the entire path.
Imtiaz
|
|
|
|
|
Why not split the string ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
char szPath[_MAX_PATH], szBase[_MAX_FNAME], szExt[_MAX_EXT];
GetModuleFileName(NULL, szPath, sizeof(szPath));
_splitpath(szPath, NULL, NULL, szBase, szExt);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
I am going to develop apps for autocadd. I have some ?'s.
Some customers only have AutoCad2004 or above.
I would like to use c# for all dev, but I want my screens to appear like they are part of the Autocad application. Some will be extremely complicated. Speed is an issue also
It must be compatible with 2004 or above. I cannot expect customers to use any energy at all to use my products
With those in mind, what version and should I go for MFC or .NET and, if .NET can it be c# or am I forcerd to use c++.net?
Can you give advice. Obviously I woulkd prefer c# for ease of use.
thanks,
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
What does Autocad expose to allow you to write plug ins ? Is it COM based ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
yes its com based. But I answered my question. Because to modify you must wrap the ADS library so its easier to do MFC.
thanks for helping though
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
If you're targeting AutoCAD 2004, then you'll be forced to use c++. The .NET framework is only supported in AutoCAD 2005 and 2006. Also note, with c++ you'll be forced to use Microsoft Developer Studio 2002, NOT 2003 and AutoCAD itself is based on that version.
If you need more questions answered, please feel free. My company (http://www.cadfx.com) does this all day as we specialize in AutoCAD developement (but not limited to).
--
Joel Lucsy
|
|
|
|
|
I am new in Visual C++. I created MDI application, and I want to disable some menu for certain function. For example, I want to disable menu with ID_MENU00 ID, when doDisableMenu() is invoked
void doDisableMenu() {
CMenu menu;
menu.EnableMenuItem(ID_MENU00, MF_GRAYED);
}
but the result is an error of 'debug assertion failed'
what should I do to disable a menu?
thank you in advance
|
|
|
|
|
It doesn't work that way. When you have a menu item selected in the IDE, there are two messages you can catch. One is the click event, the other is called just before a menu item is shown. You keep a bool in your app to tell you if a menu item is disabled, and in that method, you take the menu item ( which is passed in from memory, as a pointer ), and you set if it's enabled or not using that boolean value. The same goes for check marks, etc. Any change to a menu items state happens in this event handler.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
houari_id wrote:
I want to disable some menu for certain function
The preferred method for this is in the ON_UPDATE_COMMAND_UI() handler.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
WHEN I TRY TO COMPIL, I HAVE THE NEXT MESSAGE
DEBUG WIN32
COMPILING
stdafx.cpp
C:\Program files .....\include\winnt.h(1092) error C2146: Syntax error: missing ';' before identifier 'KSPIN_LOCK'
C:\Program files .....\include\winnt.h(1092) fatal error C1004: unexpected end of file found
im working with winMe and, in some case i try to use direct x (#include <ddraw.h>)
so... help me !!!
|
|
|
|
|
It would help if you gave us the line in question, but the second error usually means that you have precompiled headers turned on, and you've not included stdafx.h
Christian Graus - Microsoft MVP - C++
|
|
|
|