|
Hello everyone,
Here is my test code. My question is even if I provide a wrong username/password to access passport protected site, like login.live.com, the return code will always be successful.
Anyone have any ideas what is wrong?
#include <string>
#include <iostream>
#include <exception>
#include <windows.h>
#include <wininet.h>
#include <fstream>
#include <conio.h>
using namespace std;
#pragma comment(lib,"wininet.lib")
int main(int argc, char* argv[])
{
HINTERNET hOpenHandle, hConnectHandle, hResourceHandle;
DWORD dwError, dwStatus;
DWORD dwStatusSize = sizeof(dwStatus);
hOpenHandle = InternetOpen("TestAgent",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0);
hConnectHandle = InternetConnect(hOpenHandle,
"login.live.com",
80,
"GeorgePassport",
"WrongPassword",
INTERNET_SERVICE_HTTP,
0,0);
hResourceHandle = HttpOpenRequest(hConnectHandle, "GET",
"/",
NULL, NULL, NULL,
INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_NO_CACHE_WRITE,
0);
BOOL fResult = HttpSendRequest(hResourceHandle, NULL, 0, NULL, 0);
if ( fResult == false )
{
cout<<"HttpSendRequest failed!"<<endl;
cout<<"GetLastError(): "<<::GetLastError()<<endl;
}
HttpQueryInfo(hResourceHandle, HTTP_QUERY_FLAG_NUMBER |
HTTP_QUERY_STATUS_CODE, &dwStatus, &dwStatusSize, NULL);
switch (dwStatus)
{
case HTTP_STATUS_PROXY_AUTH_REQ:
case HTTP_STATUS_DENIED:
cout<< "auth failed!"<<endl;
break;
case HTTP_STATUS_OK:
cout<< "auth pass!"<<endl;
break;
default:
cout<< "what happens here?"<<endl;
break;
}
return 0;
}
thanks in advance,
George
|
|
|
|
|
I guess the server says "OK, I heard what you said".
You should better interact with the login server, not with the website.
Greetings from Germany
|
|
|
|
|
Thanks KarstenK,
KarstenK wrote: You should better interact with the login server, not with the website
Could you show me a sample of what do you mean website? I think you mean some .Net passport protected web site? Confused. A sample would be clear.
regards,
George
|
|
|
|
|
I am using directsound to do sound recording - everything works fine.
"I have loop and event signals my to read (save buffer)
..regular way how to do capture (taken from the sample)
But:
It runs all day long, day after day (continous) but sometime happen, "there is no data"
(it happened ones after month of working and so it is hard to set it up for debug)
Probably:
1) there is event but buffer size is zero
2) or there is no event at all
When this happen, it never restore
i have to restart program (probaly close and open device again will be enough)
Any idea how this could happen?
Thank you lot
viliam
|
|
|
|
|
viliam wrote: (it happened ones after month of working and so it is hard to set it up for debug)
Your application is stunningly stable, even more stable than its OS.
Are you crying for the moon, aren't you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can you use the process dumper utility and set it up in a way to create a dump of your exe when it crashes...
The dump information can help in debugging. Also see and read userdump[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
It happened ones and it was not on my computer.
"I know just symtoms"
Actualy program did not crash, it pretend recording but
there was no data comming and so empty file was created.
When people looked into directory, and there were just empty
files they realize something is wrong with my program.
They just stopped it and start again and it works again correctly.
viliam
|
|
|
|
|
Can you use of MCI_RECORD?
|
|
|
|
|
Hey,
Okay, bear with me. I'm not sure if what I want to do is called "framing" but that is what I will refer to it as. Most windows in Microsoft Windows have a frame, the frame (usually) has three buttons, minimize, maximize/restore down and exit. If you click 'restore down' the window has a complete frame and can be moved by dragging the mouse. I want to be able to create a frame around a window that I resize, please note that I need to do this from a dll that I inject into a process; my code doesn't create the original window.
Below is an image of what I want to do, I really hope you understand
http://img389.imageshack.us/my.php?image=frameui4.png[^]
I'd really appreciate some help with this, I can't seem to get it working :\
Thanks for your time
modified on Thursday, October 16, 2008 4:56 AM
|
|
|
|
|
Maybe you could use SetWindowsLong + SetWindowPos (with SWP_FRAMECHANGED flag enabled).
Look:
SWP_FRAMECHANGED
Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
http://msdn.microsoft.com/en-us/library/ms633545.aspx
|
|
|
|
|
I want Copying the Data from an ASCII Text File on a PC Back to an Operating System Spooled File for Iseries don't use ftp.
thanks very much.
|
|
|
|
|
Please be wait till you get the response.
Do not repost the questions. It will not help you getting answers.
Also read posting guidelines before posting. Be specific about your problem.
I also see that you have posted same question in C++/CLI forum. Please do not cross post.
Regards,
Sandip.
|
|
|
|
|
But I cant wait I need to answer urgent. 
|
|
|
|
|
I want Copying the Data from an ASCII Text File on a PC Back to an Operating System Spooled File for Iseries don't use ftp.
thanks very much.
|
|
|
|
|
Hi,
I want to monitor network traffic of LAN.
Basically, my current application is continously transferring data from one computer to another on LAN. Currently i have fixed the tranfer rate i.e. in my application i have mentioned tranfer rate of 32 KB.
Now i am planning to optimize my application by changing tranfer rate dynamically.
That is, i'll calculate bandwidth of LAN and depending upon the availability i'll send data.
Please help
Thanks in Advance!!
Regards,
Tony
|
|
|
|
|
Check here[^]and here[^]
I hope it helps.
I got these using CP search ,there are few more.
Regards,
Sandip.
|
|
|
|
|
Thanks for the help but these articles explains about monitoring bandwidth of internet whereas i want for LAN.
Also i tried googling for this topic but was not successful enough.
|
|
|
|
|
What do you mean by "calculate bandwidth of LAN"?
Available bandwidth is always changing.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yeah thats what Bandwidth is always changing.
So i need to know the Bandwidth of a LAN everytime i send data.
|
|
|
|
|
You'd need to add something to your protocol so one or both
endpoints monitor throughput and adjust accordingly.
You have the data you need - time and number of bytes sent/received.
Maybe look up "network bandwidth throttling" for algorithms to interpret
that data.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
before sending info for printing using CPrintDialog how to check whether selected printer(using printer dialog) is ready to print(attached to server) .
i m using following code for printdialog call and getting selected printer name but unable to check status of selected print is there some method ??
bool bNewDlg = true;
if (m_printDlg == NULL)
{
m_printDlg = new CPrintDialog(FALSE,PD_DISABLEPRINTTOFILE);
bNewDlg = false;
}
ASSERT(m_printDlg != NULL);
if (PrinterName == NULL) {
if (m_printDlg->DoModal() == IDCANCEL) return (-1);
m_hprinter = m_printDlg->GetPrinterDC();
CString cs;
cs= m_printDlg->GetDeviceName();
m_hprinter=m_printDlg->GetPrinterDC();
if(m_hprinter==NULL)
return;
m_numCopies = m_printDlg->GetCopies ();
|
|
|
|
|
What about calling GetPrinter(hPrinter, 2, ...) ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
I am creating Win32 application in which i need to create an account with administative privileges. I am able to create an account with normal user rights.
But when i tried to create an account with administative privileges, it is giving error. So can't I create an account with admin rights directly??
Please help me out in this scenario. Any help would be greatly appreciated.
Thanks
Hemang
|
|
|
|
|
Hemang Raval wrote: it is giving error.
Don't you think that this is very vague? Are we supposed to guess the error?
Please read and understand the guidelines[^] and keep your posts in accordance. Especially, look at the 2nd and 4th points.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
I apologize for such a vague post. I had tried to make it brief but was
brief more than necessary.
BTW i got solution for my previous vague post.
My next problem is to change right of current user from administrator to limited user account . That is, i want to make current user from admin to limited account. I tried to do this with NetUserSetinfo(). But it is not working for my case.
Hope for positive reply.
Thanks,
Hemang
|
|
|
|