|
Something like:
#ifdef _DEBUG
#define LOG(x) {FILE *f = fopen("log.txt","w+");fputs(x);fclose(f);}
#endif Then use it throughout your program as necessary.
|
|
|
|
|
I am new to C++ .Net and I have been told to move away from MFC to .Net. I have read through a few introduction book on .Net & C++ .Net by Microsoft Press, but so far I have yet to see anything in .Net that's similar to Doc/View or SDI/MDI in MFC. I only see .Net Framework Forms which looks like MFC's Dialog. Is there a MFC equivalent in .Net? How would I go about converting MFC to .Net or create Doc/View/SDI/MDI in .Net? If there isn't one why do I keep hearing people saying to move away from MFC and learn .Net. I would also appreciate any book recommendation. Thanks
|
|
|
|
|
Anonymous wrote:
why do I keep hearing people saying to move away from MFC and learn .Net
because some people are convinced that every new Microsoft technology is the answer to all programming problems.
.Net has its place, but as the name implies, that place is on the net, where it is a big improvement over what came before. on the desktop, it's not yet as powerful as MFC - at least what i've seen.
just my opinion, of course. i'm sure others will come by and give you The Truth about .Net, and viciously scold me for my heresy.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
Anonymous wrote:
Is there a MFC equivalent in .Net?
Yes and No.
MFC is still distributed with VC.NET2003 (depending on which edition you get), so MFC is an option, even if all it does is give you access to an improved compiler. As for the alternatives to MFC - Windows Forms is the .NET equivalent. To take a guess, you looked at the code and it looked to simple compared to what MFC provided. Doc/View SDI/MDI are now so simple to achieve that Microsoft don't worry about them in the fashion that they used to - no more wizards, no more chunks of code that are labelled 'DO NOT EDIT'. If you do need to emulate the MFC styles of interface it's not hard at all.
If you need large GUI's are you sure that you need to be writing them in C++? Microsoft now recommend that C# is an acceptable alternative in many cases and it simplifies the coding even further. If you need to access legacy code previously written in C++ you can wrap it in managed extensions or COM objects.
|
|
|
|
|
I looked at the examples in the books, all I see are MFC Dialog type interface. I know if I spend time I can make something look like Doc/View but right now I don't have that luxury to find out how to create one from scratch. Do you know any example that I can look at?
As for C#, I don't know if I have the time to learn another language right now. I am on a tight schedule to get my program working.
|
|
|
|
|
>> If there isn't one why do I keep hearing people saying to move away from MFC and learn .Net.
One of the reason to move away from MFC is that it is not backward compatible between versions. For example, there are lots of changes (documented and non-documented) between MFC 6 (Visual Studio 98) and MFC 7.0 and MFC 7.1 (.NET 2003). So, if you have a large-scaled project, heavily based on MFC 6 and you are planning for migration to .NET 2003 with MFC 7, be prepare for lots of compile-time and run-time surprises.
Serge
|
|
|
|
|
Anonymous wrote:
anything in .Net that's similar to Doc/View or SDI/MDI in MFC.
No, at least not yet. I don't know if this has made it to 2.0.
Anonymous wrote:
any book recommendation
I'm using these 3:
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
those are C# books
I will look into those books when I get a chance to learn C#
|
|
|
|
|
Hi, I´m trying to allocate a memory block with malloc using this code:
pixel = (unsigned int *) malloc (76800 * sizeof(unsigned int)) ;
But the debugger throws an exception, so how do I tell the compiler to use more memory.
Should I use the /HEAP command or do anything else?
Plaese help.
Thanks, Dani
|
|
|
|
|
76800 * 4 isn't really an unreasonable amount of memory - it's only 300K. there should be no reason for it complain.
but, you say "the debugger throws an exception" ? what kind of exception ? and where is it being thrown from ?
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
Well, I did get a exception error exactly when it had executed the malloc , so I made a new project copied all of the source files, and guess what, no exception error.
This is kind of strange for me, but as you say, I should not get any problems with malloc, when allocating this amount of memory.
Anyway problem solved, thanks Chris
|
|
|
|
|
sometimes, the compiler sends strange errors. when it is the case, i rebuild all the project (delete all the .o and the .exe, then recompile all + link).
but if you have an exception, it means that the error occurs at run time...
can you anyway give us the description of that exception (text, error number, things that can actually help us) ???
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I pasted my assignment on the bottom of my post. Basically I know a little bit on how to program but I dont know how to work with the IP addresses as variables. I have the algorithm but i just don't know how I can put it into form. If someone can please help me out with that, i'll really appreciate it. Another thing is I dont know how to do BINARY AND with the input IP address and the subnet mask. It's a really short program.
::Algorithm::
Router forwarding algorithm:
Extract netid from datagram's destination IP address
If (netid is for a directly connected network)
deliver it
Else if (table contains a next hop for netid)
send datagram to next hop
Else if (table contains a default route)
send datagram to default router
Else
error
::::Instructions:::
Write a program that simulates a 5 interface IP router using CIDR addressing.
To simplify the program, assume traffic flows in one direction only - all
traffic will enter port A and will be routed to ports B, C, D or E.
The program should prompt the user to enter an IP address in dotted decimal
notation. Your program should then consult the routing table and display the
input IP address, the next hop IP address in dotted decimal notation, and the
output port. Your program should continue in this manner until the user
decides to quit.
Routing Table
Destination Next Hop Port
128.6.30.0/24 192.200.5.11 B
33.33.32.0/24 192.150.7.21 C
40.33.101.0/24 192.180.45.3 E
50.60.70.0/24 135.200.2.11 D
45.45.4.0/24 192.200.5.11 B
150.7.200.0/22 192.200.5.11 B
130.3.4.0/22 135.200.2.11 D
250.123.192.0/20 192.180.45.3 E
128.235.0.0/16 192.200.5.11 B
30.0.0.0/8 192.150.7.21 C
0.0.0.0/0 192.150.7.21 C
Design Requirements
Your program must convert the input IP address to binary and AND it with the
masks in the routing table. Any other approach will result in points being
taken off.
The information in the routing table should be hard-coded into your program.
You may use any convenient format to represent the information .
There are no specific requirements on the user interface - either a console
application or a graphical interface is acceptable.
I prefer that you use the C, C++, or Java language, but you may propose using
another. You may use any compiler/development environment as long as I am
able to run your program on a PC running Windows XP.
|
|
|
|
|
You can either use strings, or create your own class to contain an IP address.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
You can either use strings, or create your own class to contain an IP address.
Christian
what about the binary part? Can anyone simplify how a routing table works, I've been searching all day for a simple instruction on how they work but I get complicated instructions.
Thanks
|
|
|
|
|
Hi!
Can anybody advise an open-source visual SQL-query builder?
Desired on Visual C++ 6.0
// --- Better -as AX control.
Thanks.
|
|
|
|
|
It May not be the right place to post this question but i think some one can clear things up for me it's concerning mobile apps
- Is it possible to add new fonts for use in sms messages
- how about supporting a large number of characters
- what programming language is used to develop the new font
- or is there a tool kit for doin such kind of stuff
- will the developed font on all mobile equipments
- is it dependent on the os of the mobile
- are there any good web sites concerning these questions ?
- is there some one who is familiar with the large number of chracters that would be supported like a chinese language or so?
|
|
|
|
|
|
Hi folks,
This is probably a very basic question, but I can't figure out a good answer.
I have CFormView-derived class that I display as an MDI child in my app. This works fine. However, under a specific circumstance, I need to display the same form from within a modal dialog, as a modal dialog, so that I can modify the data in the parent dialog after the child terminates.
I can, of course, duplicate the code and create a new dialog to do this. But I am hoping there may be a way I can use the same code as in the form view so that I do not have to maintain two sets of code for the same screen.
Can anyone point me to a way to do this? Or the other way round? That is, have the code in a modal dialog, but access it from a form view?
BTW, I am still
Thank you for your time.
|
|
|
|
|
You'll have to create a new class derived from CDialog . You can of course re-use the dialog resource (IDD_FOO ).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hello.
i'm trying to add an systray icon for my application.
i was able to add the icon to the systray, but when i move the mouse
over the icon, it disapear.
anyone knows why?
|
|
|
|
|
Can we assume you called Shell_NotifyIcon() and are being notified correctly? Have you seen these other examples:
http://www.codeproject.com/shell/StealthDialog.asp
http://www.codeproject.com/shell/ctrayiconposition.asp
http://www.codeproject.com/shell/minimizetotray.asp
http://www.codeproject.com/shell/YaTrayMin.asp
http://www.codeproject.com/shell/siv_trayicon.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks, i'll try these examples (i've tried some of them).
anyhow, i used 'Shell_NotifyIcon()' to get the icon into the systray.
but, i did not recevied notifications!
Code i'm using:
******************************
#define WM_uSYSTRAY_ICON (WM_USER+20)
#define uSYSTRAY_ICON_ID (WM_USER+21)
...
...
m_NID.cbSize = sizeof(NOTIFYICONDATA);
strcpy(m_NID.szTip, "SysTray icon");
m_NID.uCallbackMessage = WM_uSYSTRAY_ICON;
m_NID.hWnd = this->m_hWnd;//this is a MFC created dialog ': public CDialog'
m_NID.uID = uSYSTRAY_ICON_ID;
m_NID.hIcon = (HICON)AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_NID.uFlags = NIF_TIP | NIF_ICON | NIF_MESSAGE;
Shell_NotifyIcon(NIM_ADD, &m_NID);
****************** end of code
any ideas?
|
|
|
|
|
Hi,
how can I play a .wav file (i think its easiest) more slowly or faster. So i want to play a wave-file half-time or something like this.
MFG
RedDragon2k
|
|
|
|
|
I have been trying to get a dialog window displayed big and then small, but the SetWindowPos seems to do nothing since I added resize code.
I have a divider to control the clipping of the lower section of the dialog. See code below (Called via push button to hide/show details)
void CEditDlg::OnBnClickedAdvanced()
{
static bool m_bExpand = false;
if (rcLarge.IsRectNull())
{
GetWindowRect(rcLarge);
CWnd* pWndDivider = GetDlgItem (IDC_DIVIDER);
pWndDivider->GetWindowRect (rcDivider);
rcSmall = rcLarge;
rcSmall.bottom = rcDivider.top;
InitResizerLarge();
}
if(m_bExpand)
{
SetWindowPos(NULL, 0, 0, rcLarge.Width(), rcLarge.Height(), SWP_NOMOVE | SWP_NOZORDER);
m_origSize = CPoint(rcLarge.Width(), rcLarge.Height());
m_bExpand = false;
m_cAdvancedButton.SetWindowText("Hide Details");
}
else
{
SetWindowPos(NULL, 0, 0, rcSmall.Width(), rcSmall.Height(), SWP_NOMOVE | SWP_NOZORDER);
m_origSize = CPoint(rcSmall.Width(), rcSmall.Height());
m_bExpand = true;
m_cAdvancedButton.SetWindowText("More Details");
}
}
ANy way to get this code to toggle between big/small dialog; i.e. clip the window at the divider.
|
|
|
|