我准备通过程序在一个新的IE窗口内打开一个网址,想先设一个临时Cookie,不知道怎么实现,那位大侠能帮忙提供一些资料?
解决方案 »
- 不想回帖,发帖散点分吧
- rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen +file path
- 今天登陆的验证码怎么老是‘11111’啊·····【散分】
- 急问一个简单的CWnd的MoveWindow问题
- 是否可以通过拦截消息来获知某窗口程序启动?
- 有关CMPP的实现与模拟网关
- 如何使一個對話框應用程序不會在任務欄上顯示?
- 请教高手:如何最小化除某一窗口的其它所有窗口?
- 请问一个简单的问题,如何让一个EDIT控件不显示光标?
- 谁知道DB_Library中dbbind(...)的用法?
- 如何手工往DataGrid控件中填数据?
- 怎么样使自己创建的控件显示3D模式??而我的都是平面呢!!
InternetSetCookie is used to set a cookie on the specified URL. InternetSetCookie can create both persistent and session cookies.Persistent cookies are cookies that have an expiration date. These cookies are stored in the Windows\System directory.Session cookies are stored in memory and can be accessed only by the process that created them.The data for the cookie should be in the format:NAME=VALUE
For the expiration date, the format must be:DAY, DD-MMM-YYYY HH:MM:SS GMT
DAY is the three-letter abbreviation for the day of the week, DD is the day of the month, MMM is the three-letter abbreviation for the month, YYYY is the year, and HH:MM:SS is the time of the day in military time.The following example demonstrates two calls to InternetSetCookie. The first call creates a session cookie and the second creates a persistent cookie.BOOL bReturn;// Create a session cookie.
bReturn = InternetSetCookie("http://www.adventure_works.com", NULL,
"TestData = Test");
// Create a persistent cookie.
bReturn = InternetSetCookie("http://www.adventure_works.com", NULL,
"TestData = Test; expires = Sat, 01-Jan-2000 00:00:00 GMT");
我需要的是点一下一个Button,程序弹出一个网页(比如使用ShellExecute),网页打开一个网址,而不是用程序去读网页数据
InternetSetCookie(_T("http://server"), NULL, _T("userid=2"));
ShellExecute(hWnd, _T("open"), LinkUrl, NULL, NULL, SW_SHOWNORMAL);
还是没有用
" 是因为第一个参数与ShellExecute中的LinkUrl不匹配造成的.
根据laiyiling转MSDN的原话来看:
ShellExecute执行后是创建新的process,但是Session cookies are stored in memory and can be accessed only by the process that created them.