|
Hi everybody,
is it not standard in MFC that a MDI Child keeps the focus on a (for example)textbox if the user switch
to another window (for example from the application to the Explorer) and re-opens the application ?
I use a SetActiveView(this); ... than the focus is still at the control where i left the application.
At the Destructor i make a SetActiveView(NULL); before the Window closes
Thanks
|
|
|
|
|
i want to write and read the text from txt file from VC++? any recomendation
|
|
|
|
|
Don't post twice your message. Once is enough.
ng4kau1 wrote: i want to write and read the text from txt file from VC++? any recomendation
You can use fstream for that. Here[^] is a tutorial.
|
|
|
|
|
Hi to write and read a txt file use the following code.
FILE *fp;
fp = fopen("C:\\log.txt","w");
if(fp == NULL)
printf("File cannot be opened");
fwrite("THis is my first file handling program",sizeof(char),38,fp);
fclose(fp);
See MSDN for further help on fwrite and fread.
|
|
|
|
|
sachin ahuja wrote: fwrite("THis is my first file handling program",sizeof(char),38,fp);
If it really is the first file handling program, I would suggest to use:
fputs("THis is my first file handling program",fp);
instead.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Just out of curiosity, why would you attempt to write to the file if fp is NULL .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Dont need to send same question
|
|
|
|
|
We have an application written in visual c++ that sends e-mails using crystal reports. The application works with Crystal Reports using the Crystal Reports Runtime. Then, Crystal Reports connects to Outlook and this is how the mail is sent.(we use some functions in c++ to deal with the report and export the report the same way crystal does it. we use craxdrt9.dll library).
But now we are trying to send the e-mail in the same way but not using Outlook, using Lotus Notes.
Crystal says that it offers support for lotus.
I installed Lotus, I modified the application so that it set for lotus (DestinationType == crEDTLotusDomino), but when I try to export it breaks down. I can't debug it because the craxdrt9.dll fails.
Does anyone know how code should look like ? Does anyone know about this kind of stuff? (some other connection method...)
Thank you.
|
|
|
|
|
i want to write and read the text from txt file from VC++? any recomendation
|
|
|
|
|
Hi,
use a simple fopen, fread and fwrite ... thats a easy way.
But there are other ways, depends what you like to do
You can use also Streams :
I made a Window that loads a txt File into a RichTextControl :
void FLogs::ReadFile(CString Filename,CRichEditCtrl *REC)
{
// Convert full filename characters from "\" to "\\"
//FileName.Replace(_T("\\"), _T("\\\\"));
// The file from which to load the contents of the rich edit control.
CFile cFile(Filename, CFile::modeRead);
EDITSTREAM es;
es.dwCookie = (DWORD) &cFile;
es.pfnCallback = (EDITSTREAMCALLBACK) FLogs::MyStreamInCallback;
REC->StreamIn(SF_TEXT,es); // Perform the streaming
}
DWORD CALLBACK FLogs::MyStreamInCallback(CFile* dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
// Required for StreamIn
CFile* pFile = (CFile*) dwCookie;
*pcb = pFile->Read(pbBuff, cb);
return 0;
}
Greetings
|
|
|
|
|
You can use of CFile or CStudioFile for it
|
|
|
|
|
Hi
All
I am using LoadString() function in .dll file, i use it as
CString GetStr()
{
CString msg;
msg.LoadString(IDS_STRING);// IDS_STRING is id of string in string table.
return msg;
}
i call this function in another .exe application. but it display
it display blank string
i could not understand why blank string is display though i pass "Wel come " value in string table.
Send me solution to display string
Thanks
Atool
Atool
|
|
|
|
|
Considering your previous posts, I think you are trying to load this string from resource dll. In this case you need to set resource handle of application with loaded resource dll.
Example in MSDN should give your clear idea,
BOOL CMyApp::InitInstance()
{
HINSTANCE hRes = NULL;
hRes= LoadLibrary("ResourceD.dll");
if(hRes)
AfxSetResourceHandle(hRes);
return CWinApp::InitInstance();
}
|
|
|
|
|
Have you tried adding the following statement to the beginning of GetStr() :
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All,
I am writing CD/DVD writing software in VC++ MFC. I want to know that can we create Video DVD like Video CD.If yes what will be the constraints regarding the hardware and software?
Thanks
Yudhisthira Attry
|
|
|
|
|
Is there an easy way to create a window with a specified client area size rather than window size?
I need my client area to be say 800x600, but specifying this to the CreateWindow api results in a client area of slightly less after subtracting the titlebar and borders. My current method is to use GetSystemMetrics() then calculate the size, is there an easier way?
|
|
|
|
|
AdjustWindowRect
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
That was exactly was I was looking for, thanks
|
|
|
|
|
Well I got this need to have a CListControl that should have a button in a given column ( Not all columns ). When this button is clicked I should catch the event and throw some actions, such as opening a dialog etc.
My question is how do I insert a CButton to a CListCtrl ?
I tried
CRect r; <br />
GetSubItemRect(r)<br />
and creating the button in this rect. But the problem is that the button doesnt get erased / painted nicely when the columns are resized. Please tell me how I could hav the Button resize / reposition when the List Control or its columns are resized. ... Or if there are any other easy ways to get the job done !
thanx a lot
-- modified at 3:26 Thursday 25th January, 2007
|
|
|
|
|
Have a look at this[^] article.
|
|
|
|
|
Here is I saw examples of listctrl of Chris Maunder and other programmers see Listctrl section on the MFC controls
|
|
|
|
|
how can i access a member function using a friend function?
|
|
|
|
|
Here's a complete example:
#include "stdafx.h"
#include <windows.h>
class CMyClass
{
private:
void Private() const;
friend void CallPrivate(const CMyClass &obj);
};
void CMyClass::Private() const
{
MessageBox(NULL, "CMyClass::Private", NULL, MB_OK);
}
void CallPrivate(const CMyClass &obj)
{
obj.Private();
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CMyClass mc;
CallPrivate(mc);
return 0;
}
Steve
|
|
|
|
|
And also you can see www.cplusplus.com
|
|
|
|
|
Actually TRACE prints a string to the debug console. Most often, VS is our debug console, so we can see the messages right in the IDE. how can i get it in a file. i have to store the string in a file. can you help me
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|