|
don't mind - after some trying i found out what has happened. because i massively experimented with the settings i accidentally removed the dependencies of the exe to the dll - and so the new dll wasn't created...now it works
|
|
|
|
|
Hi all,
I need to develop a multy-cast server which accept connection from several
clients(each client at different port).
The problem is that after the clinet connect to my server,and send data at the first time,in the next time,from some reason - the select()
function is blocking my application,until the client will connect again(which means that the client needs to connect each time he want to send data).
I was told to use non blocking socket,but it's not working.
Here is my listening thread:
UINT ListeningThread(LPVOID lpvoid)
{
CMultycast_serverDlg *dlg = (CMultycast_serverDlg *)lpvoid;
FD_SET SocketSet;
int port;
struct sockaddr_in echoClntAddr;
SOCKET clntSock;
unsigned int clntLen;
int SelectResult = 0;
unsigned long argp = 1;
dlg->SelectFlag = false;
dlg->ExitFlag = false;
FD_ZERO(&SocketSet);
for(port = 0 ; port < dlg->NumberOfPorts ; port++)
FD_SET((unsigned int)dlg->SocketsArray[port] , &SocketSet);
while(!dlg->ExitFlag)
{
SelectResult = select(NULL , &SocketSet , NULL , NULL , NULL);
if(SelectResult == 0)
continue;
else if(SelectResult == SOCKET_ERROR)
{
AfxMessageBox("Error : select() has failed ");
return 0 ;
}
else
{
for(port = 0 ; port < dlg->NumberOfPorts ; port++)
{
if(FD_ISSET(dlg->SocketsArray[port] , &SocketSet))
{
clntLen = sizeof(echoClntAddr);
clntSock=accept(dlg->SocketsArray[port] , (struct sockaddr*)&echoClntAddr , (int *)&clntLen);
if(clntSock != INVALID_SOCKET)
{
dlg->HandleClient(clntSock);
dlg->m_RecievedDataListBox.AddString(dlg->RecievedString);
ioctlsocket(clntSock , FIONBIO , &argp);
}
}
}
}
}
for(port = 0 ; port < dlg->NumberOfPorts ; port++)
closesocket(dlg->SocketsArray[port]);
return 1;
}
Can anyone please help me???
With best regards,
Eli
|
|
|
|
|
I am writing an application in which I want to also control the power of the PC (running Win98 - only). According to a know schedule, I want it to enter Standby and later on to wake up. What functions are available to a C++ program to achieve this power control ? (Apologies if this is not STRICTLY the correct forum for this query !)
Doug
|
|
|
|
|
|
Can I creat a CDialog object in a CPropetyPage ???
I have an application with property sheet-pages objects (tab-dialog). I have a dialog object (and match implemented class) which I want to add to the sheet as a page in it. I create a class derived from CPorpertyPage and add it to the sheet and in it I creat the dialog.
Is this ok ? It seems that I have a problem entering data to edit boxes because of this ? what can I do ?
thanks in advance,
yaron.
|
|
|
|
|
Yaron Abershitz wrote:
I have a dialog object (and match implemented class) which I want to add to the sheet as a page in it. I create a class derived from CPorpertyPage and add it to the sheet and in it I creat the dialog
The Simple Way to do this is ..
1 ) Create A Dialog Resource and put all the controls u need
2 ) double click the dialog then the they will ask for creating a class
3) When creating the class , choose the parent as CPropertyPage
4) Add this Page as a member variable in your Property Sheet Class
5) In the constructor of PropertySheet, Call AddPage(& Page); inorder to include this page in your sheet
6) DoModal()/ create Your PropertySheet Object , then the page u added earlier will appear as a page in that sheet.
try this...
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
Hi All
I know little about Visual C++.net programming and would be grateful for any insights into solving the following problem. For one function, ideally I would like a Switch Case that has 10000 case entries as follows:
Switch (Product_Case)<br />
{<br />
Case 1 : Price = 1.07; break;<br />
Case 2 : Price = 1.07; break;<br />
...<br />
Default Case<br />
}
Using a Switch case in this way would achieve my aim of being able to get a price corresponding to a product, but presumably a 10000 case switch would cause memory problems and and be slow. How would an experienced programmer handle this? Would they create an .mdb with the Product and corresponding Price entries and then read from that file using pointers and SQL? As I want this data embedded in an .XLL, what type of header/source/resource do I use in Visual C++.net?
Any ideas would be gratefully accepted.
Jeremy
|
|
|
|
|
I would just do binary or plaintext file, put in resource, when needed load to memory and do something like Price=MemArray[index].
Igor Green
http://www.grigsoft.com/
Compare It! + Synchronize It! - files and folders comparison never was easier!
|
|
|
|
|
I don't think it would be particularly slow, actually, but the code would be really large. The compiler is likely to build a jump table rather than a sequence of if/else tests.
As to how to implement it, it depends whether the data will change over time, and if so, whether you want to allow an administrator to make the changes (in which case some form of external file access is in order). If you think the data is fixed for all time, or if a recompile is acceptable to change the values, I'd create a lookup table. Since it's 10000 values I'd probably write a program to generate the C++ file containing the lookup table! Obviously if you do this it's harder to change values, but on the other hand you won't need to write file handling and validation code, nor have to handle situations where the file is not present or inaccessible.
If you decide to go the external data route, I'd go with a file that fits in with the existing data access and the expected skill of the administrator. If data already comes from a SQL or Jet database, I'd place it there. If it's a flat file, I'd add this as an extra flat file, and so on.
Finally, if the quantity can be computed from some equation, I'd just do the computation rather than the lookup. A few years ago I might have cached the values of computations, or used lookup tables. Now processors are so much faster than RAM that computing most quantities is often quicker than retrieving a precomputed value. Obviously you need to measure this with a profiling tool.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I recommend using a Product_Case to Price map.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
You still have to get the valuess INTO the map, so how does that provide any gains over the switch statement? Especially if the switch compiles into a jump table and not a series of if/else if type statements. However, I would accept that a MAP might be the way to go if reading of an external data source is implemented.
|
|
|
|
|
Blake Miller wrote:
You still have to get the valuess INTO the map, so how does that provide any gains over the switch statement?
The gains are in the area of maintenance, not necessarily performance.
- For large
switch statements a map lookup is easier to understand and therefore easier to maintain.
- A map lookup is more robust (i.e. less error-prone, dure to factoring) if the switch is needed more than once.
- As you have already pointed out, a map allows run-time initialization and is therefore more flexible.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hey.
I dont know where this topic should be...
I am looking for a SIMPLE description of jabber protocol.
|
|
|
|
|
|
hi ,
I want to use command line by using GetCommandLine but:
When I run my app like this:
MyApp.exe /run then get an error.
Why?
Thanks.
|
|
|
|
|
but man how are you running your application I mean what parameter is it run by.
You shoul write a registry key for this. I have a program on code project that uses this function GetCommandLine ("Little Audio Player" by euacela)
you can easily see there how to use getcommandline function. the program uses it to load a playlist just like winamp. Just by clicking on the playlist the program starts up and loads it.
gabby
|
|
|
|
|
Hi~ I'm Korean.
I can't write English..also can't read.. sorry.. ^..^
I want simple messenger source..
It will use for study of programing..
Where is a reference room in CodeProject..?
I can't find it..
Please..help me..
e-mail : larc21c@hotmail.com
^^;
|
|
|
|
|
Been busy with common controls and implemented a trackbar
(At last..it works fine !)
As I have limited skills in programming, I looked into MSDN and wonder how I can implement the buddywindows that are by default assigned to both ends of the trackbar...?
I'd like these to show two icons..I have to work with the TBM_GETBUDDY and TBM_SETBUDDY Messages but I don't know how to proceed.
Another thing is: whenever I click in the trackbar area ,a dotted line (probably the bounding rectangle) appears around the trackbar. Does anyone know how to prevent this? Should I send WM_KILLFOCUS messages or something?
Ok, enough questions. Any help would be greatly appreciated.
|
|
|
|
|
When IE downloads an exe file, it checks its signature. Does anyone know how to verify exe signature from our application ? that is, can someone help me find the source code/api to the signature verification tool ?
thanks a lot
Hari
Hari Krishnan
|
|
|
|
|
|
thanks a lot Mike, I'll check it out.
Hari
Hari Krishnan
|
|
|
|
|
Is there any such api which enlists the devices on the computer or WMI SDK is the only option.
Please give a name of the book which explains a the WMI .
A line of code is worth thousand words .If u have got such a code which enlists the devices on the computer i will be obliged.
|
|
|
|
|
Use the setupapi to enum and configure installed device drivers. It might be easier than WMI.
Don't try it, just do it!
|
|
|
|
|
Hi,
I am developing an application in VC++ in which i need to set the date and time of the System in which my application is running.
Please provide me some ways by which System date and time can be set from VC++ Application
Thanks in Advance
R.Gopalakrishnan
|
|
|
|
|