|
In addition to David's reply....
Why all the casts of a variable to its same type? Why initialize pNextInfo?
TCHAR strName[] = _T("\\\\OfficeNet\\TmpDir\\*.*");
WIN32_FIND_DATA NextInfo;
HANDLE hFind = ::FindFirstFile(strName, &NextInfo);
if (INVALID_HANDLE_VALUE != hFind)
{
... succeeded
::FindClose(hFind);
}
else
{
DWORD dwErrCode = ::GetLastError();
...
}
-- modified at 11:20 Tuesday 5th June, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
libpath can relative path or absulute path
|
|
|
|
|
|
|
Ok, so I got an example and it's working, but have no idea how it's working.
Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
I've got one question using the WebBrowserControl.
In my app a self refreshing website http://www.forexpf.ru/quote_show.php[^] is loaded in a webbrowser-control. The text content of the site is captured by QueryInterface() into a String to parse some data. This works fine, but ...
On the website there is a list box and an button at the bottom, from which you can choose the interval for automatic refreshing the site. On initial loading 1min is chosen, but I want to change this to the shortest value (30sec). All the stuff is hidden, so the input should come from code (maybe via QueryInterface?).
Are there any ideas to grab the list-control and the button and change the value?
Here are the sample code for grabbing the content:
- simple MFC-Dialog
- one Webbrowser control (m_WebBrowserCtrl)
- website is loaded and refreshed by button click
- by clicking on a button the content of the site (plain text, not the html source) is copied into a CString variable to parse the data.
<br />
void CWebbrowser_TestDlg::OnCopy() <br />
{<br />
IHTMLDocument2* m_pHTMLDocument2;<br />
LPDISPATCH lpDispatch;<br />
lpDispatch = m_WebBrowserCtrl.GetDocument();<br />
HRESULT hr;<br />
if (lpDispatch)<br />
{<br />
hr =<br />
lpDispatch->QueryInterface(IID_IHTMLDocument2,<br />
(LPVOID*)&m_pHTMLDocument2);<br />
lpDispatch->Release();<br />
ASSERT(SUCCEEDED(hr));<br />
}<br />
<br />
CString sText;<br />
IHTMLElement *iSource;<br />
BSTR bstrSource;<br />
<br />
m_pHTMLDocument2->get_body(&iSource);<br />
iSource->get_outerText(&bstrSource);<br />
sText = bstrSource;<br />
MessageBox(sText);<br />
}<br />
TIA and greets
M.
|
|
|
|
|
Hi,
I guess you need to get the element of button and select box
Give an id to the element in the web page
get the document 3 interface
m_pHTMLDocument2->QueryInterface<IHTMLDocument3>(&spHTMLDocument3);
spHTMLDocument3->getElementById(spbstrID, &spHtmlElm);
/* you can also use getElementsByName if you know the element name */
spHtmlElm->QueryInterface<IHTMLButtonElement>(&spBtnElm);
if (spBtnElm)
{
spBtnElm->put_value(spBSTRValue);
}
For list element you need to create option element to add an list item.
Best Regards
Raj
|
|
|
|
|
I just strarted like 2 days ago so Im a compltete newb. But here is my problem, when I compile it always gives me an error "Misplaced else" I just dont have a clue how it is misplaced?? could you also tell me why this happens?
here is the code::
#include <iostream.h>
int main()
{
int one = 3, two = 4;
if (one < two)
two = one;
cout << "successful change\n";
else
cout << "failed..\n";
return 0;
}
|
|
|
|
|
int main()
{
int one = 3, two = 4;
if (one < two){
two = one;
cout << "successful change\n";
}
else
cout << "failed..\n";
return 0;
}
The format for using if() else () is
if(condition)
{
// Do something
}
else
{
// Do something else
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Between if and else must be only 1 statement. You can include multiple statement inside a {//multiple statements here} block. For instance:
if (one < two)
{
two = one;
cout << "successful change\n";
}
else
cout << "failed..\n";
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.
|
|
|
|
|
Whats happenning with this code
if (one < two)
{
two = one;
cout << "successful change\n";
}
else
cout << "failed..\n";</blockquote>
|
|
|
|
|
If statement contains more than one statement. You will have to use curly bracket.
#include
int main()
{
int one = 3, two = 4;
if (one < two)
{
two = one;
cout << "successful change\n";
}
else
cout << "failed..\n";
return 0;
}
Manish
|
|
|
|
|
its a test someone gave me, I was supposed to make a code that would make a bigger number into the smaller number... silly thing..
|
|
|
|
|
thanks guys, you solved the problom
|
|
|
|
|
Hi my program will create some text files at runtime. this should not be edited by the user. what i have to do?
|
|
|
|
|
SetFileAttributes( FileName, attrib)
|
|
|
|
|
saisp wrote: Hi my program will create some text files at runtime. this should not be edited by the user. what i have to do?
Probably the above has nothing to do with the title of you post.
If you don't want to allow access to your files, then create those files without allowing sharing. If you really need to make the files hidden, then use FILE_ATTRIBUTE_HIDDEN in the creation flags.
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.
|
|
|
|
|
Please Clear Whether created file is not edited at runtime by user.
If yes, Create it in exclusive mode.
Manish Rastogi
|
|
|
|
|
user should not delete or edit those files at any time.
|
|
|
|
|
It sounds like you need to deny access via an ACL. Simply hiding the file or making it read-only is easily thwarted.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I too have a same issue . . . didnt find a solution yet
Proud To Be an Indian
|
|
|
|
|
Hi All,
I like to enumerate printer jobs, but EnumJobs return correct information about jobs on local printer, but it always returns 0 for Number of jobs (the last parameter of EnumJobs 'LPDWORD pcReturned') when I call it for network printers.
Thanks!
|
|
|
|
|
How about the GetPrinter() function with level 2?
|
|
|
|