|
Ok, and how can I remove the zero length dummy column ?
Which version of MSDN you met this ? And where exatly you found it (which keyword) ?
Thanks,
Cris.
|
|
|
|
|
I guess I'm not sure how to remove the zero length dummy column. I am using the October 2001 MSDN, the keyword I typed in the index was LVN_DELETECOLUMN.
Chris Richardson
|
|
|
|
|
Can someone tell me what windows message is sent when you right-mouse click on the title bar (or left mouse click on the small icon) of a dialog based window application?
I need to add a menu item to the "Close" and "Move" menu items.
Here's what I have so far:
CMenu *pSystemMenu = (CMenu *)GetSystemMenu(FALSE);
pSystemMenu->AppendMenu (MF_STRING, ID_MY_MENU_ITEM, _T("My menu item"));
I put that code in OnInitDialog() message handler. So the item shows up but of course nothing happens when I click it.
So in a Doc/View arch. application, the message is WM_SYSCOMMAND but I can't find this type of message in a Dialog based application.
-steve
Manufacturing Software Developer
Hewlett-Packard Company
|
|
|
|
|
You've got to define a handler for ID_MY_MENU_ITEM . Check the docs for the ON_COMMAND macro.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Excellent! That's it! I appreciate the feedback.
Manufacturing Software Developer
Hewlett-Packard Company
|
|
|
|
|
Hello All, I am having some problems trying to learn the basics of FTP'ing a file (uploading and downloading). I have read most of the information on this website and even found some postings that helped but I am still having some problems. I was hoping some of the brainiacs out there could help. This is what I am trying to do: I want to open the FTP session, upload a file, close the session. Then, periodically, I want to open the session, see if there are any files to be downloaded, if there are download the file(s) and close the session. I found a posting that said to use CFtpConnection and so that is what I am trying to do.
I am using the CFtpConnection class, so to open the session I use GetFtpConnection. I pass in the server name, user name, password, then use INTERNET_DEFAULT_FTP_PORT.
Upon trying to upload the file, I am using the PutFile. I use the CFileFind class to get the filename. I then call PutFile with the remote file (it is on the network), the local file, FTP_TRANSFER_TYPE_BINARY, and then 1. This function is failing.
Upon trying to download the file, I am using the GetFile. I pass it the remote file, the local file, FALSE for the BFailIfExists, FTP_TRANSFER_TYPE_BINARY, and then 1. This function is failing.
Then I have the closing of the connection after the upload or download functions,
m_Session.Close();
m_pFtpConnection->Close();
if(m_pFtpConnection!=NULL)
delete m_pFtpConnection;
if(m_Session!=NULL)
delete m_Session;
Another problem I have is that this is all being done inside another application. I open the session, upload the file, then close the session. When I go to open the session again, it gives me "the handle is invalid" message. Can anyone help!!!
|
|
|
|
|
using CloseHandle on the handle returned by CreateThread doesen't work, how do i do it?
thanks
|
|
|
|
|
just return from the thread, or use ExitThread,
to communicate with the thread see events pr semaphores
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
how is it i communicate with the thread? events pr semaphores?
thanks
|
|
|
|
|
The best way is to provide a mechanism inside of your newly created thread that will accept a message to shut itself down. That is the only way to insure that all of the resources have been properly released by the new thread.
However in an emergency you can use the ::TerminateThread API function to "kill" the thread from another thread.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have been writing an app that uses a contextual dialog bar which displays information pertaining to the type of object represented by the active view in an MDI MFC app.
When the user selects a new view I need to know what view has been selected in order to change the dialog information. When the user closes a view but another is available I need to know what view has been selected automatically (again). When the user has closed the last view I need to close the dialog bar all together.
This sounded easy but I have tried all manner of messages - WM_ACTIVATE, WM_SHOWWINDOW, WM_KILLFOCUS, WM_SETFOCUS... Everytime I think I have it a message will not come through when I expect it and everything falls apart.
Is there an easy way to know this information?
thanks
kirk
|
|
|
|
|
I do this by handling WM_SETFOCUS of the view's frame window (CMDIChildWnd derived).
Pavel
Sonork 100.15206
|
|
|
|
|
Override OnActivateView() .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I declare these below data
[code]
CString Hash[2] = {"208803DD4D","146DB1CB1C"};
CArray<unsigned char,="" unsigned="" char=""> hashdata;
[/code]
and hashdata have some value
I compare CArray and CString like these
[code]
if (hashdata == Hash[0])
{
......
.....
.....
}
[/code]
but there is error message show
error C2678: binary '==' : no operator defined which takes a left-hand operand of type 'const class CArray<unsigned char,unsigned="" char="">' (or there is no acceptable conversion)
Do I need to change CArray to other type of data? If you know how to solve my problem, please tell me.
Thank you very much.
|
|
|
|
|
do you want to compare the CArray of strings with the C-style array of CStrings? in that case you have to compare each element manually:
for (int i=0;i<hashdata.GetSize();i++)
{
if (hashdata.GetAt(i)==Hash[i])
{...}
}
-c
Green's Law of Debate:
Anything is possible if you don't know what you're talking about.
|
|
|
|
|
if (hash[0] == (LPCTSTR)hashdata.GetData())
hashdata should be NULL terminated for this to work.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
std::string str;
char x[512];
ZeroMemory(x, 512);
int len = 0;
do
{
len = recv(socket, x, 512, 0);
str += x;
}while (len > 0);
I want to eliminate this double copying and want the data to come directly in the string. How can I do that?
modified 29-Aug-18 21:01pm.
|
|
|
|
|
There are several solutions including an ostreamstring object, insert_iterator, and insertbuf_iterator.
Look those STL tools up at SGI.
Kuphryn
|
|
|
|
|
sorry, but how can i give a back_inserter or an ostringstream as a parameter in recv call? I could not figure it out.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
You can eliminate double copying if having an std::vector instead of a std::string is OK with you. Of course, copying is still done when resizing the container (but this is unavoidable):
std::vector<char> v(1);
size_t extra_space=0;
int len=0;
do
{
if(!extra_space){
v.resize(v.size()+512);
extra_space=511;
}
char * p=&v[0]+v.size()-extra_space-1;
len= recv(socket, p, extra_space, 0);
extra_space-=len;
}while (len > 0);
v[v.size()-extra_space-1]='0';
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you very much.
But, I use a few string operations that i believe is not available in vector. I have to look at the rest of my code to see whether vector can indeed be used.
|
|
|
|
|
Andrei Alexandrescu wrote a A Policy-Based basic_string Implementation[^] that's basically a drop-in replacement of std::string s. One of the incarnations of this class, namely that which uses VectorStringStorage as its Storage template parameter, uses a std::vector as back-end storage, so you can use it like I suggested in my latter post and yet have all the facilities std::string s come equipped with.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It is a realy pity that Mr. Alexandrescu doesn't seem to be doing anything much with his Loki library. It is a very impressive body of work, but he almost seems to have abandoned it. I know there is a group on Sourceforge doing some work on it, but Andrei appears to be invisible.
And wouldn't it be great if we could use it with VC6, not that thats his fault of course. This is one of the few reasons for moving to VC7.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
VC7.1 you mean? VC7 can't for christs sake even handle PTS!
|
|
|
|
|
Mike Nordell wrote:
VC7.1 you mean? VC7 can't for christs sake even handle PTS!
I reckon I should know what PTS is but ...???
Is there such as beast as VC7.1?
STL, Boost, Loki et.all are all wonderfull stuff for our toolkit, but without compilers that are able to use them all we can do is sit and drool and wait impatiently.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|