|
how are the pixels formatted in that 'raw' buffer ?
Windows really only has built-in support for drawing DIBs (and DIB-like data), so you're probably going to have to massage your pixel data to get it into a form Windows likes - then you can use SetDIBits, StretchDIBits, etc.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
How do I program the following ?
//............................................................
String *names[] =new String*[50];
int x=0;
for (x=0; x<=10; x++)
{
textBox[x]->Text = names[x]; // <-- How can I do this ?
}
//............................................................
Thanks alot
Steve
|
|
|
|
|
This is just a guess, but what does this do:
textBox[x]->Text = *names[x];
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have gone through all the CSockets articles here but cud not find what i want. Okay let me tell u what i have done till now. First i created CMySocket(inherited from CSocket) object and call the Listen. Now i want to be notified that the socket is ready to accept connection. I am also catching the message in OnAccept Function. But unfortunately it never enters into it. So now client can then communicate.Please help me on it ????
|
|
|
|
|
You need to use CAsyncSocket instead of CSocket for that.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I have tried that as well but could not obtain what i want. I am getting an run-time error which says "No connection could be made because the target machine actively refused it." which is error 10061L. This means client is not finding to connect to server. I have not call accept at this stage. However, When i call accept my program stuck and i know why because accept is blocking call. I dont want to call in a thread as CSocket provides a high-level Socket Programming. SO i want to learn it you can say. But i am facing problems in it. Can please some one1 help in it ?
Please tell me a solution where i am able to find that server is ready to accept connection in OnAccept.
|
|
|
|
|
Nemanja, doesn't CSocket derive from CAsynSocket ? Methinks the problem may be that the client simply isn't connecting to the open socket.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yeah the same problem persist. Please help me and kindly provide me with a solution
Regards,
Ibraheem
|
|
|
|
|
It's hard to do this without seeing your source code. Perhaps you could post the (brief) code fragments that show (a) how your server starts listening and (b) how your client attempts to connect?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thankx alot for the cooperation but i did manage to solve my problem. Now i m thinking for better design but hopefully i will manage it INSHALLAH. anywasy once agai thanx for the help
|
|
|
|
|
Glad you're up and running!
Coincidentally, I'm building a client server app (a free bug database) at this very minute. Check out this[^] preview screenshot.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi friend,
I really faced a similar problem while i was trying to learn socket programming, and after a hard work with CAsyncSocket and lots of headache, i decided not to use it, i felt there is something wrong.
I can instead explain a simple portable method to connect a client socket to a server, you can read it, and its likely to be easier and more powerful than using MFC socket classes, here is my explanation which is some notes I took for myself when I was reading about winsock API:
-----------------------------------
* the sockaddr_in structure:
struct sockaddr_in{
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
this structure is used to define:
1- Information about server (Computer IP, Port, address family) so client can connect to it
2- Information about types of clients the server can accept.
sin_family: Address family, should be AF_INET
sin_port: port number
sin_addr: IP Address
-------------------------------------------------------------------------------------------------------
Creating Basic Client/Server applications:
IMPORTANT NOTE: a valid SOCKET can receive and send data. a SOCKET is not necesserly specialized for sending only or for receiving only.
Basics for creating a Server application:
The server aaplication should be able to:
1- Detect an incoming connection from a client application
2- Accept this connection
3- Receive data from client.
Steps:
1- Define two SOCKETs for the server, one for listening for incoming connections, another one to handle a real connection.
SOCKET sListen,sConn;
2- Define and initialize a sockaddr_in object to hold information about the types of connections that can be accepted.
sockaddr_in saAddresses;
saAddresses.sin_addr.s_addr=htonl(INADDR_ANY); //any IP address can be accepted by the server
saAddresses.sin_family=AF_INET; //Internet (or network) address family
saAddresses.sin_port=htons(5000); //port number is 5000 (converted from host to network short)
3- Create the listening socket so we can detect incoming connections:
sListen=socket(AF_INET,SOCK_STREAM,0); //a stream of data is expected
4- Associate Information about (what can be accepted) to the Listen socket
bind(sListen,(sockaddr*)&saAddresses,sizeof(saAddresses));
5-Start listening:
listen(sListen,5); //5=max number of queued connections (pending)
6- Start a Thread loop to check for incoming connections
UINT thread(LPVOID lpvoid)
{
while(1)
{
char buff[100]; //100 bytes buffer to receive data from the client
CServ3Dlg *dlg=(CServ3Dlg*)AfxGetApp()->GetMainWnd(); //get dialog window pointer
int addlen=sizeof(dlg->m_saServ);
dlg->m_sMsg=accept(dlg->m_sListen,(sockaddr*)&(dlg->m_saServ),&(addlen)); //accept an incoming connection
if(dlg->m_sMsg!=INVALID_SOCKET) //if a connection was accepted handle it in a loop to receive data
{
AfxMessageBox("co");
while(1)
{
int s=recv(dlg->m_sMsg,buff,100,0); //receive data from client and put data in buff
if(s!=SOCKET_ERROR)
{
AfxMessageBox(buff); //acknowledge recption of data to user
}
}
}
}
return 0;
}
Basics for creating a Client application:
The Client Should be able to:
1- Request a connection from a server
2- Send data to the server
Steps for creating a client application:
1- Create a sockaddr_in structure to define the address of the server:
m_saServerAddress.sin_family=AF_INET; //Internet Address family
m_saServerAddress.sin_port=htons(5000); //port number
m_saServerAddress.sin_addr.s_addr=inet_addr("127.0.0.1"); //address of destination computer
2- Create a socket for the connection:
m_sClient=socket(AF_INET,SOCK_STREAM,0);
3- Connect to server application
connect(m_sClient,(sockaddr*)&m_saServerAddress,sizeof(m_saServerAddress));
4- Send Data to server application:
send(m_sClient,buf,100,0);
Closing a connection between client and server applications:
The client closes the connection by writing:
closesocket(ServerSocket); //close my connection with server
//ServerSocket is the socket defined in client and associated with the server.
----------------------------------------------------
I also recommend you to read the book :Network programming using micrososft windows, advanced, good, and new book explaining winsock2 for windows 98, 2000,NT. if you wish i can send you an electronic copy for FREE.
I hope this helped
Note: if you find this helpful, i can also send you the rest of notes i took about winsock. but they r far from your question
Regards,
Mohammad
|
|
|
|
|
Thank You so much but i have done this 1.5 year ago. So i this wanted to try different thing and i have noticed with CSocket or CAysncSocket things are very easy. You dont have to worry abt the blocking calls. Only have to simple override functions and ur job is almost done. Yeah u need lill better design while deriving from CSocket. I finally managed to solve the problem. Thanks anyway
|
|
|
|
|
Hi,
I'd like to know the real differences between the high level file functions (fopen, fread, fwrite) and the low level ones(_open, _read, _write).
I'm using MSDEV 6.0, manipulating binaries files. But the high level functions are not working well. I've just changed to low level, and it seems to work. I don't understand where is the problem, could it be anything in my input data that high level can't deal with?
Thanks,
Patricia
|
|
|
|
|
first difference, the way you use them. not really the same, because functions as open() , read() , write() , close() work on packets of n bytes (you can specify how much), when fopen() , fread() , fwrite() , fclose() work on streams. thus, open() returns an id while fopen() returns a pointer to a structure representing the file.
second difference are the libs they are located. high level one are in "added" libraries (this is the reason of why we call them "high level" functions). low level ones are in the kernel, and can be accessed by modules that are running in kernel mode - or under. so, if you are designing an HW driver, you cannot use high level functions, because of the way windows (and it is the same for linux) manage drivers...
hope this is not too confused
regards,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thanks, I understood the difference and realized my problem.
|
|
|
|
|
Ahoy all,
I'm currently making an application that analyzes network packets on a Windows system. I have no problems monitoring the packets but I'm having a hard time finding the source application of the packet (on the local system).
Applications such as NetLimiter are able to tell where a specific packet originated from.
Does anyone know how to achieve this? How can one find the process that sent the packet?
UPDATE: Found a way to enumerate all active connections and their ports, but still have no clue on how to figure out a connection's process ID.. anyone?
Huge thanks in advance,
|
|
|
|
|
Hi,
My program is written in Visual C++ 6 + MFC (4.2)
I need to build it with unicode. I downloaded Microsoft Core Platform SDK and took "unicows.lib" from there.
When building application in debug mode i get following error :
"Linking...UnicoWS.lib(failure.obj) : fatal error LNK1103: debugging information corrupt; recompile module"
When i started researching , i understood that unicows.lib i took from microsoft core SDK is latest version and it was build in VC 7 (it's debug info).
Now , the question is if maybe someone has older "unicows.lib" which will be good for VC6 ? I need it badly.
Please post URL to download here or sent it to
leon AT btdtech DOT com
Thanks!!
|
|
|
|
|
http://weblogs.asp.net/michkap
This is Michael Kaplan's blob who did UNICOWS. Maybe he can help.
*shrug*
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I have installed the latest command line C++ compiler from microsoft, and I would like to use it in my Visual Studio 6.0
Does anyone have any pointer on how to do this?
|
|
|
|
|
Hi,
I want to enable all the hot keys in my MFC application (in menu items, dialogs etc) after launching the application without pressing the ALT key. Is this possible, if yes how and where do I write the code.
eg. MS-Word shows the hot keys for menus when launched without pressing the ALT key.
At present the hot keys in my application are enabled only after I hit the ALT key.
Thanks,
PRJ
|
|
|
|
|
I looking for a batch program where one could place the same program to be executed with its parameters (not arguments as we know it) several times. When the batch program is run, it would executed the program file automatically with its parameters(not arguments).
I would like run the same program several times with different parameters.
Does anyone perhaps know of such a batch program and where I could get hold of it.
Thanks.
louis
|
|
|
|
|
Just in case someone wants to know the difference between arguments and parameters as mentioned in this question.
Arguments are those variables that one passes to a subroutine, or for example, as in the old days when programming in C, main(int argc, char * argv[]). These values are passed before the program is executed.
Parameters on the other hand are variables(inputs) required by a program during its execution, for example scanf() or getc() in C.
Thanks again.
Bamboo
|
|
|
|
|
So you have a command line program that prompts the user to type in their parameters at run time?
You could just redirect the input from a text file rather than from the keyboard
e.g.
Myfile.exe arg1 arg2 <parameters.txt
(i can't="" remember="" if="" that="" syntax="" is="" correct,="" offhand,="" but="" it="" should="" work)=""
<small="">--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
benjymous wrote:
You could just redirect the input from a text file rather than from the keyboard
Assuming that the program is reading from standard input, you'd have:
myprog.exe < file.dat
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|