|
if i want to get connected with server what r the minimum requirment.Other then port number what should i need.From where to start....
|
|
|
|
|
This is such an open-ended question it's hard to know what to do with it. What protocol do you want to use? What sort of server?
The only link I can give you is the Winsock Programmer's FAQ[^], which might help a little.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
You can connect to a remote machine (e.g., server) with a UNC path. Since you give no supporting information, a more detailed answer is not possible.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
I have a problem with more than one graph creation.
I added an element:
<br />
m_Graph.AddElement();<br />
than I wrote this line
<br />
m_Graph.PlotXY( i , pointsArray[i] ,arrIndex);<br />
the arrIndex=1
But it says that the element not found!
Here is a link to the article:
http://www.codeproject.com/miscctrl/ntgraph_activex.asp[^]
SnaidiS(Semion)
-- modified at 6:46 Sunday 16th July, 2006
|
|
|
|
|
please, I need some help
SnaidiS(Semion)
|
|
|
|
|
why nobody helps me?
SnaidiS(Semion)
|
|
|
|
|
Hi,
I've got a BITMAP object that i want to save on the disc.
Does anybody know how it can be done?
Cheers in advance.
|
|
|
|
|
if you have a bitmap handle you can Attach this handle to CImage class and use from Save
whitesky
|
|
|
|
|
A versatile approach for images would be to use the GDI+ Image class (or it's derived types Bitmap, Metafile) for all your imaging needs.
Image::Save will save bitmaps to IStream or file.
|
|
|
|
|
|
See the example here and here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi everybody!
I'm making a routing algo simulator using MFC and GDI+.
I have created three function that are the three steps the algo does: ElectCluster(); FindMember(); StartSteadyState();.
Now the StartSteadyState() creates a thread for each node of the network that has been elected Cluster head (p->ch).
<br />
void CSimDlg::StartSteadyState(void)<br />
[...].br />
for (int i=0; i<m_vecNodes.size(); i++)<br />
{<br />
NODE* p = m_vecNodes[i];<br />
<br />
if(p->ch)<br />
{<br />
ThreadParam* pParam = new ThreadParam;<br />
pParam->m_pDialog = this;<br />
pParam->m_nNodeIndex = i;<br />
_beginthread(StaticTx, 0, (void*)pParam);<br />
counter++;<br />
}<br />
}<br />
[...].
and:
void CSimDlg::StaticTx(void * param)<br />
{<br />
ThreadParam* pParam = (ThreadParam*)param;<br />
pParam->m_pDialog->Tx(pParam->m_nNodeIndex);<br />
delete pParam;<br />
}<br />
<br />
void CSimDlg::Tx(int nNodeIndex)<br />
{<br />
[simulate transmission]<br />
[graphic: draw nodes and color lines of the link used]<br />
}
Now my problem is that I would like to make different rounds:
<br />
void CSimDlg::OnBnClickedStart()<br />
{<br />
for(int i=0; i < NumberOfRounds; i++)<br />
{<br />
ElectCluster();<br />
FindMember();<br />
StartSteadyState();<br />
}<br />
}
This obviosly doesn't work because "for" doesn't wait for all the thread created by StartSteadyState();
I have tried to solve using:
<br />
hThread = (HANDLE)_beginthread(StaticTx, 0, (void*)pParam);<br />
WaitForSingleObject(hThread,INFINITE);<br />
It seems to work but doesn't shows the graphic. I have tried to put a MessageBox before WaitForSingleObject and for as long as I don't press the ok button I see that the links and nodes are coloring. pressing ok the graphic part stops.
What am I doing wrong?
Do you have any advices or suggestion?
modified 11-Mar-21 21:01pm.
|
|
|
|
|
The general solution is following:
1. Create thread with attribute "normal" and then suspend it (somehow the creation in suspendedstate does not work well.
2. activate thread when needed.
Serge Chychkan
|
|
|
|
|
First of all thankyou for your fast reply.
Hum... you mean create a thread for each cluster head and suspend it, than resume all at the same time after the for(... if(p->ch) ) ?
I have tryed using SuspendThread(hThread); and ResumeThread(hThread); .. the thread works but the graphic part is not shown again.
modified 11-Mar-21 21:01pm.
|
|
|
|
|
blpdone wrote: hThread = (HANDLE)_beginthread(StaticTx, 0, (void*)pParam);
WaitForSingleObject(hThread,INFINITE);
This is a very expensive way of making a function call. You are practically just making a call to StaticTx(0, (void*) pParam) since your function won't return until the StaticTx function has returned. This is definately incorrect. You should never block the main GUI thread as it is needed to handle window messages to the application.
I'm not sure why you need a thread for each node, and I hope that you are drawing only in response to WM_PAINT or have a good reason for not doing so.
|
|
|
|
|
Thankyou for your reply.
what do you suggest to do instead?
I have made a thread for each Cluster Head [CH] node because they have to make the same action at the same time. The Tx(int nNodeIndex) function is used by all CH node to activate, one at the time, the node that has to trasmit (coloring the link, redrawing all the nodes on the IDC_PLOT control). The same thing is done by all the CH at the same time managing all the nodes each CH has under its control.
Everythig seems to work fine for one round but if I increase it I have to "tell" the function to wait all the thread of the StartSteadyState(void) to end before restarting everything with the ElectCluster(void) .
Any advice on how to solve it? Or some ideas on other ways to do the same thing?
Thankyou Again
modified 11-Mar-21 21:01pm.
|
|
|
|
|
It's really hard to say without really knowing the specifics of the problem. But the thing is that even with threads, you aren't really doing the same action at the same time. How much processing is each cluster head doing? For each step? How many cluster heads? Actually if processing is low for each step I would be just using a WM_TIMER to update my state at discrete points in time and Invalidate.
Here's an idea in sorta pseudocode. Frankly I find threads with message loops to be much more flexible but this idea may or may not be suitable. I trust you can take care of any synchronisation issues with shared variables.
ThreadProc(...)
{
WaitForMultipleObjects( Start Event or Stop Event )
if Start Event
int nCurrentTime = 0;
while(true)
{
foreach(clusterHead in ClusterArray)
{
clusterHead->PerformNextStep(nCurrentTime);
}
Invalidate();
WaitForSingleObject(Stop Event, millisecsToNextInterval)
if Stop Event
return;
nCurrentTime++;
}
if Stop Event
return;
}
|
|
|
|
|
What is the best way to destroy a ToolTip Ctrl?
->DestroyToolTipCtrl()
or:
->DestroyWindow()
do i need to delete the control after that or if I use one of the above there will be no memory leeks?
Moreno
|
|
|
|
|
Hello friends. I on one of forums have found this e-mail:
unknown_cpp@yahoo.com. He helps everything, if a problem interesting.
|
|
|
|
|
vir_spb wrote: unknown_cpp@yahoo.com. He helps everything, if a problem interesting.
What do you want to say?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
maybe if you have a problem you can send your problem to this address and maybe you find your problem!
whitesky
|
|
|
|
|
where can i readup on writing to and reading from a command promp window?
|
|
|
|
|
If you mean writing a Windows Console application then any beginners book or tutorial for C/C++ programming.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Check out the Console Functions.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|