|
I know nothing here -- but this seems like the kind of thing you shouldn't be able to do. Actual handles should be private to the application, unless they make em global?
[just speaking out of my butt -- sorry]
|
|
|
|
|
Some handles in windows are global to the OS, like mutexes, thread and process handles.
Ceri
|
|
|
|
|
Hi,
I try to get data from a password protected webpage and need a little help.
At first I want to describe the situation in the browser.
When I call the webpage, I got a page with a little login screen. This is realized by some javascript code. I fill in the username and password, click on 'login' and voila, there are my wanted data.
I looked at the javascript code an noticed the names of the fields. I tried to call the webpage directly with:
http://<address>?<NameOfUserField>=<username>&<NameOfPasswordField>=<password>&action=<actionname>
... and it works fine. Now I had to do the same in my MFC-Projekt but I failed. I was unsuccessful with the following two attempts
#################
## First Attempt
#################
********************************************************************************************************
...
CInternetsession InternetSession(_T("AppName"),1, INTERNET_OPEN_TYPE_PRECONFIG);
char Url = "<address>?<NameOfUserField>=<username>&<NameOfPasswordField>=<password>&action=<actionname>";
CString strServerName; // Server
CString strObject; // directory
INTERNET_PORT nPort; // port
DWORD dwServiceType; // accesstype
AfxParseURL(Url, dwServiceType, strServerName, strObject, nPort)
DWORD dwHttpRequestFlags = INTERNET_FLAG_RELOAD;
CHttpFile *pHttpFile = pHttpConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,// or HTTP_VERB_POST
strObject, NULL, 1, NULL, NULL,
dwHttpRequestFlags);
pHttpFile->SendRequest();
CString sz;
while (pHttpFile->ReadString(sz)){
...
}
********************************************************************************************************
#################
## Second Attempt
#################
...
CInternetsession InternetSession(_T("AppName"),1, INTERNET_OPEN_TYPE_PRECONFIG);
char Url = "<Only_Address_without_parameter>";
CString strServerName; // Server
CString strObject; // directory
INTERNET_PORT nPort; // port
DWORD dwServiceType; // accesstype
AfxParseURL(Url, dwServiceType, strServerName, strObject, nPort)
DWORD dwHttpRequestFlags = INTERNET_FLAG_RELOAD;
CHttpFile *pHttpFile = pHttpConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,// or HTTP_VERB_POST
strObject, NULL, 1, NULL, NULL,
dwHttpRequestFlags);
CString szHeader = _T("<NameOfUserField>=<username>&<NameOfPasswordField>=<password>&action=<actionname>");
pHttpFile->AddRequestHeaders(szHeader);
pHttpFile->SendRequest();
CString sz;
while (pHttpFile->ReadString(sz)){
...
}
********************************************************************************************************
Any Idea's?
ciao
Norbert
|
|
|
|
|
hi,
i am trying to save a CString to a file. I'm doing this like this:
<br />
CStdioFile cfFile(strPath, CFile::modeCreate | CFile::modeReadWrite | CFile::shareDenyNone);<br />
CArchive ar(&cfFile, CArchive::store);<br />
<br />
cfFile.WriteString(strContents);<br />
<br />
ar.Close();<br />
<br />
cfFile.Close();<br />
This works, but it always places weird characters after the end of the contents of the string.
I'm deleting the file first before saving it, and I know the contents of the CString are correct. Any ideas?
thanks
|
|
|
|
|
Berkut wrote:
This works, but it always places weird characters after the end of the contents of the string.
How do you know the "writing" code is faulty? What are you using to verify the weird characters?
|
|
|
|
|
Berkut wrote:
always places weird characters after the end of the contents of the string.
Of course it will place wierd characters at the end of the string because you used CArchive. CArchive will insert its own codes. Remove the stuff for CArchive and you should be ok. Also check the documentation because I beleive the file may also be stored as binary and not text.
John
|
|
|
|
|
CArchive is an object-store -- not a text file.... it seems to be storing the CString "object", not the string....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Peter Weyzen
Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)
|
|
|
|
|
Hi
I'm now creating some OfficeXP-like menus, but I don't know how to get such system colors. Any suggestions.
P. S. By the way, where can I look at Office 2003 interface.
|
|
|
|
|
Try taking a look at all the menu articles at code project one of them sould have implemented what you are looking for.
Trust in the code Luke. Yea right!
|
|
|
|
|
Hi All
i have the following bit of code where im inserting a record into a table,
the record gets insterted ok, but i get a runtime error
saying "Operation is not allowed when the object is closed" on the line cpSet->Close();
please help
thanks, si
CString strSQL;
strSQL.Format("insert into new_call_message(school_id,unique_number,custom,type) values(4055,77866,1,'customeee')");
_variant_t vstrSQL;
vstrSQL.ChangeType(VT_BSTR);
vstrSQL = strSQL;
cpSet.CreateInstance(__uuidof(Recordset));
cpSet->Open(vstrSQL,cpDb.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
cpSet->Close();
|
|
|
|
|
You don't want to open a record set for this call. See the following code:
_ConnectionPtr pCon;<br />
<br />
_RecordsetPtr pRecordset;<br />
pCon = m_pConnection ;
<br />
<br />
basic_stringstream<wchar_t> strSQLStatement;<br />
variant_t vntRecordAffected;<br />
<br />
strSQLStatement <<L"INSERT INTO Access(Name, HTML) VALUES('myName', 'myHTML' ) ";<br />
bstr_t strSQLstmt = strSQLStatement.str().c_str();<br />
<br />
try<br />
{<br />
pCon->Execute(strSQLstmt, &vntRecordAffected, adCmdText );<br />
}<br />
catch( _com_error &e)<br />
{<br />
_bstr_t bstrSource(e.Source());<br />
_bstr_t bstrDescription(e.Description());<br />
TRACE("%s", e.ErrorMessage());<br />
}<br />
catch(...)<br />
{<br />
TRACE("*** UNHANDELED EXCEPTION ***");<br />
}
|
|
|
|
|
Hi John,
thanks for that,
im a bit confussed on how u have declare m_pConnection
in the header file
thanks in advance
si
|
|
|
|
|
si_69 wrote:
im a bit confussed on how u have declare m_pConnection
That was an example I took from another site. Just use cpDb instead.
John
|
|
|
|
|
John M. Drescher wrote:
That was an example I took from another site. Just use cpDb instead.
hi john
i have the following code now, but im getting an undeclared
identifier on m_pConnection. i know i have to declare
this but as what ? help as u have probably gathered my c++ is pants
thanks
simon
_ConnectionPtr cpDb; // is declared in my header file
cpDb = m_pConnection ;
basic_stringstream strSQLStatement;
variant_t vntRecordAffected;
strSQLStatement <<l"insert into="" new_call_message(school_id,unique_number,custom,type)="" values(4055,77866,1,'customeee')="" ";
bstr_t="" strsqlstmt="strSQLStatement.str().c_str();
try
{
cpDb-">Execute(strSQLstmt, &vntRecordAffected, adCmdText );
}
catch(_com_error &e)
{
GenerateError(e.Error(), e.Description());
}
|
|
|
|
|
Remove the following line:
cpDb = m_pConnection ;
m_pConnection was a _ConnectionPtr declared in their header file.
John
|
|
|
|
|
I've read some articles about how to write Explorer Bars. They are interesting, but if the bar cannot exchange with other parts of the Explorer, it is hardly of any use, I think.
For example, I want my bar to catch the events when user has selected files in explorer's right pane, then show some information and display common tasks which can be performed on such files. But how can I? None of the articles told me. I also want that the right pane can navigate to special folder I prefered.
I know that there is an IShellView::SelectItem method, but I don't know how can I hook into it. Or should I go another way?
|
|
|
|
|
Read Shell Programming by Mike Dunn, that's the beginning of your answer.
~RaGE();
|
|
|
|
|
I have read these ones, since they are knowleages that I should master. but I could not find exactly what I want
|
|
|
|
|
Hi,
My VC6 plugin needs to output some text to the build pane. Is this possible?(IApplication.PrintToOutputWindow only goes to a macro-specific page).
TIA
Peter
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
MDI with multiple views and one document
I have an MDI application with one document and one view.
I would like to create multiple instances from the same document class whereas any documents have the one view and any documents have the other view.
So i have made several View-classes and have created several document templates with the following code:
<br />
CMultiDocTemplate* pDocTemplate;<br />
pDocTemplate = new CMultiDocTemplate(<br />
IDR_MDITYPE,<br />
RUNTIME_CLASS(CMDIDoc),<br />
RUNTIME_CLASS(CChildFrame), <br />
RUNTIME_CLASS(MDIView ));<br />
AddDocTemplate(pDocTemplate);<br />
<br />
pDocTemplate = new CMultiDocTemplate(<br />
IDR_MDITYPE,<br />
RUNTIME_CLASS(CMDIDoc),<br />
RUNTIME_CLASS(CChildFrame) <br />
RUNTIME_CLASS(CMDIView2));<br />
AddDocTemplate(pDocTemplate);<br />
The difference between the doc templates are only the View-classes.
When i choose the open-file command from the file menu, the icon for the file-type is not the icon defined by IDR_MDITYPE but the icon with the next greater ID. (also at Explorer)
I have solved this problem by creating a icon which looks like the IDR_MDITYPE icon and which has the next greater ID. But this solution seems me to tricky. Does anybody know another one?
Thanks
Andy
|
|
|
|
|
I have a dialog box with a property sheet and 2 property pages. In my property page I have a button. When I push this button, I want to show a dialof. But the call to CreateDialogIndirect during the domodal doesn't return and my app is blocked. Any ideas ?
|
|
|
|
|
CHAIGNEAU wrote:
doesn't return
What do you mean ? Is the dialog box displayed ? How do you dismiss it ? Or does your program hang when doing the CreateDialogIndirect ? If yes, is it working if you use DoModal() isntead of starting it with CreateDialogIndirect() ?
~RaGE();
|
|
|
|
|
If your app hangs, maybe you have forgotten to use ShowWindow(SW_SHOW); to show your dialog, since this is not automatically done by the CreateDialogIndirect() function.
~RaGE();
|
|
|
|
|
I instantiate a dialog and then call domodal.
Domodal call CreateDialogIndirect() and my program hang.
I have found the reason : I must modify the ex style of my propertysheet to put WS_EX_CONTROLPARENT.
I have found in the MSDN an article wich describe this problem.
Thanx to all.
|
|
|
|
|
I have a problem using COXSizeControlBar from Dundas Ultimate Toolbox 7.5. I have a COX3DTabViewContainer object inside a class derived from COXSizeControlBar. The tab control has two tabs and in one tab there is a COXShorcutBar object, in the other tab there is a CTreeControl object. The problem is that when I use message handlers inside the class derived from COXSizeControlBar, the message handler gets called and processed but when the message returns to the control that originated the message (e.g. the tree control) the return value is always 0 (the value pointed by the LRESULT parameter of the message handler) even if I change the value in the message handler. It is not possible for me then to cancel the editing of a tree control item label (for instance). Have anybody found this problem yet? I have modified and example from Dundas which exactly does this and IT DOES NOT WORK? I guess it is a problem either with the message routing of the COXSizeControlBar or the COX3DTabViewContainer but I haven't been able to find it yet?
Thanks in advance,
Miguel
|
|
|
|