|
Assuming that you know (or can get) the user's SMTP server name, and can assume that the user is connected to the internet, this article should suit your needs nicely.
http://www.codeproject.com/internet/csmtpconn.asp
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
OK, I am working on an article and I have only one thing to fix: saving. I wrote a simple app that loaded and saved a bitmap in different formats, worked fine. So I went ahead with this:
BOOL CGDIPlusPaintDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
CString name(lpszPathName);
CString ext = name.Right(3);
ext.MakeLower();
CLSID Clsid;
int ret;
if (ext == "jpg")
{
ret = GetCodecClsid(L"image/jpeg", &Clsid);
}
else if (ext == "gif")
{
ret = GetCodecClsid(L"image/gif", &Clsid);
}
else if(ext == "tif")
{
ret = GetCodecClsid(L"image/tiff", &Clsid);
}
else if (ext == "png")
{
ret = GetCodecClsid(L"image/png", &Clsid);
}
else
{
ret = GetCodecClsid(L"image/bmp", &Clsid);
}
if (m_Bitmap->Save(name.AllocSysString(), &Clsid, NULL)!= Ok)
AfxMessageBox("Failed to save");
return CDocument::OnSaveDocument(lpszPathName);
}
It just plain won't work !! I've traced it all through, the save returns Ok, but the file is 0 length. Here's the odd bit. If I hardcode a path like this:
L"c:\\image.bmp"
then it saves fine every time !! Argh !! I know my string is OK, I use the same method to load the files. I know saving is possible, a hard coded path saves. I know my string is correct going in, it creates an empty file at that location. Any suggestions ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Since it saves with a hard-coded string, experiment with different ways of passing the filename. T2COLE, CComBSTR, _bstr_t, etc.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
Looks like I get the VB book on my desk next week. I was saving in the Documents OnSaveDocument handler. I didn't delete the call to the base class. Hard coded paths worked because they were not immediately erased by the base classes serialisation attempt.
In my defence, I worked on this at 3 in the morning, having just got up from 2 1/2 hours sleep. Not that this will save me from a fate worse than death - the VB Visual Quickstart Guide.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I am a C++ programmer with basic VB abilities.
I have a 3rd party Active X container that must be interfaced to our C++ system, here's the basic problem. I need to send to the Active X functions a BSTR*. I am even willing to write a VB wrapper to go around their container so I can pass it BSTR (which I tried). . . . .many questions.
1) How do you convert any basic string type to a BSTR* that VB will understand
or
2) How do you write the parameters for a VB function so that imported as an Active X it will want plain BSTR and not BSTR*
i.e. - this VB function declaration imports as an active X, but then in C++ you must pass in BSTR* (which I can't get to work)
Public Sub PackageFiles(XMLFileName As String, HTMLFileName As String, DropLocation As String)
. . . .
End Sub
|
|
|
|
|
I Ask the point number 1;
CString strOut = _T("aaaaaaaaaaa");
::SysFreeString(*pstrOut);
*pstrOut = strOut.AllocSysString();
return S_OK;
Where pstrOut is BSTR*
Cheers
Carlos Antollini.
|
|
|
|
|
Use the _bstr_t class. It simplifies life.
|
|
|
|
|
I agree with James. It's True!!!
Cheers
Carlos Antollini.
|
|
|
|
|
In order to accept "enter" key in Single Line Edit Box of
of My Dialog I am using
UINT CQSmartEditCtrl::OnGetDlgCode()
{
UINT code = CEdit::OnGetDlgCode();
code |= DLGC_WANTMESSAGE;
return code;
}// OnGetDlgCode
and then I process return Key Like this...
void CQSmartEditCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(nChar == ReturnKey ) // Return Key
{
((CQKernelMainDlg*)GetParent())->OnQGoto();
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
everything works fine but DLGC_WANTMESSAGE is making edit box to get
tab and Esc keys also. Which makes dialog not to exit on escape or change
focus on Tab.
How to Handle this situation?
Bad judgement gives Good experience;
Good judgement comes with Bad experience
|
|
|
|
|
How do you display text on the screen that isn't on a form. An good example
of what I'm looking for is the volume control feature on some keyboards.
When you change the volume, a volume indicator is display on the screen.
Does everyone have any suggestions.
|
|
|
|
|
CWindowDC dc(NULL);
dc.SetBkMode(OPAQUE);
dc.SetTextColor(COLORREF())
dc.SetBkColor(COLORREF());
dc.TextOut(x,y,string);
I don't know how refresh the screen again though.....
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi all,
I am an experienced programmer in C, VB, PB and done lot of wotk in Oracle etc... I know C++ concepts and synax tough i didn't do much programming in C++.
I started doing VC++ nad was confused using MFC, after some time I came to a conclusion that before doing MFC , I really need to undersand and program Windows using WIN32 API. Am I correct? Is there any books/ material which can teach both. ie starting from WinAPI and taking that o MFC??
|
|
|
|
|
I think you're wrong. I learned MFC first and found it to be a safety blanket, which insulated me from all the things I had to learn when I started to do some Win32 programs. I must admit, I nearly gave up when I first tried to understand the whole Doc/View/where does everything go part of it all, you may prefer to write some dialog based stuff first, and even then it's a little bit of a paradigm shift. I found 'MFC programming with Visual C++ Unleashed' to be a good book, I admit I haven't seen the Microsoft title ( although I own Petzhold, THE Win32 book ). Of course, the fact we are talking means you've already found the *best* resource, a place where you can download existing projects to experiment with and people you can ask if you get stuck.
LEarning Win32 first would be like learning C, then C++. I think it's a bad idea for the same reasons Stroustrup says it's a bad idea to learn C first. It's more complex, and there are more opportunites to shoot yourself in the foot.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I have to agree with Christian. Although knowledge of WIN32 has proved helpful when programming some MFC implementations, the MFC library is basically a large wrapper class for the WIN32 Architecture and makes almost everything much easier.
|
|
|
|
|
well i agree with them both win32 is very tough and impossible to comprehend sometimes .besides u said u r a C programmer i recommend u this "very beginners" book.. sams teach yourself VC++ in 21 days u'll get started right away from the first chapter and also its is soooo easy to understand the language also the other thing that could help is the most famous MSDN i admit that with that library i learned 80% of what i could do with VC++ also it has that thousands or millions of topics that u could read and learn but as a start choose the most easy thing coz u know one of my friends read petzoldas a begining in win32 programming he is now a great VB programmer with no VC experience
have fun.........
|
|
|
|
|
Whew. I read that as it is written and I am out of breath. Am I the only one who finds posts with 'words' like 'u', 'r', and 'h8' draining to read ? Oh, and lets not forget making our vowels a310u....
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I'm with you Christian. I decided not to reply to posts containing multiple exclamation marks, 'u', 'r' and the like. The people who use these features must be ^g^g^g^g^g^g ^g^g^g^g^g^g
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thank you all for your suggessions. Its very valuable, I will again take a shot at going MFC directly. By the way, I am planning to purchase "Programming Windows with MFC (MS Press)", if any one has idea about how is the book?
|
|
|
|
|
When I try to Import data from text file, using DTS Wizard, there appears a protection error message. What that means. Is there something that I have to do before all. I'm using Desktop Edition (MsSQL Server7) under Win98. Any help will be usefull!!!
|
|
|
|
|
How is the text of the messaage?
Carlos Antollini.
|
|
|
|
|
It's something like "mms ... error". It appears after one of the last dialogs in the DTS Wizard, when I choose the "Run Immediatly" checkbox, click 'Next", and o-o-ps!! I'm afraid that I have missed to install something, because when I try to work with another database with ADO and Visual C, nothing happends. I can'd add nothing.
Something else: I made an installation under Windows2000 and everything is fine. But I still need to use Win98. Any sugestions!
|
|
|
|
|
Hi,
I like to know how can i rotate counterClockwise using VC++ codes.
is there any specific function that could get the rotation degree and do the job???
Thanks
Ehsan Behboudi
|
|
|
|
|
What are you hoping to rotate ? GDI+ will let you rotate a graphics object ( equivelant to a CDC ), or a shape before drawing it.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
okay,
here's the deal,
I have a point(CPoint), and i can draw a line witha specifies length to the left of the line.
So, I like to be able to rotate Counterclockwise, and draw another line every n(user defined)
degrees.
is that possible?
Thanks
Ehsan Behboudi
|
|
|
|
|
You could *possibly* put a circle into a path, flatten it and iterate the points, but I'd just use trig myself. X = sin theta, Y = cos theta, from memory.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|