|
I am using Smart device application & MFC option in VS2005 I want to shut down the PC programatically.
how to do that?
thanks
|
|
|
|
|
|
You just beat me to it.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
«_Superman_» wrote: You just beat me to it.
I had two RedBulls for lunch
|
|
|
|
|
I tried both the functions but they are not working for Smart device application.
thanks
|
|
|
|
|
saksp wrote: they are not working for Smart device application
Try this piece of code; MSDN Link[^]
keybd_event(VK_OFF,0,KEYEVENTF_SILENT,0);
keybd_event(VK_OFF,0,KEYEVENTF_SILENT | KEYEVENTF_KEYUP,0);
sleep(60);
|
|
|
|
|
|
Hi all,
I have CWebBrowser wrapper for IWebBrowser2 class. i use it to run flash and static images.
Problem is sometimes my application crashes because of certain flash that is running inside the web browser. (i can not tell which flash causes this).
i have several computers which has visual studio debugger, so after this crash i see the debugger dialog...
someone has suggested the problem is permission...but i am not sure...
is there a way to catch or neutralizer the crash via IWebBrowser2?
thanks for any thoughts or solutions
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
YaronNir wrote: is there a way to catch or neutralizer the crash via IWebBrowser2?
Did you tried catch(...) ?
Then NO.
|
|
|
|
|
of course
is there a way to catch the error from the IHTmlDocument or something like that?
thanks
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
i saw something on MSDN:
http://support.microsoft.com/kb/317024[^]
but the question is if the page creates iframe within iframe within iframe (which is out of my control) and i place on error at the top of the html (not the inner iframe) will it be caught?
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Hi Guys,
I want to write an function which will accept an file name(along with complete path), append an prefix to it (say Admin to the file name from c:\Sample\sam.txt to c:\Sample\Adminsam.txt). I have written an function via character array manipulation and given below.
<br />
#define ADMIN_PREFIX _T("Admin")<br />
static void RenameToAdminFile(LPCTSTR szFilePath, LPTSTR szAdminFilePath)<br />
{<br />
TCHAR szTempFilePath[MAX_PATH] = _T(""), *pCh;<br />
TCHAR szFileName[MAX_PATH] = _T("");<br />
_tcscpy(szTempFilePath, szFilePath);<br />
bool bValidPath = false;<br />
<br />
if (pCh = _tcsrchr( szTempFilePath, _T('\\')))<br />
{<br />
pCh++;
_tcscpy(szFileName, pCh);<br />
*pCh = _T('\0');<br />
bValidPath = true;<br />
}<br />
else<br />
{<br />
if (pCh = _tcsrchr( szTempFilePath, _T(':')))<br />
{<br />
pCh++;
_tcscpy(szFileName, pCh);<br />
*pCh = _T('\0');<br />
_tcscat(szTempFilePath, _T("\\"));<br />
bValidPath = true;<br />
}<br />
else<br />
{<br />
*szTempFilePath=_T('\0');<br />
}<br />
}<br />
if(bValidPath)<br />
{<br />
TCHAR szTempAdminFileName[MAX_PATH] = ADMIN_PREFIX;<br />
_tcscat(szTempAdminFileName, szFileName);<br />
_tcscat(szTempFilePath, szTempAdminFileName);<br />
}<br />
_tcscpy(szAdminFilePath, szTempFilePath);<br />
return;<br />
}
Are there any STL API's (Not CString methods)that I could use to achieve the same? An code snippet will be of great help.
|
|
|
|
|
Use _tsplitpath to separate the drive letter, folder name, file name and extension into separate variables.
Now you can change the filename by attaching "Admin" into another buffer using _tcscpy_s and _tcscat_s and then stitch the full path back together using _stprintf_s .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for the Info.
Yes. You can use _wsplitpath to split the file path into Drive letters, directory, filename, and file extension and now you can do any manipulation with any of the individual members like appending the file name with an string.
Now you can put individual file info togather using the api _makepath.
|
|
|
|
|
Good spot - wasn't aware of that one. There is now a 'safe' version of that[^] that MS propose you use instead...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
std::string RenameToAdminFile(std::string const& file)
{
std::string::size_type lastSep = file.find_last_of('\\');
if (lastSep != std::string::npos)
{
return file.substr(0, lastSep+1) + "Admin" + file.substr(lastSep+1);
}
else
{
return "Admin" + file;
}
} ?
Hack-amungous, of course, as it assumes various things. As I suggested to someone else today - Boost.FileSystem[^] is a nice (and cross-platform) path manipulation library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
i try to put some html code with flash content and java script to this control, but this is not shown when i use the function SetDocumentHTML() !!
If i use Navigate the site with the same content is showed exactly!?
Are they any known problems between this control and scripts and flash??
Thanks for any help!!
regards
ternal
|
|
|
|
|
What is the HRESULT value that the function returns?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
the return code is S_OK, and then i try with this very simple code, and the result is the same, nothing is shown!
CString str_html = L"<html><head<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">Hello worls!</body></html>";
HRESULT hres;
if(S_OK != (hres = m_cBrowserDetails.SetDocumentHTML(str_html)))
Sleep(10);
Then i try with COM and SAVEARRAY, but is the same result!
regards
termal
|
|
|
|
|
I'm just guess here, but you could try and switch off edit mode using CHtmlEditCtrlBase::SetDesignMode[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I have a listbox with a set of parameter names retrived from a text file.I need to display the index number for each parameter name which is in the listbox on a messagebox or in a editbox,i.e when I select the item name.It should happen.How can I do that?
|
|
|
|
|
|
In a led-mood, today?
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]
|
|
|
|
|
Cedric Moonen wrote: They hide that information in the documentation[^]
Bastards.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
im using
CDC* pObject;
Crect ButtonRect;
Buttonrect is the rect of the total button....
pObject->DrawText(_T("hi"), ButtonRect, DT_END_ELLIPSIS);
RectText is the rect of the text inside button...
and im using pObject->DrawFocusRect(Recttext);
but the issue is focusrect is drawn along the button edges instead of the text edges...
Please try to help....
|
|
|
|