|
Hello,
You can retrieve the extraction count. This is the amount of characters read from the last call to an unformatted input function. Look here[^] and here[^] for more information on gcount() and basic_istream respectively.
int nCount = file.gcount();
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hachaso wrote:
file.getline(buf, 100);
If you are going to be asking for 100 bytes from the file, the buffer needs to be large enough. As it stands you are only allocating room for 1. Change the allocation to:
buf = new char[100]; Don't forget to delete it when done!
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am not able to read plain 8-bit text files (like the one created by Notepad) under windows CE, because this OS natively uses 2-byte Unicode characters: it reads one character every two bytes... For example, the text "ciao" may become 2 chinese symbols.
I'm using the MFC, and CFile::Read(), CArchive::ReadString() ... all don't work. How can i tell him to treat text files as 1-byte ASCII files?
Or maybe i can convert the strings to 8-bit AFTER reading them, but this way i couldn't use ReadString; it wouldn't find the ASCII LineFeed while reading.
Thanks
|
|
|
|
|
Make sure _UNICODE (and UNICODE) is not defined when compiling your code. If for some strange reason that does not work, either use wide-characters (UNICODE) or use one of the functions for converting wide-characters to ASCII.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
In windows CE, unicode is normality, it isn't defined...
You mean functions like wcstombs()? This is not the case, they convert for example L"Hello" to "Hello", while i'd have to phisically split every couple of bytes
|
|
|
|
|
How can i create/open a word doc and add data based on a template. Pls hlp.....
|
|
|
|
|
Hi there,
Search the MSDN for
automation MFC Word HOWTO
you'll get a bunch of old but good articles about Word automation
~RaGE();
|
|
|
|
|
hiho@ll
i want to add a static control to a toolbar for a news ticker
this means a static control in a toolbar with changing text
i already thought of a button without an image, but if i don't use an image i have a little rect left of the text where the image should be
the second problem will be, how to change the text randomly? (in both situations, button or static control)
thx@ll
|
|
|
|
|
Hi!
I'm developing an application using MFC.In the application I've some static controls and some created at runtime.
When the application starts,I want to set the focus to the editbox(created at runtime).
I've used SetFocus and SetTabIndex for this but everytime the focus is being set to the first control created statically.
Kindly help me with this.
Thanks
|
|
|
|
|
This is not an MFC problem. If you set the focus to anything other than the default, then your dialaog init function must return FALSE: otherwise the system will set it to the default keyboard focus.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi!
I've implemented context sensitive help on right click of the mouse button.
But after few clicks the application gives Assertion in wincore.cpp.
Kindly help me with this.
Thanks.
|
|
|
|
|
|
thanks for the email, but you'll get better responses if you post the code so that everyone can see it. I am trying to help, but I'm no DavidCrow or toxcct.
Here's what topagarwal sent me:
Message box:<br />
Unhandled exception at 0x7c34055c (MFC71UD.DLL) in CAMU485.exe: User breakpoint.
Code :
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
which line is it blowing up at? I don't think you should be making nResponse an INT_PTR variable. try using int and see what happens. If that works and you still need a pointer, how about making an INT_PTR variable that points to the address of nResponse? I'm not sure what you're trying to do here, so we'll probably need more information
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I have a property page with radio buttons group derived from CFormView and cannot figure out how to set default radio button - either in the "dialog" or at run time.
My variables are CButton and SetCheck(1) asserts in OnCreate.
Thanks for your help
Vaclav
|
|
|
|
|
I think you should do all this in OnInitDialog() in place of OnCreate.
Jitendra.
|
|
|
|
|
Sorry,
my code does not have OnInitDialog as much as it should.
I'll look into that.
Thanks
Vaclav
|
|
|
|
|
1.)
CButton* pRadio = (CButton*)GetDlgItem(ID_OF_RADIO_BUTTON);
radioState = pRadio->SetCheck(1);
2.)
CButton m_RadioButton; //Declare in .h file
int m_bRadio;
//In Constructor
m_bRadio = 1;
//Write in DoDataExchange function
DDX_Control(pDX, ID_OF_RADIO_BUTTON, m_RadioButton);
DDX_Radio(pDX, ID_OF_RADIO_BUTTON, m_bRadio);
http://www.priyank.in/
|
|
|
|
|
Vaclav wrote:
...in OnCreate.
Why not OnInitialUpdate() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for all the suggestions. Here is an update on my problem:
1. OnInitUpdate does not get executed. Don't know why.
2. If I do this,
CButton* pRadio = (CButton*)GetDlgItem(ID_OF_RADIO_BUTTON);
radioState = pRadio->SetCheck(1);
and put in in OnCreate I 'll get assertion failure because the m_hWnd is still null at that point of program execution.
I think that is the root of my problem - no m_hWnd.
The above code seems to duplicate variable CButton already defined in the accompanining dialog resource anyway.
Do I understand it correctly that you have used two variables associted with CButton - the control itself and than the state?
PS
The following code as is cannot work because SetCheck "returns" void.
radioState = pRadio->SetCheck(1);
Vaclav
|
|
|
|
|
Problem solved!
I did not read the fine print - poor excuse!
I can set the default radio button ( SetCheck(1)) in any page AFTER the PropertyView OnCreate is finished with AddPage !
Thanks for all you suggestions, it helped.
Vaclav
|
|
|
|
|
Hello everybody,
I am a newbie in Windows Programming (I began yesterday), and I have to find two methods for a project but I don't find functions I need and it's very urgent (I have 2 weeks).
1 - Detect when a directory or file started being shared
2 - Share a directory
I work with Visual c++ 6.0...
I have find the function : ReadDirectoryChangesW... for the first question but I am not sure it works for sharing...
|
|
|
|
|
NetShareEnum for share a directory, NetShareCheck and NetShareAdd
|
|
|
|
|
Thank you for your response, it helps me a lot!
But, NetShareCheck tells only if a specific directory is shared, I need rather a function which notified me that a directory starting being shared.
I think particulary about an association of ReadDirectoryChangesW and NetShareCheck...
I am going on my search.
Thank you again, and if you have another idea, I am open on every suggestion which could help me to progress!
|
|
|
|
|
Man, I'm glad I'm not you!
It is possible to determine if a directory is shared on the network. But what they appear to be asking for is a monitoring program. What I mean by that, is a program that is constanly checking if a directory has started being shared (not a program that knows the information when it firsts starts).
Now there is the possibility that the server may log this information (I dought it), if it does then the access to the information is probabaly undocumented (Welcome to Windows programming). Before you ask how to retrieve the information, you need to know if the information is there to be retrieved (ask the administrator or a network guy). If the server does not log the information, then they are asking for a monitoring program (if they know it or not).
Monitoring probably means calling NetShareEnum and noting the time when your program first started checking and noting when any change has occured, there-after.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hello thank you for your response,
I understand what you mean, but I am going to reformulate my question because my problem is less tricky than you thought (hummm...I hope).
So, my problem is to detect on my computer and only on my computer when a directory start to be share.
Between us...I would prefer to have more time and more documentation, source, etc.
Thank you, for your response, If this precision help you to understand my problem, I'll be glad to have your help
|
|
|
|