|
To add to what Michael has given you...
Text file are usually much easier to handle if you use CStdioFile instead of CFile. CStdioFile allows you to easly read each line in a loop. For example...
CStdioFile f; // construct a CStdioFile object
char buffer[256]; // define a temp buffer
while (f.ReadString(szBuffer, 255))
// tokenize string and process
Roger C.
|
|
|
|
|
Thank you also Roger. This is exactly the help I was looking for. I works great.
Joshua
|
|
|
|
|
I have created an in invisible button (overridden CButton) , and I want to send the buttons messages to the parent ( a CView ) I found an article in MSDN that describes how to do this , but I cannot seem to get it to work. Message Reflection ??? I want all the instances of the class to send the messages to the parent.
Any Ideas anyone ???
|
|
|
|
|
I inserted an ActiveX Control "Microsoft Forms 2.0 TextBox" in my app because it supports unicode character. I can successfully type and retrieve the text from it.
But now I can't set the text to it from the code. I tried using the following code, but it doesn't work. There must be something simple that I am missing. Can anyone help me?
m_myTextBox.SetText(L"The text");
UpdateData(false);
|
|
|
|
|
try:
m_myTextBox.UpdateData(FALSE);
|
|
|
|
|
A server knows the client is present or not by using reference counting. But how knows the server when a client crashes. In that case the client is not able to call Release.
|
|
|
|
|
Hi!
To have a first sample for the XML control I downloaded the
"MFC XML Tree" sample and compiled it using Visual C 5. Doing that gave me the following errors:
D:\test\MFC Tree\Debug\MSXML.tlh(785) : error C2504: 'IXMLDOMCharacterData' : Basisklasse undefiniert
D:\test\MFC Tree\Debug/MSXML.tli(720) : error C2664: '_com_issue_errorex' : Konvertierung des Parameters 2 von 'struct MSXML::IXMLDOMText *const ' in 'struct IUnknown *' nicht moeglich
Compiling the sample using Visual C 6 works well.
Any ideas or hints how to use the XML control with Version 5?
Thank you!
Ciao,
Alex
|
|
|
|
|
The MSDN documentation says that when you programmatically retrieve the fixed file info from a version resource, it comes in a VS_FIXEDFILEINFO structure, which contains a 64-bit date stamp for the file:
- dwFileDateMS
- Specifies the most significant 32 bits of the file's 64-bit binary creation date and time stamp.
- dwFileDateLS
- Specifies the least significant 32 bits of the file's 64-bit binary creation date and time stamp.
However, if I retrieve this resource from an MFC project using code like this:
bRetCode = VerQueryValue(pVffInfo,
_T("\\"),
reinterpret_cast<LPVOID *>(&lpVersion),
&uVersionLen);
if (bRetCode && uVersionLen && lpVersion) {
VS_FIXEDFILEINFO * pFFVer =
reinterpret_cast<VS_FIXEDFILEINFO *>(lpVersion);
FILETIME ftime;
ftime.dwHighDateTime = pFFVer->dwFileDateMS;
ftime.dwLowDateTime = pFFVer->dwFileDateLS;
}
then both ftime.dwHighDateTime and ftime.dwLowDateTime are zero.
Does anyone know anything about what the deal is here? Is there some way I can set the date/time stamp when I build my code and then retrieve it at run-time for the About Box?
Otherwise I could use the __DATE__ and __TIME__ macros in my code, but that would only tell me when a particular module was compiled. I was hoping that there was a good way to get the approximate time the build finished.
|
|
|
|
|
The reason why the date is zero is that in VC++ there isn't any default update of the version resource. You MUST do it yourself.
Mr. Mike Woodring has created an Add-In which does this! It's called BuildNum. You can download it from http://www.bearcanyon.com/
// Mike
|
|
|
|
|
How do I manually update the version resource? I don't see anything in the MSDN documentation about setting the Date/Time in the Version Resource.
I have a fairly complicated Version resource in MyProject.rc2, which sets the version number, build flags, and related things in the version resource using the preprocessor, so I don't want to play with a third-party add-in that will have unknown interactions with my own stuff.
If someone could point me to where I could find out how to manually set the date/time for the dwXxxDateTime fields, I'd be quite grateful.
|
|
|
|
|
Has anyone know how to make a toolbar in the scrollbar,like the Microsoft's Word has two toolbar in vertical and horizontal scrollbar.
Thanks.
|
|
|
|
|
I am trying to write a DCOM server application. Some of the interface functions have paramaters that are user defined data types (structs). I have the header files where these type definitions are included in the server .h file included in the .h file of the server .cpp file. When I try to build, I receive the following error that points back to the .idl file:
"Expecting type specification near "data_type".
Any advice on how to remedy this. I am fairly new to DCOM/COM programming.
|
|
|
|
|
Nevermind, I answered my own question.
|
|
|
|
|
I take that back, I still want to be able to pass a parameter from the DCOM server to the client application but do not want to specify the type of the parameter. Is there a way to do this?
|
|
|
|
|
I take that back, I still want to be able to pass a parameter from the DCOM server to the client application but do not want to specify the type of the parameter. Is there a way to do this?
|
|
|
|
|
well the subject says it all. I need to be able to enable/disable/hook the cut/copy/paste commands from the default CEdit control context menu.
thanks ahead of time for pointing me in the right direction.
byron
|
|
|
|
|
You'll need to subclass CEdit and handle the WM_CUT, WM_COPY, and WM_PASTE messages.
|
|
|
|
|
Erik,
Thanks for your response.
I have CEdit subclassed already and I can trap the WM_COPY/CUT/PASTE messages there if I needed to in ::WindowProc. But I want to disable the menu items in the first place.
In a nutshell what I am trying to do is have a custom 'read-only' state in the edit control.
So I would like to be able to disable the Cut/Delete/Paste items of the default CEdit context menu when my control is 'read-only'. That way the user doesn't even have the option of selecting it.
The only thing I can think of is to create my own pop-up menu and look for a right click or that other windows key. Which is do-able, but I'd rather just be able to enable/disable the default context menu items at will.
Any ideas?
Byron
|
|
|
|
|
|
Well, I'd like to know how to disable the focus when
I'm using the arrows key in a dialog box.
If my buttons are "disabled", there is no focus and I
can get the "OnKeyUp" event, but if one or more is enabled,
There is no more "OnKeyUp" event!
Someone has got an idea?
|
|
|
|
|
Handle the PreTranslateMsg function, and check the msg structure for a WM_KEYUP or WM_KEYDOWN event.
|
|
|
|
|
The problem is that I'm using MFC and there is no
PreTranslateMsg function in the App...
Another idea?
|
|
|
|
|
Yes there is. Every window has a PreTranslateMessage virtual function which you can override. It's even in ClassWizard.
|
|
|
|
|
Has anyone have an idea if there is a Windows API to use in order to Enable/Disable the "Start->Shut down ..." menu in the windows task bar.
In my application, to use it, the user have to enter a code or have an access right.
Thanks
|
|
|
|
|
The only way I know of to do this is to use group policies, but I don't think you can change them without logging off and back on.
|
|
|
|