|
Please help me,
I've been trying to solve this problem for more than a week now:
I have to open a textfile with a common dialog box, put this file in a buffer, then I have to show this text in a richeditcontrol by calling the buffer.
Oh, yeah: these text files are at least 1MEG big and I'm just getting started with MFC, glups !
Thanks if you can help me...
|
|
|
|
|
|
Cannot open include file...
Microsoft's products are perfect as always.
What should I do?
Lio.
|
|
|
|
|
mfc42ud.lib is not a header file - it's a library. Anyway, you should set the active configuration to non-unicode before building the sample.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
You could use SetText()
or stream the text in with a callback function something like:
DWORD CALLBACK readText(DWORD dwFileHandle, LPBYTE lpBuffer, LONG nbrToRead,
LONG FAR* lpNbrRead)
{
BOOL file = ReadFile((HANDLE)dwFileHandle,lpBuffer, nbrToRead,
(unsigned long*)lpNbrRead, NULL);
if(file == FALSE ){
AfxMessageBox(_T("Could'n open file!"),MB_ICONEXCLAMATION);
return 1;
}
return 0;
}
and then call it with something like this:
EDITSTREAM stream;
HANDLE hFil;
fFormat = SF_TEXT;
strom.dwCookie = (DWORD)hFil;
strom.pfnCallback = readText;
m_recText.StreamIn( fFormat, strom );
/Per
|
|
|
|
|
OK, I've had a better look at it now.
I still have one question: how do I declare m_readText?
Thanks in advance. Lio.
|
|
|
|
|
I want to see only the grid, not a grid in a formview. How do I handle WM_NCPAINT to solve this?
|
|
|
|
|
add a grid as a member in your CView -derived class.
In CView::OnCreate, call the grid's create function, and use GetClientRect() to size it.
then your view need to handle WM_SIZE, and resize the grid to match the window size.
|
|
|
|
|
The menu in my application changes in runtime. For each of the menuchoices I've made an accelerator key. For some of the choices I want the accelerator key to be the same. This is because the menu changes in runtime and these choices never is available at the same time. The problem is that the menu only respond to the accelerator declared first in the table. For example I have three accelerator keys declared with enter, only the first of them respond. How do I solve this?
|
|
|
|
|
Have the command associated with the "enter" accelerator call one function, OnEnterKey().
In this function, decide which action should be taken.
|
|
|
|
|
|
|
hi!
i've some probleme with MAPI. i use the following code for send an email via my program :
///
MapiMessage Msg;
MapiRecipDesc Dest;
MapiFileDesc ReportFile;
BOOL bRet = FALSE;
ZeroMemory(&Msg, 0);
ZeroMemory(&Dest, 0);
ZeroMemory(&ReportFile, 0);
ReportFile.nPosition = (ULONG)-1L;
ReportFile.lpszPathName = (LPTSTR)(LPCSTR)g_szTmpCmpFilePath;
ReportFile.lpszFileName = "";
Dest.ulRecipClass = MAPI_TO;
Dest.lpszName = "";
Dest.lpszAddress = "<email de="" votre="" destinataire="">";
Msg.lpszSubject = "";
Msg.lpszNoteText = "";
Msg.nRecipCount = 1;
Msg.lpRecips = &Dest;
Msg.nFileCount = 1;
Msg.lpFiles = &ReportFile;
// Envoi du message
HINSTANCE hInst=LoadLibrary("MAPI32.DLL");
if(hInst!=NULL)
{
ULONG (PASCAL *lpfnSendMail)(ULONG, ULONG, MapiMessage*, FLAGS, ULONG);
(FARPROC&)lpfnSendMail = GetProcAddress(hInst, "MAPISendMail");
lpfnSendMail(NULL, NULL, &Msg, MAPI_DIALOG, NULL);
FreeLibrary(hInst);
bRet = TRUE;
}
//
it work well on my computer, when i try it into a another computer (windows me based systeme) my program crash in WAB32.DLL. somebody know why ? i hope you'll help me.
thx
F.Julien
|
|
|
|
|
I really haven't got a clue, but
ZeroMemory(&Msg, 0);
should be
ZeroMemory(&Msg, sizeof(MapiMessage));
Second parameter is the number of bytes to clear. ZeroMemory(&Msg, 0) doesn't do much work.
Hope that helps.
/Niklas
|
|
|
|
|
There are differences in behavior which can occur based upon whether the machine is running Outlook or Outlook express as its default e-mail handler. Outlook runs directly off of the MAPI dll but Outlook express does not. Express uses the WAB (windows address book) which has a very MAPI like interface, but it does not require the MAPI dll to be present. This can cause some weird things to go on.
|
|
|
|
|
With the Microsoft Developer studio add-ins, you declare functions in a COM interface, then call a routine (a member of the Application object) AddCommand, which takes amongst other things a string that contains the names of your functions. These are not exported functions, they are standard STDMETHOD(...) functions (which expands to HRESULT virtual __stdcall ...). Any one have any ideas on how they do this? I know you can export the functions, and then use GetProcAddress to look those functions up my name, but these functions are not exported...they are normal exposed members of a COM interface. Anyone have any ideas on how they get away with this?
Thanks in advance.
-Jesse
|
|
|
|
|
|
Sweet! Thank a bunch
|
|
|
|
|
MS compiles your com interface file (.idl) and produces the function name to function pointer map. Look through the files in your directory after compile and you can find this. There's probably a macro that uses the ## syntax to create the function name as a string.
|
|
|
|
|
Thanks...I couldnt find anything to resolve those functions to strings, however your suggestion of a macro gave me an idea that I made work =)
-Jesse
|
|
|
|
|
Hi,
I'm trying to figure out a way to change the font used within the list control that is embedded inside the CFileDialog. As I understand it, it's resource id is "lst1", but how can I set the font used to display the files, let's say, in my override "OnInitDialog"? (I'm inheriting from CFileDialog).
Thanks in advance.
|
|
|
|
|
|
You should be able to
CWnd* pWnd = GetDlgItem(<put list="" id="" here="">);
ASSERT(pWnd);
pWnd->SetFont(<put pointer="" to="" cfont="" object="" here="">);
|
|
|
|
|
This true for all the cases where I've wanted to change the font on a particular control, but it does NOT work when you attempt it on a file dialog for some reason. I'm truly stumped. Thanks for your reply, though.
|
|
|
|
|
Created an application that uses SQL Server 7.0 to store data. I now want to place it on a clean machine for testing purposes, therefore SQL Server 7.0 will not be on this machine. I believe that what I need to install is MSDE to allow the application to interact with the database files.
Is this correct?
Where can I download MSDE from? Searches keep pointing me to MSDE for VC++ or Visual Studio, not exactly what I want.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|