|
Hi ,
How to ping the http server, post command and download file from server in MFC?
|
|
|
|
|
MFC has a class called CHttpFile to read files on a server.
There is also an API called URLDownloadToFile which can download a file identified by a URL.
|
|
|
|
|
Thanks Superman,
My query is:
I have a http url that url contains a form with 5 field, I need to fill those field to get the string from server.
Can you pleaes guide me to do so..
|
|
|
|
|
I have a combo box and some edit controls in my application. In the combo box there are 8 items. Some values are entered and Selection is made from the combo box and a button is clicked. There will be eight iterations since there are 8 items in the combo box. Everytime the edit control values will change. in the second iteration, if the user forgets to change the combo box value, the system should pop out a message saying that for first event the value is already evaluated...
|
|
|
|
|
And what is your question exactly ?
|
|
|
|
|
Oh Sorry Cedric...
How do i check if the earlier item in the combo box is already used.
|
|
|
|
|
Could you not remove 'used' items from the combobox? That would eliminate an erroneous input from the user if I understand you correctly.
|
|
|
|
|
If you insist on having the items in the combo box even after they were used you could try using their itemdata to indicate if they have been used or not.
-By default itemdatas are zero
-When your user hits the button, check the itemdata (CComboBox::GetItemData[^]) of the currently selected item, if any, if it is not zero, warn the user and don't continue, if it is zero, then use the item
-when using the item, set its itemdata (CComboBoxSetItemData[^] to 1 for example
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Hi,
I want to draw rect in view class and i want to load bitmap in that rectangle.
So my code is
StRect.left=5;
StRect.right =25;
StRect.top = 300;
StRect.bottom = 320;
pDC->Rectangle(StRect);
CBitmap bmp;
bmp.LoadBitmap(IDB_PVHIGH);
CBrush brush(&bmp);
pDC->FillRect(StRect,&brush);
Bitmap dimension is Height=20,Width=20.
But it does not draw correctly.the centre of bitmap is shown in one corner of rect and it looks like it shows three same bitmap image is showing in that.
How can i get that correct display.
Anu
|
|
|
|
|
I add this line before FillRect
pDC->SetBrushOrg(StRect.left,StRect.top);
Its working.
Anu
|
|
|
|
|
|
I have a TCP/IP (socket) client/server program.
I want to transfer data directly between 2 or more clients without accessing server to reduce server's transferring tasks.
One of interesting samples is bt download tools, I guess bt tools transfer data directly among clients.
But how to do it? what techs should be used (such as socket)?
Thanks for any ideas and links in details - not limited to bt methods.
|
|
|
|
|
Hi,
If u r willing to use UDP, u can transfer data from one client to another client with user defined comm protocol.
|
|
|
|
|
You have to elaborate a bit better what you're going to achieve. In the term you spoke, the question is a nonsense.
In a "socket" world there must always be someone who connect to someone else who "listen". the first is a client , the second is a server.
Also "transfer between two or more" is a mis-concept.
That's not only a matter of grammar: networks are graphs, and graphs are made by nodes and arcs, and arcs are between two nodes. There cannot be segments with "two or more" ends.
What you're searching is not a "strange programming technic" but is an architecture made by client and server components placed on all the computers (the peers) that -after opening some sockets between some pair of them- exchanges some messages to let them understand what data is on what computer and let them transfer the "missing" data so that -after a number of iterations- all data are on all machines.
All this, is a "protocol" you have to design.
It's not a matter of TCP or UDP (they are just transport protocols) but of Checkpoints, Representation and Messages. In other ward "application level protocols".
The coding of the sockets is the last thing to be done, not the first.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
|
what do I need as an overload= for the array type
I have a vector template that needs an overload
http://www.contract-developer.tk
|
|
|
|
|
Perhaps this well set you on the right path:
#include "stdafx.h"
#include <tchar.h>
#include <iostream>
using namespace std;
class MyVector
{
public:
template <typename T, size_t N>
MyVector& operator=(const T(&a)[N])
{
for (size_t i=0; i<N; ++i)
{
cout << a[i] << " ";
}
cout << endl;
return *this;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
MyVector vec;
int n[] = {1, 2, 3, 4};
const char* s[] = {"One", "Two", "Three", "Four"};
vec = n;
vec = s;
cout << endl;
}
Output:
1 2 3 4
One Two Three Four
NOTE: Visual Studio 6 can't handle it.
Steve
|
|
|
|
|
For some reason VS 2010 does not like that.
Do I need more assignment overloading?
vector operator= (vector &that) {
for (int i=0; i < that.data.size(); i++)<br />
this->data[i] = that.data[i];<br />
return *this;<br />
}<br />
vector operator= (base* that) {
for (int i=0; i < sizeof(that); i++)<br />
this->data[i] = that[i];<br />
return *this;<br />
}<br />
http://www.contract-developer.tk
|
|
|
|
|
It looks like you need something like this instead of the second overload:
template <std::size_t N>
vector& operator=(const base(&that)[N])
{
for (int i=0; i<N; ++i)
data[i] = that[i];
return *this;
}
sizeof(that) is wrong for may reasons. It's the size of a single base type in bytes. Also, read up on array to pointer decay.
NOTE: Both overload should return vector& , not vector .
PS: No animals where harmed while posting this code.
Steve
|
|
|
|
|
This variable N, is that second needed?
My goal...
matrix a;
matrix[0] = {0, 1, 4, 1, 9};
matrix[1] = {....};
and so on, so I am trying to get the vector base template working better
http://www.contract-developer.tk
modified on Thursday, June 17, 2010 8:38 PM
|
|
|
|
|
I don't think this kind of thing can be done unless you've got some brand spanking new C++0x[^] compliant compiler. Specifically the C++0x "Initializer lists" feature.
Steve
|
|
|
|
|
Guess I am waiting for Visual Studio 2010 SP1
http://www.contract-developer.tk
|
|
|
|
|
|
I have looked the std::array and I will see what I can do about casting that to my vector template.
#include <array>
http://www.contract-developer.tk
|
|
|
|
|
That was another waste of time.
Sure seems VC 2010 is hostile to data processing.
http://www.contract-developer.tk
|
|
|
|