|
Who am I, I don't Know wrote: I have tried using CHttpConnection of MFC(wininet)
That should work.
|
|
|
|
|
Following is the code lines I am trying
CString cstrServer = L"SomeServer";
CString cstrObject = L"SomePage.aspx";
CInternetSession HttpSession;
CHttpConnection *pHttpConnection = HttpSession.GetHttpConnection(cstrServer, nPort, NULL, NULL);
if(pHttpConnection)
{
CHttpFile* pHttpFile = pHttpConnection->OpenRequest(L"POST", cstrObject);
//I supposed to do something here, but I receive CInternetFile* in CHttpFile NULL
}
Unable to get the problem.
|
|
|
|
|
Are you using an example or tutorial? If so, provide a link. If not you should, there are some on MSDN
|
|
|
|
|
hi everyone,
i have a problem, i'm using a editable combo box inmy project and also i have added an event to combobox that when a user keys in any data it will check for the data i the database,if the data is there the data will be listing in the combobox.
My problem is after updating the combobox the cursor postion will be at the start(like "|100").I need the cursor should be postioned in the last of line.
please reply with some samples or links,please...
||SnAkeBed||
|
|
|
|
|
Asuming m_Combo1 is the variable of class CComboBox try
int tLen = m_Combo1.GetLBTextLen(m_Combo1.GetCurSel());<br />
m_Combo1.SetEditSel(tLen,tLen);
I hope it helps
|
|
|
|
|
thankyou for kind reply,
But it was not working...
|
|
|
|
|
thankyou for kind reply,
But it was not working...
||SnAkeBed||
|
|
|
|
|
SnaKeBeD wrote: But it was not working...
Which means what?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
try this, it work for me.
In a MFC dialog app , add a ComboBox, add a control variable m_Combo1 for it.
in the CBN_EDITCHANGE message map the metod: OnCombo1EditChange
In the body copy the folowing code
<br />
void CMFC1Dlg::OnCombo1EditChange()<br />
{<br />
<br />
CString UserText;<br />
TCHAR AddText[12] = _T("New Element");<br />
CWnd * pEdit = m_Combo1.GetWindow( GW_CHILD ); <br />
ASSERT( pEdit );<br />
pEdit->GetWindowText(UserText);<br />
if ( UserText.Compare(_T("New"))==0)<br />
{<br />
if (m_Combo1.FindString(-1,&AddText[0])==CB_ERR ) <br />
{<br />
m_Combo1.AddString(&AddText[0]);<br />
m_Combo1.SetCurSel(m_Combo1.FindString(-1,&AddText[0]));<br />
}<br />
int tLen = m_Combo1.GetLBTextLen(m_Combo1.GetCurSel());<br />
m_Combo1.SetEditSel(tLen,tLen); <br />
}<br />
}<br />
<br />
//Note CMFC1Dlg is the class for the dialog
Or take a look at:
http://www.codeproject.com/combobox/combocompletion.asp
|
|
|
|
|
thanks for your post,
this may be useful for me in future.
BTW, can you suggest me some technique in code project such that i can mark my favourites (like that of yours) such that i can refer them in future?
thank you.
|
|
|
|
|
What about the permalink (4th place "reply" and so on)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
thanks for your reply,
but will the permalink adds the post to my favourites?
what i mean is, i should be able to see my favourites from any system. can you suggest in this regard?
and replying tthe interested post and finding them in my posts from my profile page will also do.
but i would have to reply them saying
"thank you and your post is useful for me in future"
which occupies unnecessary space in CP and this may also be in convinient to some members.
thank you.
|
|
|
|
|
Yes, make a try... if you use search for a message, there will be "?" and "search" keywords in the url on the navigator when you go to the selected one. But once you are in the message, if you press "permalink" then the navigator autoupdates itself and in the toolbar you will have an URL in absolute mode with the code ID of the forum and message. So if you add it in favourites or copy paste in a txt you will have the url to the message, although the board grows a lot.
I make it that way, take the permalink and then write down a short description in a txt, adding the link at the end. So I have the direction and something that helps me find the one I need.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
hi thankyou for sending the code ,
your piece of code is working fine when i tried as seperate program
i'm sending the piece of code where i have to change the cursor postion. Since i have to Reset the condent of the combobox for the previous value, can u tell me tsome way to sort it out????
void CBillingDlg::OnEditchangeProductID()
{
int vv=m_ProductID.GetCoun();//m_ProductID
//is my variable for combo box
CString var;
CString xx;
m_ProductID.GetWindowText(var);//getting text//
xx=var;
var=var+'%';
m_ProductID.ResetContent();//Foe clearing the previous values//
m_ProductID.SetWindowText(xx);
/*Below Code for accessing the database*/
CString query;
query.Format("Select ProductID from Product where ProductID like '%s%%'",var);
TCHAR sz[1024];
sprintf(sz, query);
char *ptr=sz;
bas obj;
spring++;
int i=obj.ProductName(ptr,"ProductID");
for(int peek = 0;peek<obj.x;peek++)
{
="" m_productid.insertstring(peek,(lpctstr)obj.usernames[peek]);
=""
="" }
="" *accessing="" the="" database-end**=""
}=""
<div="" class="ForumSig">||SnAkeBed||
|
|
|
|
|
The easy way set the sorted property of the ComboBox to true, if the sort order is defined by the text in the list.
If not the easiest way is to add an “Order by” in the Query. Assuming the Data source supports it (i.e. Any ANSI SQL DB), and the ordering key is accessible in the query.
If the order needed is not defined by the data returned or accessed in the query you need to sort it manually, i.e. loading it into a vector or array, ordering the array with any sorting method (bobble, fast sort, hash tables ...)
Then insert the values from the ordered array.
|
|
|
|
|
Hi,
I have an instant message packet.how can i block this specific packet to reach to the destination?I can block this by changing the content of packet.
But after that no more messages are send by the messenger(Yahoo).
Im working with the packet in VC++ according to this protocol help.
http://libyahoo2.sourceforge.net/ymsg-9.txt[^]
I got the packet. But i can't block this.I think yahoo or TCP\IP send an acknowledgement signal before sending each and every packet or one of them calculate the check sum.So it resend the packet.
How can i do this. If you have any idea please tell me ...
Please help me ..very urgent............
Thanks in advance.......
Jomon
|
|
|
|
|
In general if blocking the packet breaks the protocol you can't do it and expect the protocol to continue. However if you set up a proper protocol transparent transiever which fakes both ends of the protocol you could do it.
| You write this part which mostly justs forwards |
real server<----->fake client interface<>filter<>fake server interface<----->real client
In this kind of arrangement both ends of the original system think they are connected to each other but they're really connected to your software. You can then forward or block packets at will and still provide valid acknowledgements back to the sender so it cannot tell they have been blocked. Depending on the protocol you might have to send alternative faked packets in place of the ones blocked to keep the other end happy in terms of packet sequence numbers, checksums etc.
You should be aware that any such piece of software is probably going to meet the definition of a trojan and may not be legal to actually install. If you write it, it's entirely your responsibility I'm not encouraging you to do so or offering assistance.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
hi i am trying to make a input data validation.
what i am trying to do is when data is inputed it is inputed first as a string(char[])
then i need to convert the string to an int or an float or etc... after i check that it is a valid int and such.
so my question is if there is any function like:
int isvalid<== check weahter an string is a valid int
convert string to int <== convert the valid string into a inv
same for floar and others..
please help i think this is a very useful code to learn
|
|
|
|
|
The are two ways to check whether a string is a valid int:
1) try to convert it and catch any failure conditions.
2) write your own string analysis or perhaps make use of a regular expression implementation to do some kind of custom check on the string.
Look for functions like atoi, atod, atof, strtod? for converting C character array type strings to ints floats and doubles.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
it is weirld but i cant seems to use try{} catch{} in c programming the compilr does accept it anybody knows why?
|
|
|
|
|
try{} catch{} are C++ not C
you shoud tyr __try __except ( ) instead
Warning __try __except is Microsoft Specific so it don't work in other compilers
|
|
|
|
|
HI
i want to use different captions for each MDI child window i create.
i am creating it using CreateNewChild function.
also how to assign some values for each child i create so that i can iterate over them or identify them using that value.
Thanx'n'advance
|
|
|
|
|
I made it (Inside DOC/VIEW architechture) in the CChildFrm::PreCreateWindow (CREATESTRUCT &cs). If you have that class, perfect. If not... take a look into your docu to that function, maybe it helps you to find out how to do it.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
ya i too have those class n functions available...
plz help me in detail...
|
|
|
|
|
ya i too have those class n function available..
plz help me in detail...
NOTE:
I am creating child window using CreateNewChild.. how can i make use of
cs.lpCreateParams.
|
|
|
|