|
Basically, you are correct in my opinion. I don't do that myself, however - I often use containers where I allocate on demand (outside the class) and delete in the destructor. But the safest method would be making the Param ctor private, having a factory function in whatever class colSettings is.
Stuff like this often leads to religious wars among developers, but rigid discipline in memory management is indeed one good way to robust code.
|
|
|
|
|
V. wrote:
I think this is very bad code
Good thinking There are so many things [bad] about that code I don't know where to begin. There are several ways it could be changed. Without more context it's difficult to offer direction.
Does Param class have only default ctor or are there any that take parameters? If not why not? Things like that.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I am using Visual Studio.net to develope an do not understand why I am recieving these errors. Please send me an email with explination to suaz4@hotmail.com
Here is my CODE:
<br />
include < stdio.h ><br />
<br />
void main()<br />
{<br />
printf ("Jamsa's C/C++/C# Programmer's Bible!");<br />
}<br />
<br />
Here is my Errors:
first error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
first fatal error LNK1120: 1 unresolved externals
You never know until you try. Try and Try I Shall.
|
|
|
|
|
You should perhaps include something ?
#include "stdafx.h"<br />
<br />
void main()<br />
{ <br />
printf("Jamsa's C/C++/C# Programmer's Bible!\n");<br />
}
And make sure you have selected to create a win32 console application
|
|
|
|
|
I was I just forgot to make it non HTML. I have modified it showing what is included.
You never know until you try. Try and Try I Shall.
|
|
|
|
|
You have selected a project in Visual Studio named 'Win32 Application'. The code you are writing is designed for a project called 'Win32 Console Application'. There is a crucial difference there. Windows applications all have an entry point called WinMain . Console applications (like all C/C++ console applications incl. Unix) have a starting function called Main .
The difference here comes from the design of the application. Windows applications link with a standard set of libraries, which already contain the Main function. All this function does, however, is to start a Windows thread and execute the WinMain function there. But, as the build error states: the linker cannot find the WinMain function from any of your code modules. This means that you're using a wrong project template, considering that you're writing standard C code.
So, in short, there's nothing wrong with your code. You're just using the wrong project type as template. Copy the code, and create a new project by using "Win32 Console Application" as the template. It can be found from 'New Project Wizard' that you use to create projects. Then paste the code in this project, use build and run. Should work without problems.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
WOW thank you for clearing that up for me.
You never know until you try. Try and Try I Shall.
|
|
|
|
|
Two things...
You should add a "#" in front of the include statement
You should check the "Project type" if you are trying to create a "Win32 Application" you need a lot more code than what you have... Try and change it to a "Win32 Console Application" and you should be abe to compile the code (i did)
|
|
|
|
|
Thank you all I do appreciate the prompt response.
You never know until you try. Try and Try I Shall.
|
|
|
|
|
i want to show the document in the textbox same as the word format .Can anyone help me?
|
|
|
|
|
You can't show it in a text- or RTF-box, you'll have to automate Word.
There is a lot of information on MSDN on this, although spread on 1 000 000 articles, and with most samples in VB, so search MSDN for - for example - Word and automation - and be patient
|
|
|
|
|
So total noob question, I've hunted high and low for this but still nothing.
I have a Static control overlayed on top of a Group Box. I'm using the Static control as the title for the Group Box. The Static control is being displayed behing the Group Box. I need it to be on top.
Here's what I've tried in the CDialog::InitDialog()
c_TextSpecifics.SetWindowPos(&wndTop, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
This has no affect. Anyone know how to get the CStatic control on top?
Mike Ellertson
|
|
|
|
|
I assume that you did know one crucial fact: that you can give a caption to the group box by using the dialog editor, and that you can change the caption by using the following code fragment:
CWnd* pGroupBox = (CWnd*) GetDlgItem(IDC_MYGROUPBOX);
pGroupBox->SetWindowText("New group box caption"); This code fragment can be called from CDialog::InitDialog , and will do the job.
If you MUST use a static label control, then the answer here is to use the &wndTopMost parameter for SetWindowPos . However, this means that you must manually change the static control back to non-topmost window whenever it goes behind some other window (your window loses focus).
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
thanks for the response!
Mike Ellertson
|
|
|
|
|
Alter the tab order of the controls within the dialog. The Z-Order of dialog controls is controlled by the tab order.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Thanks much!
Mike Ellertson
|
|
|
|
|
When i press an Escape Key ...during my application dialog is opend. it becomes dissapear.
how can i handle this stupid way of escape key that on press it my dialog not dissappear.
thanx
|
|
|
|
|
Override OnOk and OnCancel functions (to do nothing or if you would like to handle them do not call CDialog::OnOk (OnCancel) in them).
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
i did it ,, but situation is same ,, dialog dissapears on Escape key.
tellme the right way
by example of code line
thanx
|
|
|
|
|
If CTestDialog is ur Dialog class, then add implementation
void CTestDialog::OnCancel()
{
//Remember the function body has nothing
}
the problem was occuring because ur app must have had the implementation below:
void CTestDialog::OnCancel()
{
CTrayDialog::OnCancel();
}
|
|
|
|
|
<br />
void yourclass::OnCancel(){<br />
}<br />
I once had the same problem and I solved it like this.
(try both OnOK and OnCancel maybe)
if this doesn't work I wouldn't know sorry.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
hai,
I am doing a project in voice chat,the problem is that the program works correctly in LAN,but when it is used in net, the sound gets more noisy and there is a loss of some data,there is also some echo .
can any one tell me how to reduce noise and echo in the voice chat over the net.
(there is also some delay of data in the data)
Give some suggestion and solutions to solve the problem.
Thanking u all for reading my question...
M.Kailasam
|
|
|
|
|
increase the compression of the data you send.
|
|
|
|
|
Does anyone know how I can track which window in my app has the focus. Using break points causes the focus to shift to visual studio and I dont want to add an OnSetFocus() method with trace statements everywhere
|
|
|
|
|
Run a Timer function and call GetFocus() from within the timer function.
Bikram Singh
|
|
|
|