|
Oh well, that depends on C being well known. :/
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
why don't you do this:
class A {};
class B: public A {};
class C: public B {};
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
I'm using the CreateProcess to run an application. Here's how I am calling it:
if (CreateProcess(cmd, cmdline,
NULL,
NULL,
TRUE,
0 /*CREATE_NEW_CONSOLE */,
NULL,
NULL,
&si,
&pi) != 0){
My problem is I'm passing in a command line option, but the option is NOT being sent to the application being run. The app runs and Create Process returns correctly, but the app I'm running just doesn't do what I want it to.
I've looked through the MSDN definition, but I haven't found a solution. I've tried everything it suggests, but it still doesn't work, not matter what command line option I put in there. None of them get passed in.
Anyone have any ideas or suggestions? Thanks!
|
|
|
|
|
merge the app string and the commandline string into one, put it instead of your command, set the commandline to NULL.
~RaGE();
|
|
|
|
|
I've already tried that as well. I've tried all the ways that MSDN suggest. When I use that method, I get an error 2, which means "The system cannot find the file specified." or ERROR_FILE_NOT_FOUND. But the file is there, and the path is correct.
I also tried adding the app name to the commandline string and setting the command to NULL, as well as having the command in there as well.
Any other ideas or suggestions?
|
|
|
|
|
Are you _really_ sure no command line is passed ? Already tried to start some dummy batch file with a echo %1 or something like that, that would display the command line ?
~RaGE();
|
|
|
|
|
If you really don't get it to work, but need it to continue coding, use a ShellExecute or WinExec until you have figured it out.
~RaGE();
|
|
|
|
|
Pass NULL for the first parameter inplace of "cmd." Post an example of the command line you pass in as the second parameter "cmdline."
Kuphryn
|
|
|
|
|
hi.
I´m making a easy network application. So I did a new class which inherits from CSocket. Then I overwrite OnConnect and OnReceive, where I´ve written :
<br />
void SurSocket2::OnConnect(int nErrorCode) <br />
{<br />
SurSocket2 s;<br />
<br />
Accept(s);<br />
<br />
CSocket::OnConnect(nErrorCode);<br />
}
void SurSocket2::OnReceive(int nErrorCode) <br />
{<br />
<br />
TCHAR buff[4096];<br />
int nRead;<br />
nRead = Receive(buff, 4096);<br />
<br />
AfxMessageBox(buff);<br />
<br />
<br />
CSocket::OnReceive(nErrorCode);<br />
}
.... Finally, in the main dialog i have:
int nPort = 21010;<br />
<br />
socket.Create( nPort);<br />
<br />
socket.Listen(50);
Why it doesn´t work?
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
SurSocket2 s;
Accept(s); After accepting the incoming connection for s , this variable goes out of scope and consequently its destructor gets called. The observable result from the other side of the connection is immediate termination of the connection.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, if i don´t put nothing in onConnection, it´ll work fine.
but the OnRecive method never is called, Then, i can´t process it.
moreover, the client only can send 5 messages.
|
|
|
|
|
Ummm... you have to call accept anyway, what's wrong with your code is not that, but the fact that the socket you use for accepting goes out of scope before its time has come.
Try dynamically allocating the socket as in
SurSocket2* ps=new SurSocket2;
Accept(*ps); This will probably work, though it generates leaks (no one deletes ps ). It is your job to implement some mechanism to track the accepted sockets and delete them when appropriate.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It doesn´t work too. The client can connect and send the message whitout any error. But when i´m debuging the server , the Onconnect and OnRecive are never called.... The Client application work very well.
|
|
|
|
|
Ok, try issuing ps->AsyncSelect(FD_READ|FD_CLOSE); after accepting.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sory Joaquin. but it doesn´t work too.(Pero sigue sin funcionar)
I can´t understand how can the client connect and send the message(only 5) if the server doesn´t accept the connection request?
Can it be a problem with events and messages in the main windows? should i define a windows partner ?
I´ll continue trying.
Anyway. Thank you very much
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Everything was my mistake. because i had to overwrite OnAccept Method, not the OnConnect method.
I´m very stupid, sorry;P
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
If I put pragma once in all my .h files that is sufficient to prevent any include multile definition problems right? Is this the same thing as doing #ifndef #define #endif that we see in the MFC .h generated files? If so , pragma once is much easier, so why isnt that used by t he Class wizard instead of the ifndef stuff?
Appreciate your help,
ns
|
|
|
|
|
|
As you say, both alternatives are equivalent. #pragma once , on the other hand, is not standard C or C++, so in general I prefer the #ifndef guard. As MS guys usually don't bother about standard compliance, I guess they don't use #pragma once only for historical reasons.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I shall start using pragma since upto now I didnt do any guard at all....leading to dreaded multiple include issues...
Appreciate your help,
ns
|
|
|
|
|
I have VS.NET, and much to my dismay, I found that it does not install on Windows 98. However, I can install remote debugging components. I expect, then, that if a process is running on that machine, and I have the remote debugging components installed, I can connect to it from my Windows XP machine running VS.NET and do some debugging.
But all I get is an error saying that the remote computer cannot be found. I can get to it other ways (ping, Network Neighborhood, etc.) To add insult to injury, I can even browse for it, pick it, and it *still* says it can't be found!
What's going on? How can I debug on 98? All I am doing is straight C++ here, on fancy .NET framework or managed code.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
|
What is the risk?
None, static_cast does not rely on RTTI.
Is there any impact on performance?
Sure, dynamic_cast is more costly.
Should I release a new version with RTTI and dynamic_cast to prevent any potential problems?
Depends on your code. If there's a chance that dynamic_cast can fail (i.e. return 0) and you were using static_cast , then your app is buggy. If not, no need to switch to dynamic_cast anyway
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Hello.
Does MS Access support BatchUpdates?
I have a project in which im using following code but it gives me an error when there is
more than 2 records in the recordset which have been changed
IDispatch error # 3156 :Number of rows with pending changes exceeds the limit.
<br />
_variant_t v(m_pProject->m_ptrConnection.GetInterfacePtr());<br />
<br />
m_pRstBugs->CursorType = adOpenKeyset;<br />
m_pRstBugs->LockType = adLockBatchOptimistic;<br />
m_pRstBugs->Open((LPCTSTR)ProjectName, v,<br />
adOpenKeyset,adLockBatchOptimistic,adCmdTableDirect);<br />
<br />
if (m_pRstBugs->Supports(adIndex) && m_pRstBugs->Supports(adSeek))<br />
{<br />
m_pRstBugs->Index = DBtags::m_sProjectIndexName;<br />
}<br />
<br />
<br />
m_pRstBugs->MoveFirst();<br />
while(!m_pRstBugs->adoEOF)<br />
{<br />
_variant_t x("test");<br />
m_pRstBugs->Fields->Item["description"]->Value = x;<br />
m_pRstBugs->MoveNext();<br />
}<br />
m_pRstBugs->UpdateBatch(adAffectAll);<br />
<br />
|
|
|
|