Click here to Skip to main content
15,909,498 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionsimulation keyboard simulation trouble with app using DirectInput Pin
blue_rabbit5-Feb-06 15:50
blue_rabbit5-Feb-06 15:50 
AnswerRe: simulation keyboard simulation trouble with app using DirectInput Pin
Christian Graus5-Feb-06 16:40
protectorChristian Graus5-Feb-06 16:40 
GeneralRe: simulation keyboard simulation trouble with app using DirectInput Pin
blue_rabbit6-Feb-06 15:25
blue_rabbit6-Feb-06 15:25 
QuestionDirectX problems Pin
gr8coaster3295-Feb-06 14:26
gr8coaster3295-Feb-06 14:26 
AnswerRe: DirectX problems Pin
suchuhui5-Feb-06 19:12
suchuhui5-Feb-06 19:12 
GeneralRe: DirectX problems Pin
gr8coaster3296-Feb-06 12:28
gr8coaster3296-Feb-06 12:28 
AnswerRe: DirectX problems Pin
gr8coaster3296-Feb-06 13:53
gr8coaster3296-Feb-06 13:53 
QuestionHelp needed to check this code below... !!! Pin
amano8u5-Feb-06 13:51
amano8u5-Feb-06 13:51 
Hi All,

I am a noob with VC++ coding so spare with me. I am trying to create an GUI application that will allow the user to create email accounts in Outlook Express. Something like a simple version of the Wizard itself.

The form has 3 fields, where the first field will Propagate the "Display Name", 2nd field will be there "User ID = email address" and 3rd field is their "password".

I am using the following code:

<br />
<br />
void CEmailDlg::OnBnClickedButton1()<br />
{<br />
<br />
	//get Data from form and convert cstring to string<br />
<br />
	UpdateData( TRUE );<br />
	CString custaddy;<br />
	CString custpass;<br />
	custaddy = custuser;<br />
	DWORD dwVal = 0;<br />
	DWORD dwDial = 3;<br />
	CString URL = "someURL";<br />
	CString POP3 = "somePOP3";<br />
	CString SMTP = "someSMTP";<br />
	CString connectoid = "Dial-up";<br />
	int userlength = custuser.GetLength();<br />
	if (!custuser.Right(12).CompareNoCase("@realm"))<br />
<br />
	{<br />
		userlength = userlength - 12;<br />
		custaddy = custuser.Left(userlength);<br />
		custaddy += (_T("@realm"));<br />
		<br />
	}<br />
<br />
	else if (!custuser.Right(17).CompareNoCase("@anotherrealm"))<br />
<br />
	{<br />
		userlength = userlength - 17;<br />
		custaddy = custuser.Left(userlength);<br />
		custaddy += (_T("@anotherrealm"));<br />
	}<br />
<br />
	else<br />
<br />
	{<br />
		CString msgString = "Please make sure you enter you full Dial-up email address.  This will be in the format of 'username@realm'.";<br />
		AfxMessageBox( msgString, MB_OK | MB_ICONEXCLAMATION );<br />
		return;<br />
	}<br />
<br />
	AfxMessageBox("Your email address will now be configured.  Click the OK button to proceed.");<br />
	HKEY hKey;<br />
	unsigned long dwDisp;<br />
<br />
<br />
	//open key for Default email profile<br />
	if(RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Internet Account Manager"), 0,<br />
		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS)<br />
<br />
	{<br />
		//set value for default email profile<br />
		RegSetValueEx(hKey, "Default Mail Account", 0, REG_SZ,(BYTE *)(LPCTSTR)custaddy,lstrlen(custaddy));<br />
<br />
		//close reg key<br />
		RegCloseKey(hKey);<br />
	}<br />
<br />
<br />
<br />
	//create reg key for email<br />
	if (RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Internet Account Manager\\Accounts\\"+custaddy+""), 0,<br />
		NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS)<br />
<br />
	{<br />
<br />
		//set values for email key<br />
		RegSetValueEx(hKey, "POP3 Server", 0, REG_SZ,(BYTE *)(LPCTSTR)POP3,lstrlen(POP3));<br />
		RegSetValueEx(hKey, "SMTP Server", 0, REG_SZ,(BYTE *)(LPCTSTR)SMTP,lstrlen(SMTP));<br />
		RegSetValueEx(hKey, "POP3 User Name", 0, REG_SZ,(BYTE *)(LPCTSTR)custuser,lstrlen(custuser));<br />
		RegSetValueEx(hKey, "SMTP Display Name", 0, REG_SZ,(BYTE *)(LPCTSTR)custname,lstrlen(custname));<br />
		RegSetValueEx(hKey, "SMTP Email Address", 0, REG_SZ,(BYTE *)(LPCTSTR)custaddy,lstrlen(custaddy));<br />
		RegSetValueEx(hKey, "Account Name", 0, REG_SZ,(BYTE *)(LPCTSTR)custaddy,lstrlen(custaddy));<br />
		RegSetValueEx(hKey, "Connection Type", 0, REG_DWORD,(const BYTE *)&dwDial,sizeof(dwDial));<br />
//		RegSetValueEx(hKey, "Connectoid", 0, REG_SZ, (BYTE *)(LPCTSTR)connectoid,lstrlen(connectoid));<br />
		RegSetValueEx(hKey, "POP3 Password2", 0, REG_BINARY,reinterpret_cast<const BYTE*>(static_cast<LPCTSTR>(custpass)),(custpass.GetLength()+1)*sizeof(TCHAR));<br />
		RegSetValueEx(hKey, "SMTP Use Sicily", 0, REG_DWORD,(const BYTE *)&dwVal,sizeof(dwVal));<br />
//		RegSetValueEx(hKey, "POP3 Prompt for Password", 0, REG_DWORD,(const BYTE *)&dwVal,sizeof(dwVal));<br />
<br />
		//close reg key<br />
		RegCloseKey(hKey);<br />
	}<br />
<br />


But the problem with this is, i am unable to get the password stored properly as a Binary format.

Can anyone have a look and give a solution for this code?

Thank you in advance.

amano
AnswerRe: Help needed to check this code below... !!! Pin
PJ Arends5-Feb-06 14:36
professionalPJ Arends5-Feb-06 14:36 
GeneralRe: Help needed to check this code below... !!! Pin
amano8u5-Feb-06 14:41
amano8u5-Feb-06 14:41 
QuestionLast call for help... HEEEELP!!!! Pin
Lord Kixdemp5-Feb-06 11:03
Lord Kixdemp5-Feb-06 11:03 
AnswerRe: Last call for help... HEEEELP!!!! Pin
PJ Arends5-Feb-06 12:02
professionalPJ Arends5-Feb-06 12:02 
GeneralRe: Last call for help... HEEEELP!!!! Pin
Lord Kixdemp5-Feb-06 16:04
Lord Kixdemp5-Feb-06 16:04 
AnswerRe: Last call for help... HEEEELP!!!! Pin
Christian Graus5-Feb-06 15:23
protectorChristian Graus5-Feb-06 15:23 
GeneralRe: Last call for help... HEEEELP!!!! Pin
Jeremy Falcon5-Feb-06 17:54
professionalJeremy Falcon5-Feb-06 17:54 
GeneralRe: Last call for help... HEEEELP!!!! Pin
Stephen Hewitt5-Feb-06 18:49
Stephen Hewitt5-Feb-06 18:49 
GeneralRe: Last call for help... HEEEELP!!!! Pin
PJ Arends5-Feb-06 18:51
professionalPJ Arends5-Feb-06 18:51 
GeneralRe: Last call for help... HEEEELP!!!! Pin
Christian Graus6-Feb-06 9:00
protectorChristian Graus6-Feb-06 9:00 
GeneralRe: Last call for help... HEEEELP!!!! Pin
Christian Graus6-Feb-06 9:01
protectorChristian Graus6-Feb-06 9:01 
AnswerRe: Last call for help... HEEEELP!!!! Pin
_anil_5-Feb-06 15:58
_anil_5-Feb-06 15:58 
GeneralRe: Last call for help... HEEEELP!!!! Pin
Lord Kixdemp8-Feb-06 10:59
Lord Kixdemp8-Feb-06 10:59 
Question2872: 'IServiceProvider' : ambiguous symbol Pin
JerryMcguire5-Feb-06 8:46
JerryMcguire5-Feb-06 8:46 
AnswerRe: 2872: 'IServiceProvider' : ambiguous symbol Pin
ThatsAlok5-Feb-06 17:37
ThatsAlok5-Feb-06 17:37 
Questionmotherboard serial number in VC++ Pin
RomTibi5-Feb-06 7:07
RomTibi5-Feb-06 7:07 
AnswerRe: motherboard serial number in VC++ Pin
John M. Drescher5-Feb-06 8:12
John M. Drescher5-Feb-06 8:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.