|
See here[^] maybe it is some helpful to you
|
|
|
|
|
I didnt find any useful info there
|
|
|
|
|
Is there any equivalent to sprintf() & co. for STL-Strings ? I really don't want to use a buffer to work around that.
|
|
|
|
|
For anyone who is interested, i found a good way. I use an ostringstream object to write my formated data to via standard stream operators. Then i use it's member function str() to return me a basic_string :
<br />
string teststring;<br />
ostringstream teststream;<br />
unsigned int testnumber = 1234;<br />
<br />
teststream << "The Number is " << testnumber << " !!!!" << endl;<br />
<br />
teststring = teststream.str();<br />
<br />
cout << teststring;<br />
|
|
|
|
|
Check out the Boost[^] library - it includes an excellent formatting class called boost::format .
Kicking squealing Gucci little piggy.
|
|
|
|
|
hi,
I am using keyboard to simulate mouse
GetCursorPos
SetCursorPos
function, and I'd like to ask
how can I simulate Click
(even into window doesn't belonging to my process)
thank you
Viliam
viliam
|
|
|
|
|
SendMessage - you can send the click messages to the window.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thankx I'll try
do you know how to find windows handle for current mouse position
(to send message to)
thank you
viliam
|
|
|
|
|
|
viliam wrote: how can I simulate Click
(even into window doesn't belonging to my process)
thank you
Viliam
Use SendInput .
|
|
|
|
|
For converting 'LPTSTR' to 'wchar_t *', we can use '_T()', Example :
MessageBox(_T("Some UniCode characters"));
Is there another way ? ... because I have wrote a long code and adding _T() to all strings is a little difficult!
Thanks.
|
|
|
|
|
Mohammad Rastkar wrote: For converting 'LPTSTR' to 'wchar_t *', we can use '_T()', Example :
MessageBox(_T("Some UniCode characters"));
Is there another way ? ... because I have wrote a long code and adding _T() to all strings is a little difficult!
Just add an L before the string. But then this is hard coding, and will cause problems in ANSI builds. It won't cause any problem if you are assigning directly to a LPCWSTR etc, but will cause problems if you are trying to use TCHAR versions like LPCTSTR .
For eg:
LPC<code>W</code>STR pBlahString = <code>L</code>"Blah Long string Blah Long string Blah Long string Blah Long string Blah Long string
Blah Long string Blah Long string Blah Long string Blah Long string Blah Long string Blah Long string Blah Long string
Blah Long string Blah Long string Blah Long string Blah Long string Blah Long string";
|
|
|
|
|
I just want get rid of adding _T() or L .
It's the importatnt part!
Thanks
|
|
|
|
|
Mohammad Rastkar wrote: I want to get rid of adding _T() or L ... its the important part!
That's mandatory!!
But still if you insist you can use CString .
CString strUnicode = "A string"; Internally CString does convert it to appropriate type. This depends on whether _UNICODE is defined or not.
|
|
|
|
|
No, there is no magic way to tell the compiler to make all ANSI strings Unicode, which is what you're asking for. The best solution I can think of is a regex search and replace across your code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: I can think of is a regex search and replace across your code.
Ooops I got his question wrong!!
|
|
|
|
|
As far as I know adding an L infront of a quoted string is the only way of letting MSVC know it's supposed to be a wide char string...so i guess you'll have to add the L's or enclose with_T()'s
why dont you use the find and replace option in Visual Studio...using regular expressions you can replace all quoted string with their _T counter parts....
ie. Ctrl+H(replace dlg),
in Find what field enter: :q for VS .Net, \:q for VC6
in Replace with field enter: _T(\0)
ofcourse this means that all quoted strings found in the search domain will be enclosed with _T(), so you should be carfeful you don't apply this on resource files or manifest files etc....
another side affect would be that #include "File.h" will become #include _T("File.h")...you can remove those _T's yourself, or you can write another regular expression to remove _Ts form include files if they are too many...
|
|
|
|
|
How can i restrict resizing of my application at run time?
|
|
|
|
|
kiranin wrote: How can i restrict resizing of my application at run time?
Handle WM_GETMINMAXINFO .
|
|
|
|
|
This work only when we using maximize button,
but what am i asking is when we r about to change the size with the mouse
by dragging........ at that situation it is to be fixed
|
|
|
|
|
kiranin wrote: This work only when we using maximize button,
but what am i asking is when we r about to change the size with the mouse
by dragging........ at that situation it is to be fixed
I don't know why you say this... It's working perfectly here though...
LRESULT CResizeDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if( message == WM_GETMINMAXINFO )
{
LPMINMAXINFO lpMM = ( LPMINMAXINFO )lParam;
<code>lpMM->ptMinTrackSize.x = 200;
lpMM->ptMinTrackSize.y = 200;
return 0;
}
return CDialog::WindowProc(message, wParam, lParam);
}
|
|
|
|
|
|
while reciving data and printing it in edit box i need to write it in txt file but only few fields not all can you help me to do that..
Code i am using for .txt file and printnig data in edit box.
I have made the comment line before the code to be correct.
<br />
void CWartz_newDlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp) <br />
{<br />
<br />
CString csMarket="EURUSD";<br />
CString usMarket ="USDJPY";<br />
CString gbMarket="GBPUSD" ;<br />
<br />
sessionid=SessionId;<br />
CurrentRequestId=RequestId;<br />
CString MarketSt,a,b,c,d;<br />
<br />
a.Format("%d",MarketNo);<br />
b.Format("%c",BidDirection);<br />
c.Format("%c",AskDirection);<br />
d.Format("%d",MarketState);<br />
<br />
<br />
<br />
<br />
m_MainEdit=m_MainEdit + SessionId + RequestId + a ; <br />
m_MainEdit=m_MainEdit + Market + Bid + b +Ask + c + High ;<br />
m_MainEdit=m_MainEdit + Low + d +"\t" + Timestamp + "\r\n";<br />
<br />
UpdateData(FALSE);<br />
iLineCount=m_EditCtrl.GetLineCount();<br />
m_EditCtrl.LineScroll(iLineCount);<br />
<br />
<br />
if(csMarket== Market)
{<br />
myfile.Open("EurUsd.txt",CFile.modeCreate | CFile.modeWrite);<br />
myfile.SeekToEnd();<br />
myfile.Write((LPCTSTR)m_MainEdit,m_MainEdit.GetLength()*sizeof(TCHAR));<br />
myfile.Close();<br />
<br />
}<br />
<br />
else if(usMarket == Market)<br />
{<br />
myfile.Open("UsdJpy.txt",CFile.modeCreate | CFile.modeWrite);<br />
LPSTR buf1;<br />
int i = m_MainEdit.GetLength();<br />
buf1 = m_MainEdit.GetBuffer(i);<br />
myfile.Write(buf1,i);<br />
myfile.Close();<br />
}<br />
<br />
else if(gbMarket == Market)<br />
{<br />
myfile.Open("GbpUsd.txt",CFile.modeCreate | CFile.modeWrite);<br />
LPSTR buf2;<br />
int i = m_MainEdit.GetLength();<br />
buf2 = m_MainEdit.GetBuffer(i);<br />
myfile.Write(buf2,i);<br />
myfile.Close();<br />
<br />
}<br />
}<br />
<br />
-- modified at 1:18 Thursday 21st September, 2006
|
|
|
|
|
abrakadbra wrote: // THIS ARE THE FIELD RECIVING FROM REMOTE SERVER
// And I need only 4 fields to save on txt file according to market like //Market,Bid,High,Low,
m_MainEdit=m_MainEdit + SessionId + RequestId + a ;
m_MainEdit=m_MainEdit + Market + Bid + b +Ask + c + High ;
m_MainEdit=m_MainEdit + Low + d +"\t" + Timestamp + "\r\n";
So only assign those four to m_MainEdit . What's so hard about that? If you need m_MainEdit in some other spot with all of the fields, just create another variable.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All
I write some application, and in some place in the code i need to know if some specific window dialog is open.
I will explain ... i have some dialog that have time out to close ( after X second this dialog is close ) my question is ... how can i know by know the dialog ID or dialog class variable if the current window is open/show of hide ?
Thanks for any help.
|
|
|
|