|
Hello guys ,
I have started studying STL and
I am experiencing following problem , here is my source code :
template <class T>
void printVector(const std::vector< T > &integers2);
int _tmain(int argc, _TCHAR* argv[])
{
std::vector< int > integers;
integers.push_back(2);
printVector(integers);
return 0;
}
template < class T >
void printVector(const std::vector< T > &integers2)
{
std::vector< T >::const_iterator constIterator;
for(constIterator = integers2.begin();
constIterator != integers2.end;
constIterator++)
cout<<*constIterator<<' ' ;
}
I am getting 3 errors.
Does anybody have Idea what I am doing wrong ?
PS. I am using Visual Studio 2005
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Giorgi Moniava wrote: constIterator != integers2.end;
replace end with end()
moreover, next time, don't tell how many error you got, this is worthless. give directly the error messages !!! i'm sure here the compiler might tell you with an clear enough message what was wrong...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
-- modified at 10:56 Thursday 8th December, 2005
|
|
|
|
|
|
Giorgi Moniava wrote: thanks tox
you're welcome
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
|
|
|
|
|
Hi,
I am having problems with file locking. It seems some kind of
lock remains on a file even after it has been closed.
I have tried both C-library routines (fopen, fclose ... )
and native windows routines (CreateFile, CloseHandle.. )
but in both cases locking remains, and you can rename the file
only after program has been closed.
Routine where this happens contains some Oracle ProC-code and
seems to start some own threads. Could they be the culprit?
Anybody else have experience with this kind of thing?
|
|
|
|
|
Use the Handle utility from www.sysinternals.com[^] to see what process has the file open.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I want to add the Picturebox into the Form at runtime.
I don't want use Application::Run(Form*), I am creating my own Form.
It is displayed but It doesn't include the Picturebox.
Solution or any Idea.....please send.....
Thank you
|
|
|
|
|
|
Dear friends,
we develop one module. server is broadcasting. client receive this broadcast. Bind() happen properly. socket create properly. It return value properly. At the time of receiving data, client create some problem. problem means entire application hangs. we use while loop. Result shows,
Brodcast done properly. Bind() happen proerly. then what is the reason that entire application hang properly at the time of receiving data.
Result also shows UDP port is proper. TCP/IP port is also proper. UDP port number is 3000. TCP/IP port is 1024.
Everything is properly , then also application hang.
sample code of that function
BOOL CEliteUtilities::ReceiveBroadcastUDP(CString *TargetIP,int *m_port)
{
SOCKADDR_IN addr_Srv, addr_Cli;
char szMessage[256];
int listenport;
int clilen;
int val = 1;
CString csTemp;
AfxSocketInit(NULL);
listenport =3000;
if (listenport < 1)
{
AfxMessageBox("Please enter a valid UDP listen port");
}
//-- Open a UDP socket
if ((sock_Receive = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
AfxMessageBox("Unable to create socket");
return FALSE;
}
//-- Fill in structure fields for binding to local host
//memset((char *) &addr_Srv, 0, sizeof(addr_Srv));
addr_Srv.sin_family = AF_INET;
addr_Srv.sin_addr.s_addr = htonl(INADDR_ANY);
addr_Srv.sin_port = htons(listenport);
int retval=bind(sock_Receive,(SOCKADDR* )&addr_Srv, sizeof(addr_Srv));
if(retval==0)
{
AfxMessageBox("Successfully done");
}
else
{
AfxMessageBox("Failed");
}
memset((char *)&addr_Cli, 0, sizeof(addr_Cli));
clilen = sizeof(addr_Cli);
/*while(1)
{
if(recvfrom(sock_Receive,szMessage,256,0,(sockaddr *)&addr_Cli,&clilen)==SOCKET_ERROR)
{
AfxMessageBox("Error in Receive From");
return false;
}
else
{
char test[5];
itoa(*m_port,test,10);
if(strcmp(szMessage,test)==0)
{
//AfxMessageBox("port detected");
break;
}
}
}*/
closesocket(sock_Receive);
return TRUE;
}
our application hang when debugger comes in while loop.
please give reply of my problem.
Regards
kedar
|
|
|
|
|
Hi everyone,
I want to ask you, is there a way to get the real parent of a service process.
For example an application starts a service and this service appears under "service.exe" in the processes tree like its child process.So is there a way to understand which application indeed has started this service and called "::CreateService".
Thanks in advance!
|
|
|
|
|
The service control manager (SCM) owns the service processes.
An application has only communicated with the SCM to ask it to start a service. The SCM does not track the requestor for CreateService or StartService. The information for CreateService ends up in the registry, as well as for ConfigureService.
You might deduce something from a system if you enable all the auditing. then I think an event log shows up with soem detals about services starting and stopping.
No shirt, no shoes, no brains, no service.
|
|
|
|
|
I use Visual C++ 6.0.
I work on a pC that the screen have 15", When a compile the program and execute it on a PC that the screen have 21",the objects on the screen have not a good position like on 15" screen. All goes to the left corner.
What to do so that, I can have the good presentation independently of screen. In any screen dimension i must have a good design.
I learn my self
|
|
|
|
|
I think you want to display controls at the right locations; well it depends on the screen resolution, which you can get using GetSystemMetrics(SM_CXSCREEN) for width and GetSystemMetrics(SM_CYSCREEN); for height. Then you can position your dialogs and windows using SetWindowPos(...) and MoveWindow(...) .
this is this.
|
|
|
|
|
Dear Sir, my problem is not that,
On my 15" screen I put some objects like Edit Control, Combox,... and on the position I prefer on my view.
And I make "SHOW" screen parameter to "MAXIMISE" on my App aplication so that when i open one view it is maximized.
My problem is the position of all object in the new screen. Why they don't occupy the some position acoording to the new dimension of screen ?
Will I use MOVEWINDOWS for all object on the view ? It is painfull i thing, is it n't?
What to do ?
I learn my self
|
|
|
|
|
mikobi wrote: Will I use MOVEWINDOWS for all object on the view ?
Yes, the only option to avoid that is to use a dialog box that stays the same size (so, that you don't maximize it). Of course it will look 'smaller' on a screen with higher resolution but all controls will be at their right positions. If you search on this website, I know there is an article about a kind of rezisable dialog in which the controls are resized automatically.
|
|
|
|
|
I think that is one of the ways it can be done. Alternatively you could buy one of the ActiveX controls to reposition, or even resize the controls according to the new screen dimensions.
I would suggest you handle the WM_SIZE message, and reposition or even resize some of the controls according to the new dimensions. It could be a little work, but worth it.
this is this.
|
|
|
|
|
PLease help me;
That an example of one CEDIT Control, What codes to write for resize it ?
|
|
|
|
|
It really is not totally about resizing. It is more about repositioning.
Like:
int x, y;<br />
CRect rect;<br />
GetClientRect(&rect);<br />
x = rect.Width();<br />
y = rect.Height();<br />
m_Edit.SetWindowPos(NULL,(x/2)-100, (y/2)-50,0,0,SWP_NOZORDER | SWP_NOSIZE);
It would position the Edit around the center of the dialog. Of course it is not perfect, but shows how it can be done; very simple.
If you need to position a control at the right-side of the dialog, then:
x = rect.Width()-100;
y = rect.Height()-100;
m_Button.SetWindowPos(NULL,x,y,0,0,SWP_NOZORDER | SWP_NOSIZE);
this is this.
|
|
|
|
|
Your right , it is a bout repositionning .
To be very clear ;
When you are in dialog template and you click on a control, you see the position and the size on this control on the bottom panel. for example when i click one my CEDIT control I see its position : 105,20
from there what to do to reposition this control when we change screen dimension ?
|
|
|
|
|
I don't think the control's original position will be useful. You could just drag and drop all the controls on the dialog, and then position them in the OnSize() handler. See my previous post to position a button at the right-bottom corner of the dialog. Just forget the original position of the controls; reposition them where you like them; where they look good. (At runtime)
One important thing is that you must wait for the OnInitDialog() to be called before you reposition the controls, because OnSize() gets called before the controls have been associated with their variables. At the end of OnInitDialog() , you can explicitly send a resize message like: SendMessage(WM_SIZE);
You can keep a class variable like: BOOL m_bInitialized; make it false in the constructor, and make it true in OnInitDialog() . In OnSize() , check if it is true, then do the positioning work.
this is this.
|
|
|
|
|
Hi,
how to add a Tree control as an item in the ListCtrl.
can we add other controls as items in list ctrl.
If ListCtrl cant do this is there any other control which can do this like the GridCtrl or some thing like that???
plese help..
thanks in advance
shibu
-- modified at 23:09 Sunday 11th December, 2005
|
|
|
|
|
Hello!!
I am running an application in a MSCS cluster node. I want to get the name of the virtual cluster name and not the cluster node name. GetComputerName returns the cluster node name (the machine in which the applicaton is run). I want to get the cluster name (virtual cluster server name), or the name of the cluster which is exposed to the outer world.
I created an generic resource through the Cluster Administrator. I chose the option "Use Network Name for Computer Name" in the resource properties. The resource was created and indicated that it was offline. When I brought it online (through a menu option in the context menu) my application executed and picked up the virtual cluster server name and not the cluster node name. This is excatly what is required. But the application takes the virtual cluster server name only when it is run from the cluster admin and when it is executed manually (by double clicking the application) the application again takes the cluster node name.
So bottomline, how to obtain the virtual cluster server name of the cluster just as you get the machine name from GetComputerNaame() when you run the application independently.
Sandeep
|
|
|
|
|
Hi all:
I have an array unsigned char * image which contains my image information. Is there any way to display it on the screen or maybe save it into a file ??? Could somebody give me an answer please??
Thanks very much!!!
Asura
|
|
|
|
|
What do you mean exactly by 'displaying it on the screen' ? You want to just display that like an image or rather have a way to display each byte (just display the value of the byte) ?
|
|
|
|
|
display like an image
Asura
|
|
|
|