I have just tested this and it works OK. You need to ensure that your bitmap is the same size or smaller than your button. Also if you need to show both bitmap and text, then you must ensure that your bitmap is small enough to leave space for the text.
I've been working with some code that uses a TCP connection for the past few weeks. I have a socket class derived from CAsyncSocket.
Everything works fine initially. I instantiate my manager class which wraps around the socket class and calls connect (via a member pointer to the socket class). I am then able to send a receive data. The problem comes when there is a socket error. For a currently unknown reason, part of my code is causing a socket error. I have yet to find where this is happening but the problem forced me to test out the part of my code which shoudl attempt to recover the connection. It doesn't work, and I can't get things going.
I have overriden OnClose, which calls a method on the manager class (its parent) called OnSocketClose. This calls socket.shutdown(), socket.close() and 'delete socket'. It then sets the pointer to 0. From here, the next time I attempt to send anything down the socket it looks for the socket pointer == 0, to indicate that it should create a pointer to a new socket.
This new socket is created but fails to connect. I have got it to appear connected on a couple of occasions by moving things around but OnConnect doesn't seem to get called and I am unable to send data. The returned value from socket.connect however reports that the socket is already connected if I call socket.connect again, after a short period of time from the first call to connect (socket error 10056).
Apologies if this sounds a little confusing, but I think I have managed to confuse myself... massively
If it will help, I can post code? Just let me know which parts you need to see.
Thankfully, I have managed to solve this issue so thought I would post the solution in the hope that it might help someone else with the same problem.
The problem (rather annoyingly) came because the socket was being created initially on the main thread, but was later being created again (after the socket was destroyed because of a connection error) on a worker thread. This meant that the On* callbacks weren't being implemented, and so I got no feedback from OnConnect and didn't receive any data because OnReceive was never being called.
As soon as I managed the socket entirely from the main thread, everything was fixed
I am doing program in c++ . But I faced some problem to create dsn dynamically using SQLConfigDataSoure function. It does not create dsn...
Here is my following code
CString strAttribute ;
strAttribute.Format (_T("DSN=DSNPREVIOUSLOG\\0 FIL=MS Access\\0 UID= \\0 SafeTransactions=0 \\0DBQ=%s\0"),strDest);
SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN,_T("Microsoft Access Driver (*.mdb)"),strAttribute);
it returns false...
kindly help me ...
Thank u in advance
I'm trying to animate a box moving from point A to point B. I'm using a .Net timer to
animate but I'm not sure on the math to get the box moving in a straight line. So far
the box finishes moving down before it finishes moving to the right.
I'm not very good at math but I'm thinking the equation should be straight foreward?
4. Change the box position by the given step in each timer tick. Because the steps are rounded down (see step 3) you should also store the end position you want to get to and move the box there in the last step (not too elegant, but it will get the job done without anyone noticing).
Sure hope this helps, but seriously if this math is too complex to figure out you've got a long way to go my friend. Best of luck to you.