|
hi i just began with visual c++ and i had programmed in just c++
and there the code was
ofstream output ( c:.....);
output >> int y
but i tried that in visual c++but it didnt work....
This is my code:
void CBr4turboDlg::OnOK()
{
// TODO: Add extra validation here
AfxMessageBox ( "F*** you");
CString szEdit;
m_editText.GetWindowText ( szEdit );
}
I have a member variable in my edit field and i want that 2 write 2 a text file??
|
|
|
|
|
so what's your problem ???
what error does the compiler returns (you said it didn't work...)
please be more explicit, otherwise, you'll stay alone with your empty text file...
TOXCCT alias Nicolas C.
|
|
|
|
|
I have searched every page for a code for writing a variable in a text file
|
|
|
|
|
Emm that was me above
|
|
|
|
|
If you write non-Unicode application, you should use simple
ofstream << (LPCTSTR)strName
With Unicode, it's more complicated, because STL doesn't provide generic text mapping, i.e. TCHAR's, LPCTSTR's etc. You could use your own mapping:
<br />
#if defined(_UNICODE)<br />
#define tstring wstring<br />
#define tofstream wofstream<br />
....<br />
#else<br />
#define tstring string<br />
#define tofstream ofstream<br />
#endif<br />
I use it in many of my apps and it works ok.
Robert-Antonio
"I launched Norton Commander and saw, drive C: on the left, drive C: on the
right...Damn, why I need two drives C:??? So I formatted one..."
|
|
|
|
|
Hi every body!
I have created a global hook function (in Dll) to capture Keyboard events. Every a key has been pressed, the hook function send a user-defined message to my application. My problem is:
My application can only receive the message, when it has focus.
Could you tell me why? And How can I correct it?
Thanks!
//Hook function
static LRESULT CALLBACK KeyboardHook(UINT nCode, WPARAM wParam, LPARAM lParam)
{
if( (nCode >=0) && (nCode == HC_ACTION) && (wParam == VK_SNAPSHOT))
PostMessage(hWndReceiver, UWM_CAPTURED,0,0);
return CallNextHookEx(hookKeyBoard,nCode,wParam,lParam);
}
//Message Map
BEGIN_MESSAGE_MAP(CTestHook, CDialog)
ON_REGISTERED_MESSAGE(UWM_CAPTURED,OnCapture)
//{{AFX_MSG_MAP(CTestDllDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//
afx_msg bool OnCapture(WPARAM wParam, LPARAM lParam);
xyz
|
|
|
|
|
Silly Boy wrote:
My application can only receive the message, when it has focus.
Does that imply that the PostMessage() statement is posting the message regardless of what window has the focus? If not, I'd be curious if any of the three conditions preceding the PostMessage() statement are evaluating to FALSE.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I am using PreCreateWindow in my MDI application and
have noticed that it gets called twice. The first time it gets called, the CREATESTRUCT has nothing in it (e.g. lpszName is null and so are lpszClass). The 2nd time it is called, I see information of my app in the lpszName and lpszClass fields of the CREATESTRUCT. Why is this being called twice (and with one call passing nothing to it?)?
|
|
|
|
|
this is the text from the msdn
The default implementation of this function checks for
a NULL window class name and substitutes an appropriate
default. Override this member function to modify the
CREATESTRUCT structure before the window is created.
and also
By design, these derivations of PreCreateWindow are
not documented
so you too need to check for null and perform any relavant operation.
May be the first call is for you too fill any information i.e if you want to create your own window class, coz if you dont MFC defines it.
then in the next call you are given an option to modify the window style.
Still Alive!!!
Thank you God.
|
|
|
|
|
hi:
as we know ,there are two track modes in the VCD ,the first one is MODE2 FORM1 and the second one is MODE FORM2.
how to read the VCD sectors.
who can help me?
thank you very much.
|
|
|
|
|
Can we overload the function operator () - Curly brackets ?
If yes then what would be the syntax for this.
|
|
|
|
|
int operator()(int i1, int i2)
{
return ;
}
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Why would you want the curly brackets to have a dual role in life? What problem are you trying to solve?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I agree with you, no need to overload curly brackets.
Still Alive!!!
Thank you God.
|
|
|
|
|
Mr.Prakash wrote:
I agree with you, no need to overload curly brackets
Two words:
Function Objects
Ian Darling
"The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt." - Bertrand Russell
|
|
|
|
|
humm???
I lookedup in MSDN and it should be links for JScript..
As far as my knowldge Brase brackets are not operators so you cant overload it.
brase brackets is used by the compiler for scope management of the identifiers.
Still Alive!!!
Thank you God.
|
|
|
|
|
STL uses it all the time: they are called 'functors'. Search MSDN or Google for functors and you'll understand what I mean.
Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski
|
|
|
|
|
Right:
You can overload normal parenthesis, being (), which is what I think the original poster really meant.
You can't overload curly braces {}, because it's meaningless (although I could see some possible uses for lambda constructs, perhaps.)
Ian Darling
"The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt." - Bertrand Russell
|
|
|
|
|
Ian Darling wrote:
You can't overload curly braces {}, because it's meaningless (although I could see some possible uses for lambda constructs, perhaps.)
Or thunks (for the Smalltalk 80 perverted people )
--
So let's just walk from place to place, as long as we don't talk face to face.
|
|
|
|
|
No I mean for parenthesis ().
This has been asked to me during an interview. Can we overload function operator () ? If yes then how and in what scenario this would be required.
|
|
|
|
|
class multiplier
{
public:
int operator()(int i) { return i * 3; }
};
multiplier mul;
cout << mul(10);
Robert-Antonio
"Life is very hard, when you apply E-R model to it."
|
|
|
|
|
|
With all due respect, are you blind? Did you not see the first response to your query?
--
So let's just walk from place to place, as long as we don't talk face to face.
|
|
|
|
|
|
Hi!
The TVITEM structure has a member
lParam
A 32-bit value to associate with the item.
What does this mean? Does it mean that it is a mysterious value used by Windows internally OR does it mean that this is a value we can use freely for anything and Windows won't touch it?
Thanks in advance!
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|