|
(still stuck
I am having a bit of trouble running CInternetFile::WriteString() and seeing results appear on the server file I am trying to change.
Here is a snipet of code that open the HTTP Connection, then opens a CInternetFile pointer then sends a request to write data (I hope). "strData" is the data I am sending.
pServer = session->GetHttpConnection("www.myserver.com", 80, "username", "password");
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST, "/folder/file.txt");
pFile->SendRequestEx(strData.GetLength());
pFile->QueryInfoStatusCode(dwRet);
pFile->WriteString(strData);
pFile->EndRequest();
Does anyone see any problems with what I have here? I am kinda basing this off an example I found but the file I am trying to write to is not affected. The permissions on the file are set to a+rwx but I am wondering if there is something in the code I am missing or perhaps on the server. I can read from the file just fine. I just can't write to it.
Thanks!
|
|
|
|
|
You need to find some information on HTTP and read about it. You can't update a file on the server using HTTP. You have to add that capability by introducing the behavior on the Server. There are a number of methods for doing this. You need to study the problem.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I understand. This was something I questioned myself thinking I shouldn't be able to update using HTTP but perhaps I could using FTP or some other means. I tried looking for up whatever information I could on CInternetFile but in everything I see, I get the same example and it tells me what I have done should work, but I believe you. I don't think it's that easy. So, in general, I'm a little stuck on what I should be reading. Do you recommend any articles? Sites? Thanks!
|
|
|
|
|
If you are attempting to create a file named file.text within your /folder virtual, you can do that with your code by making 2 changes. First, change the HTTP_VERB_POST to HTTP_VERB_PUT. Second, you must ensure the virtual directory named /folder on your web server allows write privileges.
But you would be better off not allowing write access to a virtual and using a post to an ASP page on that virtual. Within that ASP page, you could take the posted data and create a file.
|
|
|
|
|
Yes my previous post was incorrect. Since IIS4 the PUT command is supported. I don't know about other servers. There is good information on that here:
IIS HTTP PUT
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
How rude of me! I forgot to say "Thanks". Thanks for not letting me pass out bad information.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I remember there was this wonderful tool for setting up AfxMessageBox/MessageBox dialogs. I can't find it here and thought this was were I downloaded it. Does anyone know where this application is?
Thanks!
|
|
|
|
|
You mite be talking about the XMessageBox By Hans Dietrich (@codeproject). There was a messagebox (@codeproject) that used RTF to display the message using multiple colors, but I do not seem to be able to find that one.
INTP
|
|
|
|
|
nope. This was an actual application that would appear in the Tools menu that pops open a dialog box and lets you build an AfxMessageBox/MessageBox by simply filling in the form. It would then give you the code you must place in your program for the MessageBox you built.
|
|
|
|
|
There is one on CodeGuru:
here
-----------------------------
Get trial copy of comment generating tool CommentMakerPro, std::string and std::string containers viewer FeinEvaluatorPro and windows manager for Microsoft Visual Studio .NET FeinWindows at www.FeinSoftware.com
|
|
|
|
|
that's it! Thanks. I guess I didn't look hard enough.
|
|
|
|
|
can anyone tell me how to read a file by C++ coding?
and then i want to convert the upper case word in the file to a lower case.
after that,i want to count how many time the words repeat in the file,and the propability the words occur.hope some one can help me.....
thank to does can help me....god blesh u......
|
|
|
|
|
|
Didn't they supply you with a text book for the course that teaches you how to do that?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Should you still get credit for the assignment if someone else does your work?
|
|
|
|
|
Isn't this also a way of learning
|
|
|
|
|
The ability to read and comprehend is a prerequisite for using a book. (Sometimes I really wonder what the hell "students" are doing)
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
|
I can start a blank project, and have no problem using <complex> with anything I add. I can include it in the first source file I create, I can add a form to the project and use it in the form code file, I can link these things together, etc.
If I start a Net project I can add a generic C++ class and use <complex> therein, but any time I ntry to link this file to anything I get link errors. If I use <complex> in a form's code, or any other type of managed file, I get these same errors. I can copy code from another such project that I download, which works just fine, intop my own project, and it fails. These are typical.
delete3 fatal error LNK1120: 2 unresolved externals
delete3 error LNK2020: unresolved token (0A000016) delete
delete3 error LNK2020: unresolved token (0A000006) _CxxThrowException
Why?
I should mention that this is in VS 2003
Help please
|
|
|
|
|
If your are using static lib of you own (earlier version like VC 6 or 5) in VC.NET managed project. You will get some linker errors. Remedy is you need to rebuild your static lib with VC.NET.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thank you for taking the time to respond.
Actually I have never had another version of VS installed on this computer.
|
|
|
|
|
Hi, I'm messing with some custom tooltips. Here's the situation:
In my application I'm showing certain items in a list ctrl. There's a note column and a (jpeg) preview column. Both should display tooltips. My idea was to override a CToolTipCtrl and the WM_PAINT message for that control. Then in OnToolHitTest I would test whether the mouse is hovering over a note or preview and it would fill the members (a jpeg image or string, depending on what I'm pointing at) and use either of these in the WM_PAINT handler.
Now, once I hovered over an existing note, the tooltip keeps displaying (I set it to trigger for the whole client rect), even though I keep returning -1 from OnToolHitTest. So I'm not really sure what I'm missing here, it does work for the first time though. But once a tooltip has been displayed, it's pretty much broken.
|
|
|
|
|
Why is it that I can't get this window to call OnSysCommand when the user clicks on the Close [X] button. Is there something wrong with my code that someone can point out or am I leaving something out? Thanks!
/*************************************/
CClass1.h
class CClass1: public CFormView
{
....code.....
protected:
// Generated message map functions
//{{AFX_MSG(Class1)
afx_msg void OnSysCommand(UINT nID,LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CClass1.cpp
BEGIN_MESSAGE_MAP(CClass1, CFormView)
//{{AFX_MSG_MAP(CClass1)
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CClass1::OnSysCommand(UINT nID, LPARAM lParam)
{
if(nID == SC_CLOSE) //Check If [X] Button
{
AfxMessageBox(_T("Hello"));
}
else
CFormView::OnSysCommand(nID, lParam);
}
|
|
|
|
|
From memory OnSysCommand() is called for items selected on the System Menu, not for the [x] Close button. Use WM_CLOSE (OnClose?) for that.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
I used Class Wizard to insert an On_WM_CLOSE OnClose() function but it doesn't call it at all when I click on [X]. Anything else I'm missing?
void CClass1::OnClose()
{
//perform actions before closing
CFormView::OnClose();
}
|
|
|
|