Visual C++ :: Use Windows Sockets To Send Email?
Jan 26, 2013
I have struggled to send email from my MFC applications using severl methods:
1) http via my server - works but limited
2) M$ Outlook automation - works but not easily interchangeable between machines
3) Windows Sockets - available information simply too complicated
4) Purchase an ActiveX control - I hate black box solutions and am too cheap
I have looked at P. J. Naughter's class
CPJNSMTPConnection v2.99
An MFC class to encapsulate the SMTP protocol
[URL]
This approach requires the implementation of OpenSSL which turns out to be nothing short of a nightmare to install (so I never got it to run). I am looking for an example of an application that utilizes SMTP via Windows sockets api.
View 6 Replies
ADVERTISEMENT
Apr 9, 2013
I'm connecting to my website through sockets, like this:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <winsock2.h>
#include <string.h>
int main(int argc, char *argv[]) {
WSADATA wsadata;
if (WSAStartup(MAKEWORD(2,2), &wsadata) == -1)
[Code]...
I want to send GET to a certain web page. How can I do that?
View 2 Replies
View Related
Oct 7, 2012
Have tried to track down the delay? Which function takes that long? Have you printed some logs or measured the time of the functions? No I am not sure how to do that! I debugged it but i didn't see any difference! I definitely think its the logic in the receive code that's "inefficient" what do you think about that? Do you think there's a more efficient way of receiving messages and sending them? Because what I am doing is receiving one then calling send and sending that message out to all users then receiving another one then calling send and sending it out to all users and repeating that process till all the messages are sent, both methods are using a loop to send to all users. DO you think i should receive all messages then send them all out at once? or is that less efficient?
View 4 Replies
View Related
Jan 2, 2014
I want to send an email using Google's SMTP server. How do I achieve it?
View 2 Replies
View Related
Dec 27, 2012
i am doing a structure program "struct book",but at the time of run cmd is opening and i am getting 'windows don't send' error and program has been terminating.
the code is following:
#include<stdio.h>
#include<conio.h>
display();
struct book
[Code]....
View 3 Replies
View Related
Jul 2, 2014
I need to do an equivalent of kill -11 <pid>(which is in unix) in windows.
I need to crash a process with SEGV so that it would dump core in windows. Is there any tool by which we can do this . Also is there any sample code through which we can achieve this .
In windows we have taskill which only terminates a process , but is unable to send a signal like SEGV to the process upon which it would terminate and dump core .
View 9 Replies
View Related
Oct 4, 2013
I am currently working on a MFC application and need to send (non-document) files created by the program over email. (either with SMTP client on the machine or web mail)
I have searched the web and some forum and cannot find a code that work. They either have errors, or not Unicode compliant, even when converted they still don't work.
Everything code example seems to use MAPI, but like I said non of them worked.
see here
[URL]
A simpler approach would be to modify or override the event handler OnFileSendMail() that is built into MFC document view framework and use the menu id ID_FILE_SENDMAIL.
To get this feature all you have to do is give any menu item the resource id ID_FILE_SENDMAIL and MFC will call the installed mail client for you. The problem is MFC will attach any open document that is in focus when you select the menu item. The file that I wish to send is not associated with the document so I was wondering if there is a way to find the OnFileSendMail() handler and modify it to send my file instead. I am not too keen on how MFC route command handler such as ID_FILE_NEW, ID_FILE_SENDMAIL etc. These methods/functions are hidden from view or I don't know where to find them.
View 5 Replies
View Related
Jul 19, 2013
I'm trying to create an executable with C or C++ that send a command with the function system, but it waits for a command or key.
Example :
I send this:
C:
unas /noprofile user:administrator notepad.exe
But it waits for password.
Please type the password :
So my question is how can I make to send the password or that my program detect that prompt.
View 1 Replies
View Related
Jan 23, 2015
This code doesn't send parameters to mysql database vis WININET post, i see it send empty fields, what exactly could be the problem:
Code:
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <Wininet.h>
#define PAGE_NAME "gate.php"
[Code] ....
View 13 Replies
View Related
Feb 17, 2013
I want to send messege to click select check box. I can click button but I don't know how to select check box with VC.
View 2 Replies
View Related
Jan 10, 2013
I have found the following article to be a very excellent run through on how to use Outlook automation with C++ in Visual Studio 2010. However, I cannot find any description of how to add an attachment(s) to an email.
How to automate Outlook 2010 by using C++ in Visual Studio 2010 together with MFC
[URL] ....
View 5 Replies
View Related
Jan 2, 2014
I have a problem in a c++ project. I have created a .dll file and hooked to an .exe
I want this .dll to make a ping or to send a message like hello somewhere, and IF ping or message doesn't receive an answer that's means the user has suspended-terminated this dll from the exe then the exe will close. How can i do that?
View 11 Replies
View Related
Jul 13, 2013
Until recently I have been using select() to wait for activity on file descriptors, however this seems less efficient than poll. I rewrote the program using poll:
Server:
Code:
#include <stdio.h>#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/types.h>
}
[code].....
View 11 Replies
View Related
May 14, 2014
I want to send a number to my OPENGL class from my main dlg. Im using a updated edit control.
here is my open gl code that will draw what I want
Code:
void COpenGLControl::oglDrawScene()
{char side[32];
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBegin(GL_LINE_LOOP);
for(int i = 0; i < 256; i++) {
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
[Code]...
I want to update the glVertex3f values when I enter numbers into edit controls on my main dialog
how can I send messages from my main dialog to the opengl class that I created?
View 1 Replies
View Related
Oct 30, 2013
I have a socket connection already set up, my thing is what would be the best way to send a packet through sockets? My teacher wants us to convert the packet to bits first before we send it. I think he wants something like this:
Code:
struct packet{
int header
int message
int flag
}clientpacket; m
My question is how do we covert this to bits, before sending it. One of my friends said we can create a char[] array the size of the struct as a buffer. will memcpy() change the struct to bits if I copy it to the buffer?
this is how is suppose to look in bits for the header field/column.
Field : header
Field size(bits): 8
data format: Unsigned int
value example: 1
Value in bits: 0000 0001
I am confused, I think I send a structure over the socket but I did not convert it to bits before I sent it .
View 13 Replies
View Related
Nov 1, 2013
I want to write a program(s) so that the client sits and waits for a scanf to receive an int, then send to server, server then receives the int, processes it, then goes back to sit and wait for new input. to start with, where do i start! server side, or client side? and also what order do i have to go in my program before the loop to set up the socket, and listen? and then what gets looped to keep the connection open and wait for new receive?
View 4 Replies
View Related
Sep 6, 2013
I am writing an MFC app in Visual Studio 2012 that will open a JPG file as binary and read all the contents to a CString.
I am able to read it to a std::Vector, but that doesn't work much as i need to pass all the binary content as a MFC CString to another function.
More Update:
Let me explain the problem a little more deeper.
I am trying to call a JavaScript (JS) function in a HTML page and then want to pass the binary date. The C++ function that calls the JS is given below.
bool CallJavaScript(const CString strFunc,CComVariant* pVarResult);
The 1st argument is the JS Function Name and 2nd is the one to pass the Binary Data. 1st argument works fine as i am able to call the JS fucntion called "LoadImage" without any problem. Problem is with 2nd argument that's supposed to take the Binary data of the JPG file.
If i try to pass a std::Vector or std::string then it will give me an error.
But it's happy if i pass CString. But then with CString there's a problem with NULL characters.
Actually my plan is to pass the binary of a JPG to a JS function and let it display the JPG in the HTML page.
Can i typecast a Vector or std::string to a CComVariant*?
View 3 Replies
View Related
Feb 22, 2012
I have created a simple basic program that uses sockets but it can only handle one connection, how do I make it so it handles multiple connections?
Server code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
}
[code]...
View 5 Replies
View Related
Apr 27, 2013
I've just integrated the Windows SDK V7.0A into my VS2005 application, and I'm getting the dreaded "Application configuration error" when I try to run it on an XP machine.
It runs fine on the development machine, and some customer machines (Win7 and Win8), but will not run on XP due to missing/incorrect version dlls.
I've rebuilt all my libraries, but still no joy.
So, my first question is - If I upgrade the Windows SDK to V7.0A, do I also need to use MFC 10 and msvcrt10, or can I stick with MFC 8?
The next question is, how do I find out which dlls are missing, and which libraries or other dlls are requesting the missing versions?
View 11 Replies
View Related
Apr 17, 2013
In my application I have some type of windows showed in an instance of time, and an action shows a new one that i want have the focus all the time , in the way that i can't works with no one of the others. They all are windows, child windows an modeless dialogs, but i don't know how to do. I try use EnableWindow(FALSE) that all the others windows and dialogs, but not works.
View 2 Replies
View Related
Sep 23, 2012
I used to retrieve IP and NIC information by querying windows registry. Now I'm trying to use GetAdapterAddresses() API. Using GetAdapterAddresses() to get IP is not that easy, I need to dig a long deep as I check some examples so far, anyways my question is: Calling this API will return success on all versions of Windows ie: 32bits & 64bits ?
Though Microsoft has not opened any source, where this API is actually retrieving Windows IP information.?. Is it reading Registry or some windows file.
View 6 Replies
View Related
Jul 1, 2013
I want to connect to an SQL Server database using ADO with VC++.
In order to do that you need to import an external dll, like so:
#import "C:Program Files (x86)Common FilesSystemadomsado15.dll"
What if the OS is not 64 bit? That would mean the (x86)-suffix would be incorrect.
how to work around this using certain preprocessor directives?
Something like this, maybe?:
#if 64bit
#import "C:Program Files (x86)Common FilesSystemadomsado15.dll"
#else
#import "C:Program FilesCommon FilesSystemadomsado15.dll"
#endif
View 9 Replies
View Related
Nov 24, 2014
My goal is to know if Windows is installed on an active disk partition.
View 8 Replies
View Related
Apr 21, 2013
I am looking windows slideshow screen saver source code.
View 5 Replies
View Related
Nov 9, 2013
I am new in Visual C++ and I have to make an MFC application with "child" windows. Here is what i need to achieve - [URL] ..... As you can observe when you click on the cross of popup window or child window 2 both are closing.
View 2 Replies
View Related
Feb 3, 2013
I designed an app for work that lets you enter data in a much more efficient way, then it needs to paste this data into the very curmudgeonly interface we use for work. I designed this app a long time ago while at a different company, and I used VC++ 6. I'm still using VC++ 6, but in a vbox with windows XP.
The code is being called as part of a bigger function that determines what exactly needs to be pasted into the work app spreadsheet. I have to call each item separately because the work app does not take copied tabs the way Excel would or whatever, it just ignores them. And it also pops up boxes and such that need to be handled in other ways.
The result works just fine under Windows XP, but when I do it under my regular Win7 box or on the Win7 boxes at work, it does not work properly.
This sets the data up, Text being the data to be pasted:
Code:
while (1) {
if (OpenClipboard() == FALSE) {
::Sleep(1);
continue;
}
HGLOBAL clipbuffer;
char * buffer;
EmptyClipboard();
[Code] ....
No infinite loops yet, again was just testing if it was OpenClipboard failing because it was being called again too quickly or something (and it did happen occasionally).
Then testing that the clipboard data is correct (this is always true), and pasting with keybd_event. SendInput is not available with VC++ 6.
Code:
HGLOBAL hglb;
LPTSTR lptstr;
LPTSTR buf = Text.GetBuffer(0);
while (OpenClipboard() == FALSE)
::Sleep(1);
[Code] .....
If the ::Sleeps are commented out, it will paste the wrong data almost every time under win7. It seems like it pretty much uses the last thing to be copied in the function and pastes it over and over (but not *always*). If I uncomment them, it will work as expected, but it obviously takes longer. With ::Sleep(50), it works about 80-90% of the time. Obviously I can't have the wrong data being pasted, and I'd prefer not to have to wait like this--and perhaps on a slower system or a system that is doing other things it may take longer and paste the wrong thing. It works fine on XP even without the sleeps.
Did keybd_event become a separate thread or something? Am I doing something wrong with the buffers? (I've tried using CSharedFile too with GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT settings, exact same thing.) Why does it work fine under XP but not under 7?
View 10 Replies
View Related