|
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.
|
|
|
|
|
|
You may use IsWindowVisible( )
MyDlg DlgObj; // Your Dialog object
if( !DLgObj.IsWindowVisible( ))
{
AfxMessageBox( "Dialog is hidden" )
}
else
{
AfxMessageBox( "Dialog is shown" )
}
Rinu Raj
|
|
|
|
|
Yanshof wrote: 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.
Loop through child windows of the dialog, use GetWindow and GetNextWindow for this purpose and test to see if this is a dialog window or not.
Or use EnumChildWindows .
|
|
|
|
|
Yanshof wrote: ...i have some dialog that have time out to close ( after X second this dialog is close )...
Have you consulted this article?
"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
|
|
|
|
|
Hello!! i want to know whether inp() and outp() fnction work on Windows98?? if no, then can i know if there are any alternatives to these functions that can be used for programming in windows98?? Thanks...
vijay.
|
|
|
|
|
these are compatible with WIN95 ... and I think should work on WIN98.
The answer is Good!
|
|
|
|
|
Hello sir!! Thanks for replying. but are u sure that they will work. even i believed they will work. but they are not working. so i just want to confirm whether they will work on Windows98.
vijay.
|
|
|
|
|
No Sir! these functions are just Compatible with WIN95 (I saw in MSDN-April 2005)
|
|
|
|
|
aroli vijay wrote: so i just want to confirm whether they will work on Windows98.
According to MSDN, they are compatible with Windows 98 et al.
"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
|
|
|
|
|
If you are writing to and reading from an external port such as COM1, COM2, LPT1 etc. the better alternative is to use the CreateFile, WriteFile, ReadFile Windows API functions. However, i think that Windows does not allow low-level access to ports in user mode(surely true on NT systems). Then you will have to switch to kernel-mode or another tool.
|
|
|
|
|
i was trying to read a sector of data from the Hard disk using the base address of the Hard disk controller. i am not able to read data from the hard disk. i was using inp() and outp() functions. they dont seem to work in windows98. can u please suggest me any alternatives?? thanks..
vijay.
|
|
|
|
|
I guess you are trying to access a crashed hard disk. Anyway, to my knowledge, if you're trying to run the program in a Windows platform, the OS will deny this operation (An error will pop-up). If you just want to run the program in Windows, you would need to work on kernel-mode programming, a rather cumbersome work . Try booting your PC with DOS only, your program should run..!
|
|
|
|
|
hello sir!! thanks for the information. yes, i am trying to acces a disk and yes, my code works fine in DOS environment. but i want to write the code that does the same work, but in a windows98 enviroment (not in windows XP/NT/2000). i am ready to do the Kernel-mode programming. can u please suggest me what to do?? how should i start and how to proceed?? and hey, i just now read that _outp(), _inp()are compatible with windows 98.. check out the following link..
http://msdn2.microsoft.com/en-us/library/733szwah.aspx[^]
-- modified at 9:20 Thursday 21st September, 2006
vijay.
|
|
|
|