|
Okay. I believe I see the problem. The problem has to do with setting the compiler (Visual C++ .NET) to compile both the DLL project and EXE project (both debug and release versions) to "Multi-threaded DLL /MD."
The solution above is from niyaw of GameDev. Everything works, except for one problem. I am using MFC doc/view as program core. I have set the compiler to "Use MFC in a Static Library." I believe when you set to that option, the compiler automatically changes "Multi-threaded DLL /MD" to "Multi-threaded /MT."
So the bottomline is that the original problem has to do with multithreaded DLL setting and can be fixed. However, if I fix that problem, I cannot use MFC via Static Library. That is okay too, but then I would have to gather all MFC dll into one zip file before releases the program. Some people do not have MFC DLLs.
Kuphryn
|
|
|
|
|
Hi,
I did see a program from MSDN sample Send Email with a Notepad npp.prj! After the user selecting Send option, the program opens an OutLook Express with an attached Notepad file (launch at the beginning)!
But what I need is a bit different! I would like to open the same OutLook Express but with a destinated user Email address (ie: thanhchau@videotron.ca) and with an existed attachment that I will insert at Run time (ie: c:\sample.txt)... without using any NotePad or any editor!
Any one has done it before? I will appreciate any codes or guidelines here!
Thanks & regards,
|
|
|
|
|
Oh, are you ever in Luck! Click here to download PJ Naughter's CMapi class. It will do all you need.
Note it is also here on CP, but it is an earlier version, so download the one at the link above.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Hi Shog,
I did download and try, but I got stuck with the the project and have 11 errors after copiling:
One of them is: MailDlg.cpp(154) : error C2039: 'AddMultipleRecipients' : is not a member of 'CMapiMessage'
C:\SmartEmail\CMapi.h(24) : see declaration of 'CMapiMessage'
I did look into the class itself & really see that it does not have the member of the error C2039!
Did you try it before?
Thank for help, might be you know this problem & help me again?
ThanhChau
|
|
|
|
|
Hmm, that's odd. I've only used the version posted here, not the one on PJ's website; i just saw there was a later version there. But, you might as well try the version here:
http://www.codeproject.com/internet/cmapi.asp
If this one works, you should probably drop Mr Naughter a line to let him know about the problem with the newer version.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Try using ShellExecute() to open this "document": "mailto:thanhchau@videotron.ca" .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi Ravi,
I did try as you suggest after the "mailto:thanhchau@videotron.ca". The problem it appear outside of the OutLook Express.
Might be I did not understand what you suggested: If some how it appear inside the contents of OutLook Express ---> OK! Would you please more specify on this!
Thanks a lot for help!
ThanhChau
|
|
|
|
|
Hmm, the ShellExecute() call should cause your default mailer to open. If it's not OE, then are you saying that you want OE specifically to deliver the message? Sorry if I put you on the wrong track!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi!
I need a safe way to acquire a colored bitmap... Now, I do it like
hDC = CreateCompatibleDC(NULL)
hBitmap = CreateBitmap(params...hDC...)
but it's still B&W
any ideas? Thanks!
PS: running 98 if you find this relevant. No window handle available
|
|
|
|
|
Can you post more or your code? What are you passing CreateBitmap for UINT cPlanes and UINT cBitsPerPel?
Todd Smith
|
|
|
|
|
CreateBitmap( width, height, GetDeviceCaps( hTempDC, PLANES ), GetDeviceCaps( hTempDC, BITSPIXEL ), NULL );
and I get the dc like
hTempDC = CreateCompatibleDC(NULL)
|
|
|
|
|
Check what GetDeviceCaps( hTempDC, PLANES ) and GetDeviceCaps( hTempDC, BITSPIXEL ) are returning. I suspect GetDeviceCaps( hTempDC, BITSPIXEL ) is not 8 or greater which is required for a color image. If you want a 256 color image then use 8 otherwise use 24.
Todd Smith
|
|
|
|
|
Hello. I'm using MFC without the use of any wizards or such (VC6/w2kpro), doing everything manually. Now I've run into a problem, I cant set message text to my status bar..here's my frame window constructor:
FrameWindow::FrameWindow()
{
Create(); // create the frame window
m_wndStatusBar.Create(this);
SetMessageText("Testing");
}
When I run this code, I see the status bar, but I don't see any text on it. Then I tried moving SetMessageText("Testing"); to FrameWindow::OnPaint(), and then the text appeared. Now, I dont want to call SetMessageText() in OnPaint(). Why can't I set the inital text in the frame window constructor?
I also tried with m_statusBar.GetStatusBarCtrl().SetText( "Testing", 255, 0 );
Same result as with SetMessageText().
Please help me solve this annoying problem
William Payne
|
|
|
|
|
Probably, it does not work that there are no created fields in SB. Try to use something looks like that:
... It's our SB fields
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_POS,
ID_INDICATOR_CAPS,
ID_INDICATOR_OVR,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
... Use update action handlers to change contents of SB
ON_UPDATE_COMMAND_UI(ID_INDICATOR_POS, cmdupOnIndicatorPOS)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_OVR, cmdupOnIndicatorOVR)
....
..... After SB creation we must set indicators
pStatusBar->SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
...... Update it!!
void CSourceView::cmdupOnIndicatorPOS(CCmdUI* pCmdUI)
{
TCHAR str[32];
....
sprintf(str," Line %d, Col %d", dwLine+1,dwCol+1);
pCmdUI->SetText (str);
}
|
|
|
|
|
Tried your suggestions (except for the command handlers), still no text in the message pane. And I don't think the lack of panes was the problem, since text appears if I call SetMessageText() in OnPaint() of the parent window (the frame window). I've made a small test program: which is as follows:
///// APPLICATION.H /////
#ifndef APPLICATION_H
#define APPLICATION_H
#include <afxwin.h>
#include "FrameWindow.h"
class StatusBarApplication : public CWinApp
{
public:
BOOL InitInstance();
};
extern StatusBarApplication g_applicationInstance;
#endif
//// END OF APPLICATION.H ////
//// APPLICATION.CPP ////
#include "Application.h"
StatusBarApplication g_applicationInstance;
BOOL StatusBarApplication::InitInstance()
{
m_pMainWnd = new FrameWindow();
m_pMainWnd->ShowWindow( m_nCmdShow );
m_pMainWnd->UpdateWindow();
return TRUE;
}
//// END OF APPLICATION.CPP /////
//// FRAMEWINDOW.H /////
#ifndef FRAMEWINDOW_H
#define FRAMEWINDOW_H
#include <afxext.h>
#include <afxwin.h>
class FrameWindow : public CFrameWnd
{
public:
FrameWindow();
DECLARE_MESSAGE_MAP()
private:
CStatusBar m_statusBar;
};
#endif
//// END OF FRAMEWINDOW.H ////
//// FRAMEWINDOW.CPP ////
#include "FrameWindow.h"
BEGIN_MESSAGE_MAP( FrameWindow, CFrameWnd )
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
//ID_INDICATOR_POS,
ID_INDICATOR_CAPS,
ID_INDICATOR_OVR,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL
};
FrameWindow::FrameWindow()
{
Create( NULL, "Status Bar Test" );
m_statusBar.Create( this );
m_statusBar.SetIndicators( indicators,
sizeof( indicators ) / sizeof( UINT) );
SetMessageText( "test" ); // No text appears in the message pane
// despite this call.
}
//// END OF FRAMEWINDOW.CPP ////
|
|
|
|
|
What about CStatusBar::SetPaneText??? In my opinion it is best solution...
|
|
|
|
|
I am retrieving a text field from a database using the syntax that works fine for an ordinary text entry:
m_photoInfo = (_bstr_t)m_pRecordset->Fields->GetItem ("ID")->Value;
the problem here is that in the ID field I have a value C:\def.mdb,abc
When it gets this value out I have a messagebox pop up which tells me its horribly confused and has some garbage characters ef.mdb,abc
How do I get this text value out so that it comes out properly?
Thanks,
ns.
|
|
|
|
|
how are you displaying your message box?
are you using a function that uses printf()-style formatting??
strikes me that whatever code you're using is trying to interpret "c:\def.mdb,abc" as a format string, thus it's got a "\d" in the middle of it.
Experiment: manually update your record in the db so that the value is "c:\\def.mdb,abc" and see if it displays properly.
Jon
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
I made a database class and the Open() function is quite flexible but opens a recordset based on a specific query. Its too involved to remove that inflexibility. Now I am wanting to use my database class but open with a whole different query. SO is it okay if I have a function called DbClass::Open2() which opens a database based on my new specific query (I may make Open2 be able to take any query but for the moment not). then when I want to open a database with my new query I can instantaite a new db object and call its open2 which in no way will interere with the db object which called Open1 (the original).
Any comments? I know this is not good programmmming but do you agree that I can call two different versions of Open if I so desire...
Thanks,
ns
|
|
|
|
|
Just call it Open but use different parameters. C++ will be able to figure it out. Its called method overloading.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
??????
<< excuse my english please, i'm romanian >>
|
|
|
|
|
void MClass::Open()
void MClass::Open(int i)
void MClass::Open(char c)
Are different functions of the same class with the same name but having different parameters. This is called function overloading.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
Why not rename Open to something more descriptive and change our code? Then add another function for your 2nd query.
Use something like QueryCustomers and QueryProducts instead of Open and Open2.
Todd Smith
|
|
|
|
|
Good idea! I'm just so glad I could extend my class. Appreciate your advice.
Thanks,
ns
|
|
|
|
|
How can I change the default debugger?
Thanks,
Jon Sagara
"Bugs suck. Period."
-- John Robbins
|
|
|
|