Liszt 23 Junior Poster

I try to change the icon for the application file in the debug folder. In the properties, there is no choise where you can do this but if I create a shortcut of this application file, then it is possible.

Is there a method to create an icon on the application file. It would be needed for the application file in the debugfolder and not the shortcut ?
Thank you..

Liszt 23 Junior Poster

Yes ofcourse, you are right. I forgot the quotes:

"C:\"

Now it works.

Thank you !!

Liszt 23 Junior Poster

I dont know if I did, I dont think so :-O

BTW, Did you put the path(s) between quotes?

Liszt 23 Junior Poster

Okay. In the Configuration Manager, I will then choose:

Active solution configuration: Release
Configuration: Release

If I do this, it will create files under C:\

Now comes another question. It creates about 12 different files.

My question will be this: My project is called "Form1". If I open this Folder in the Projects folder, I will have a folder called Debug that contains 4 files.
Cant I just take these 4 files and do a setup.exe file ?

Or does the Release any kind of debugging that makes it difficult to crack and open the code. I am a complete novice when it comes to this process.
Will the release be more secure against hackers (I dont know how to put this question but something like this)


Go to: Build>Configuration Manager Edit:: Sorry, I didn't read your question thoroughly :(

Liszt 23 Junior Poster

If you have done a program in VC++ 2008, what is the procedure to do a release and a "Finished" program of this.

In the "Form1 Property Pages", I have under General choosed:
Configuration: Release
Platform: Active(Win32)Output Directory: C:\
Intermediate Directory: C:\

When I now compile the application using F7, I thought that the finished release will be under C:\ but nothing is created there when doing this.
I am not sure about the differences of Output Directory and Intermediate Directory either.
I will be happy for the correct procedure how to do it.

Liszt 23 Junior Poster

This is true, I am checking for possibilities and in the end, I will be that careful to see what can be possible or it wont be, how to define things etc...

Liszt 23 Junior Poster

You could use the File::Exists to first check if that file exists and then it will not through an exception.

String^ FileOne = "C:\\File1.txt";
String^ FileTwo = "C:\\File2.txt";

if( File::Exists(FileOne) 
{
	File::Copy(FileOne, FileTwo);
}

or

String^ FileOne = "C:\\File1.txt";
String^ FileTwo = "C:\\File2.txt";

if( File::Exists(FileOne) 
{
	try
	{
		File::Copy(FileOne, FileTwo);
	}
	catch(Exception^ Ex )
	{
		MessageBox::Show("Something is wrong");
	}
}
Liszt 23 Junior Poster

Yes, that would be more than nice.
I think this would be the complete testcode if I dont miss anything out.


I think this would be the complete testcode and see what this MessageBox returns.
You would have to add the reference System::Management in "Add New Reference"

using namespace System::Management;

ManagementObjectSearcher ^searcher;  
ManagementObjectCollection::ManagementObjectEnumerator ^queryEnum;  
ManagementBaseObject ^objMgmt;  
  
searcher = gcnew ManagementObjectSearcher("SELECT * FROM Win32_Baseboard");  
  
ManagementObjectCollection ^queryCollection = searcher->Get();            
              
queryEnum = queryCollection->GetEnumerator();  
  
while(queryEnum->MoveNext())
{  
    objMgmt = queryEnum->Current;  
    MessageBox::Show(Convert::ToString(objMgmt->GetPropertyValue("SerialNumber")));  
}

If you post the complete program (or some test code) then we can test it on our computers to see what it returns.

Liszt 23 Junior Poster

I have come up with a code that look like this that is supposed to return the motherboard serialnumber.
The number that is returned is: "123456789000"

I wonder if that really could be correct or perheps do I miss something in the code. I am looking for a unique serial number ?

ManagementObjectSearcher ^searcher;  
ManagementObjectCollection::ManagementObjectEnumerator ^queryEnum;  
ManagementBaseObject ^objMgmt;  
  
searcher = gcnew ManagementObjectSearcher("SELECT * FROM Win32_Baseboard");  
  
ManagementObjectCollection ^queryCollection = searcher->Get();            
              
queryEnum = queryCollection->GetEnumerator();  
  
while(queryEnum->MoveNext())
{  
    objMgmt = queryEnum->Current;  
    MessageBox::Show(Convert::ToString(objMgmt->GetPropertyValue("SerialNumber")));  
}
Liszt 23 Junior Poster

I have found a link:
http://www.codeguru.com/forum/showthread.php?t=249788

I think I will go for checking the BIOS SerialNumber. In the link it seems to fail when doing this on Windows 98 or earlier but if a fail meens an emty string like: "" that will work for my purpose.

They refer to get the BIOS Serial like below but when gooling on that, I am not sure if I can find anything helpful of how to return this serial number.
I use VC++ 2008 Express Edition

GetBIOSSerial(); //Is this a call,  I cant find out if any namespace goes with this
tux4life commented: Finally someone which uses Google :) +4
Liszt 23 Junior Poster

Yes that is true, I really understand the problem with this, as Ancient said a good hacker have thought about ´all´ the possible ways.
I might just choose a way and wait for it to be cracked :P
As I have seen you can almost search for any software out there and find cracked versions.

We can just hope for some honest people who like the feeling to buy it as it should be. I wonder what the statistic is for that :)

Liszt 23 Junior Poster

Yes, that is true, myself I have 4 harddrives actually :) but the idéa was interesting anyway.. I will start search for methods and see what I can come up with.

Computers can also have multiple hard drives. And I've changed hard drives more frequently than NICs. Possibly there is some unique ID in the bios that can be retrieved, I don't know.

Liszt 23 Junior Poster

For the moment I am getting the computers name with this code, but perheps there could be others and better ways to get a computers unique "ID".
I am searching for a way to identify a computer so a software can recognice that computer in order to work.

The very best way should be a way where that Unique "ID" just cant be changed because that specific "ID" is used by other recources and systemfiles of the computer, to make things work.

SystemInformation::ComputerName;
Liszt 23 Junior Poster

thank you ArkM, I thought of that perheps can be a scenario that I haven´t thought about. I red about the ToLowerInvariant() and it seems to be the right approach for this purpose.

See also ToLowerInvariant() function:
http://msdn.microsoft.com/en-us/library/system.string.tolowerinvariant.aspx.
MS recommends ToLowerInvariant for OS identifiers (file names, registry keys etc)...

Liszt 23 Junior Poster

I use this command to check for the Computername wich returns:

SystemInformation::ComputerName->ToString();
//returns: MYCOMP-EG03R8F

When manually rightclicking "My Computer" and check what name I have, it says with lowcase letters:

mycomp-eg03r8f

So it doesn´t return the correct name. It shows Capitals.

But if I do this command instead:

SystemInformation::ComputerName->ToLower()->ToString();

I do get the same computername:

mycomp-eg03r8f


Is it okay to use ->ToLower() when it is a mix with letters and numbers. The function is intelligent and separates letters from numbers ?

Thank you if someone can confirm that...

Liszt 23 Junior Poster

Just an alternative on the way to open browsers:

String^ myURL = "http://www.google.com";

System::Diagnostics::Process::Start("iexplore.exe", myURL );

I beleive what you have to do is to extract the login and password as two strings and then create a new string (myURL) like this:

String^ myURL = "http://www.google.com";
String^ mylogin = "abc";
String^ myPassword = "def"

//New myURL
myURL = myURL + "/" + myUser + "/" + myPassword;

Hope it helps!

Alright so I'm working with a program that works with various email programs and I'd like to use it to automate the login process. I know I can open a browser using
ShellExecute(NULL, "open", "https://various.email.com/", NULL, NULL, SW_SHOWNORMAL);
but how would I actually parse the login/password strings into the text fields of the browser?

iamthwee commented: not pure c++ -4
Liszt 23 Junior Poster

I wonder if anyone know if VC++ 2008 express edition have the possibility to use Secure FTP (SFTP).
As I have understood that is not possible. (I am not talking about the SSL cerificate over FTP).

If not, I am searching for a library that goes with this. I have found "Chilkat" and "Curl" but cant figure out if this really works wich this GUI. Perheps there is any other alternative also that is a good idéa.
I am looking for a safe way for users to connect to a ftp server without Username and password to travel as clear text between the client and server.

For the moment I am using:

System::Net::FtpWebRequest^
Liszt 23 Junior Poster

This is working, found a solution.

RegistryKey^ rk;
rk = Registry::ClassesRoot->OpenSubKey("abc1\\asd123", true);

if (rk == nullptr)//key exist		
{
	 //Do Not Exists !!!
}

if (rk != nullptr) //key doesn't exist		
{
	 //Do Exists !!!
}

How would it be possible to check if a subKey exist in the Classes root in Registry Editor. My attemt is like follows but my compiler doesn´t like it.

'Microsoft::Win32::RegistryKey' : class does not have a copy-constructor
no conversion from 'nullptr' to 'Microsoft::Win32::RegistryKey'

Microsoft::Win32::RegistryKey subKey1 = Microsoft::Win32::Registry::ClassesRoot->OpenSubKey("one\\two");

	 if( subKey1 != nullptr ) //Exists ?
	 {
                         //do something
	 }
Liszt 23 Junior Poster

Okay, I will check the "=" out and see what that could meen. It is hard to googling answers when it comes to permissions for the Registry Editor.
I can only get quite diffus information and the problem is that I might need any "expertise" information of how sure you can be to create and see if that created subkey exists.

No, this is not the same question as my other post.

http://www.daniweb.com/forums/thread191370.html

isnt this a double post?

Well I dont know what subkeys are but the copy constructor error means that you cant use '=' operator to initialise another subkey, because its not defined.

Liszt 23 Junior Poster

I have a big question that keeps asking me if it is a correct or good idéa to create a subkey on a users computer in order for a software to work.

The software will create and check if that subkey exists in the below directory in order for that software to work.

What I am thinking of here. How sure can you be that it will be possible to create this subkey in this directory on a users computer.
(The user will buy a software and if this isn´t a good method or any problem will come up creating or read this subkey, there will be a lot of problem with other words)

Here I am thinking of Securitys for creating subkeys, read/write etc...
I am not really familiar what to think about here and so on.

Any idéas or advices are more than welcome.

Microsoft.Win32.RegistryKey PutKey = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey("First\\Second");
Liszt 23 Junior Poster

How would it be possible to check if a subKey exist in the Classes root in Registry Editor. My attemt is like follows but my compiler doesn´t like it.

'Microsoft::Win32::RegistryKey' : class does not have a copy-constructor
no conversion from 'nullptr' to 'Microsoft::Win32::RegistryKey'

Microsoft::Win32::RegistryKey subKey1 = Microsoft::Win32::Registry::ClassesRoot->OpenSubKey("one\\two");

	 if( subKey1 != nullptr ) //Exists ?
	 {
                         //do something
	 }
Liszt 23 Junior Poster

That seems interesting. I wonder how that is possible to do in this case.
Should I use UploadFile to overwrite that file on the server. I don´t know how the whole procedure will go for this ?

objRequest->Method = WebRequestMethods::Ftp::UploadFile;

I'm only a Noob but you should only need to save the file as it will overwrite it's self.

You're not saving the file, just closing the connection.

Liszt 23 Junior Poster
// Request to write						 
Stream^ newStream = objRequest->GetRequestStream();



//Write something to file for test
StreamWriter^ writer = gcnew StreamWriter(newStream);

for( int i = 0; i < 3; i++ ) 
{
	 writer->WriteLine("Hello");
}
writer->Close();
objResponse->Close(); //Closes the connection to the server;

I have succeded to Connect to my ftp.server and read the lines from the file(Code below)

Next step is to just "overwrite" the file with new lines(Above Code)
I have tried out the code above but when running that code, I get the error:

"Cannot send a content-body with this verb-type."

Wonder what I am missing ?


(Complete Code Below)

//First a request to FTP Server shall be initiated, requesting the file needed. 
String^ FilePath = "ftp://onewebsite.com:21/fileFolder/file1.txt";

//Create just "Creates" a new WebRequest for that path, then comes the actions:
FtpWebRequest^ objRequest = (FtpWebRequest^)WebRequest::Create(FilePath);
objRequest->Credentials = gcnew NetworkCredential("username", "password");			 



//Then, we have to get the response for this request:
FtpWebResponse^ objResponse = (FtpWebResponse^) objRequest->GetResponse();
			 
//Get the stream of file:
Stream^ responseStream = objResponse->GetResponseStream();




//read the file;
List<String^> Lines = gcnew List<String^>();
StreamReader^ reader = gcnew StreamReader(responseStream);

 while( reader->Peek() >= 0 )
 {
	 Lines.Add(reader->ReadLine()); //Save all Lines in the field;
 }
 //Close
 reader->Close();
 responseStream->Close(); //close the stream after reading;





// Request to write						 
Stream^ newStream = objRequest->GetRequestStream();



//Write something to file for test
StreamWriter^ writer = gcnew StreamWriter(newStream);

for( int i = 0; i < 3; i++ ) 
{
	 writer->WriteLine("Hello");
}
writer->Close();
objResponse->Close(); //Closes the connection to the server;
Liszt 23 Junior Poster

This was a good guide, I am reading it right now but it is very much to read and not really a practical example where you can follow the whole procedure, it is "just" fragments of pieces for different functions.
It is difficult to get the right picture.

I have also found something that declares this. I wonder if that could be a start. In some way, I must need some kind of

::hostname,
::username,
::password

to the ftp server etc...

The goal is to read/write to the file "Folder1\\File1.txt" on the "ftp.myaddress.com".

I dont really know if this line is a start for something:

using namespace System::Net::Sockets;

 TcpClient^ mtTCPClient = gcnew TcpClient();

 mtTCPClient->Connect( "ftp.myaddress.com", 25 );
Liszt 23 Junior Poster

Yes that is really a problem.. It is kind of a impossible mission in a way... The problem is that it probably will be a crackversion out on the net after a while if the software seems interesting how brilliant your idéa even was.

Poor us developers...

Liszt 23 Junior Poster

Yes perheps, I might have many idéas :)

Liszt 23 Junior Poster

I have for example a ftp server with the address ftp.mywebsite.com
On this ftp server I have a path: FileFolder\\file1.txt

What I wonder is how it would be possible to connect to this ftp server and read/write to that file.
Is there any good articles of how this is done etc... It is a new area for me.

Would be glad for advice..

Liszt 23 Junior Poster

Its true, it isn´t very easy to protect a software.
I have checked around on google and found some products.

I might have a mehtod I am thinking of that hopefully will cutoff and make it harder to copy the software and that would be to activate the software with example their emailaddress against a ftp server and some things to that...

I might get a look on how to connect to a ftp server and read/write a databasefile using C++ code...
Hopefully it is possible to read/write a Textfile on a ftp.server.

Liszt 23 Junior Poster

I have a general question about how it would be possible to protect a software from copying.

I have done a software that will be able to download from a website, the user will install the software on his/hers computer.

How could it be possible to protect this software from copying.
I would be more than happy for any idéas or advice ?

Liszt 23 Junior Poster

In a way yes, honestly but it is for about 3000 customers for my company where I will give them advertisment and as the customers increases there would be good to be able to send the email quickly.

As I understand this depends of the smpt.gmail.com server but I have heard and red that this could be sent through my own computers instead of that server.

In other word use my computer as a smtp server ?
Should that meen that I could add or change some code in my emailcode now or how would that work.

Thank you...

Why would you want to do that anyway? Smells like an email-bomb to me, and that would be against the rules.... :icon_wink:

Liszt 23 Junior Poster

I have used the code above to send 10 emails to myself in that loop.

As I notice it takes about 1 second per email to be delievered.

Why does it take so long time ?
For example why will not all 10 emails be sent in only 1 second ?
What is the bottleneck here ?

I wonder what could be possible to do, to increase this speed ?

Liszt 23 Junior Poster

Thanks Narue, I did get the idéa of how that is built up then, so I did a change for that also and it works.

I do have 2 questions. I have set up the code so the code loops through 2 emails wich works fine. I have put some code outside the loop to make it goes faster.

1. What I wonder is if there is anything else I can do to make the loop to send these 2 emails faster or is this the fastest possible way to set up this ?

2. Then I wonder for this catch().
What happens in the catch(), I know that it is an exception, does it meen that the email wasn´t sent succesfully ? Is this when the catch is called and important to know, if there will be any errorbox(MessageBox) showing if this happens or if it only happens internally in the program where I can save this to a logfile or myself show a MessageBox ?

SmtpClient client(smtp.gmail.com);
client.Port::set(587);
MailMessage^ mm; //Declare

client.EnableSsl = true; //Depending on server SSL Settings
System::Net::NetworkCredential^ NetworkCred = gcnew System::Net::NetworkCredential(); //My UserName and password;
NetworkCred->UserName = "From@gmail.com";
NetworkCred->Password = "Password";
client.UseDefaultCredentials = true;
client.Credentials = NetworkCred;


	 List<String^>^ EmailList = gcnew List<String^>;
	 EmailList->Add("To1@hotmail.com");
	 EmailList->Add("To2@hotmail.com");



	 //Send 2 Emails;
	 for( int i = 0; i < 2; i++)
	 {
						
	 mm = gcnew MailMessage(EmailFrom->Trim(), EmailList[i]->Trim());
	 mm->Subject = "Hello";
	 mm->Body = "Message";

		
		try
		{
			 client.Send(mm);
			 delete mm;
		}
		catch(System::Net::Mail::SmtpException^ e)
		{
			//...Error handle
		} …
Liszt 23 Junior Poster

Thank you Cikara21 this really got me further very fast as I know a bit how to do it from ASP.net.
I have tried to develop you code a bit where I beleive I need to put UserName and Password for the email that is sending from and also a subject and a body like this.

However if I compile the code, there will be errormessages saying:
'System::Net::NetworkCredential' : class does not have a copy-constructor
'System::Net::Mail:: SmtpClient::Credentials::set' : cannot convert parameter 1 from 'System::Net::NetworkCredential' to 'System::Net::ICredentialsByHost ^'

In ASP.net it works but perheps C++ does this in a little different way when "logging in" to the EmailAccount that will send the email ?

MailMessage^ mm = gcnew MailMessage(From@gmail.com, To@gmail.com);

mm->Subject = "Hello !";
mm->Body = "This message will be sent !";
			 
SmtpClient client(smtp.gmail.com);
client.Port::set(587);

		
try
{

client.EnableSsl = true; //Depending on server SSL Settings
System::Net::NetworkCredential NetworkCred = gcnew System::Net::NetworkCredential(); //My UserName and password;

    NetworkCred.UserName = "From@gmail.com";
    NetworkCred.Password = "This is the password";
    client.UseDefaultCredentials = true;
    client.Credentials = NetworkCred;
	 client.Send(mm);
	 delete mm;
}
	catch(System::Net::Mail::SmtpException^ e)
	{
		//...Error handle
	}
Liszt 23 Junior Poster

Thank you Comatose,

I am prepared to learn all that ugly mess because I really have the ambition to do this in C++. = )
I have done a program in ASP.net on a webpage with a lot of code in C# for ASP.net wich works fine, but the syntax and classes are not really the same in ordinary C++.
However what parameters I have that I dont know how to set up in C++ code is:

EmailTo: To@gmail.com
EmailFrom: From@gmail.com

Subject: "Hello"
BodyMessage: "This message will be sent !"
SmtpClient: "smtp.gmail.com"
Port: 587

Any beginning of code to have a path to start out with would be very appreciated.

Liszt 23 Junior Poster

I might ask the question different as I now understand that it is different to send mail througth C++ and ASP.net.
I about know to to this in ASP.net but not C++.

What I want to accomplish is to send:
Subject: "Hello"
Message: "This is the mailmessage"

from email: testfrom@hotmail.com
to this email: testto@hotmail.com

I think I ask the question that simple for a start.
I have looked at examples on google but there is only very complex ones...

Liszt 23 Junior Poster

I am trying to set up an emailprogram, the first code that I try to compile is this where I set an emailTo and emailFrom in the arguments of MailMessage.

When I compile this code, I have an errormessage that says.
'System::Net::Mail::MailMessage' : class does not have a copy-constructor

What does this meen, am I doing this wrong ?

using namespace System::Collections::Generic;
using namespace System::Web;
using namespace System::Net::Mail;
using namespace System::Threading;

String^ EmailRecipient = "testTo@hotmail.com";
String^ EmailFrom= "testFrom@hotmail.com";

MailMessage mm = gcnew MailMessage(EmailRecipient, EmailFrom);
Liszt 23 Junior Poster

I have developed an application in Visual C++ 2008 Express Edition.
In order to run a program on your computer you will need the Microsoft .NET Framework 3.5 installed on your computer from this link:
http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6&displaylang=en

Now if I will distribute my program and make a setup.exe file for this application made in VC++, this setup will distribute out the files on the computer for the application made.

But what is missing now for the user is this .NET Framework 3.5 to be able to open this program.

Instead of download this from the link and install it like that, is there any flexible method for this when you will use and install a program made in VC++ ?

Liszt 23 Junior Poster

You are right, I will use this command and this will find the correct folder on the computer..

System::Environment::GetFolderPath()

SUGGESTION :

use SpecialFolder for app settings..

Liszt 23 Junior Poster

Ok, but that cant really be safe enough. If I have set C:\\ in my code and that computer uses D:\\ the application will not be possible to use because it depends on to find info on C:\\.

There must be any other solution to it but have difficult finding but is searching around..
Is it possible and correct to iterate through A:\\ --> Z:\\ to see if it exists and if it is okay to do this, how would it be possible to see if for example: C:\\ exists like File::Exists() ?


Perheps this is correct to do:

System::IO::Directory::Exists("C:\\");

It's generally a safe bet that the Windows systems you listed will have a C: drive.

Liszt 23 Junior Poster

I have made a program that stores a file like this:

ofstream out;
out.open("C:\\reg.txt");

This file is used everytime a program starts in order to find if the encrypted password is correct within this file.
This works without any problem on my computer, using XP Proffessional and where I know that I have a C:\\ path.

The big question for me now is, that I need to make this portable for the systems below as much as possible.
The problem is that you can never know if the current computer that run the program has a C:\\, F:\\, R:\\, O:\\ and so on...
This is unknown information as I understand.

So my question is how I will solve something like this so it also will work for the systems below wich also could use different paths ?


XP Proffessional
XP Home Edition
Windows Vista
Windows 98
Windows ME
Windows NT
Windows 2000
Windows server 2003

Liszt 23 Junior Poster

Sky Diploma,

Now I understand the idéa of encryption. My example was very simple just to understand.
I will be able to do something complex out of this.

Many thanks !!!

Liszt 23 Junior Poster

Thank you...
Yes I did search for "encryption C++" etc.. but only very complex example were shown.

So that is the idéa of encrypt. So "Hello" encrypted as a very simple example could look like this:

"H0e0l0l0o"

Loop though the characters and do whatever you feel is adequate. Not much to beginners level "encryption." So go write it!

I assume you used a search engine? Other wise look up "cipher," and "c++ encryption."

Liszt 23 Junior Poster

If I have this string:

"Hello"

How would I do to encrypt this string ?

Liszt 23 Junior Poster

Okay, I beleive this is what I want to do then.
To store them in an encrypted file. Is this files like *.ini ?

If I will store this encrypted file under C:\\
How is an encrypted file created. How do I make an encrypted file
out of Username: user1 and Password: secret1

Then I would also need to read this encrypted file in order to check that the user/password is correct ?
I have only worked with read/write with .txt files before.

Those registry functions are only available on MS-Windows 2000 and newer. They are definitely not available on *nix, and possibly not on Win95/98/Me/NT

If you want complete portability then I would suggest you store them in an encrypted file instead of the windows registry.

Liszt 23 Junior Poster

After research I have found and been able to set up this code.
What happens when running this code is that I will in "RegEdit" create:
HKEY_CURRENT_USER\\Software\\My Product
and 2 keys to that.

What I wonder is when doing this, it works on XP Proffessional as I have.
Will this path: (HKEY_CURRENT_USER\\Software)
also be found in:
XP Home Edition
Windows Vista
Linux
Unix / Variants
Windows 98
Windows ME
Windows NT
Windows 2000
Windows server 2003

How portable is the code below ? What path would be the one that all of the above Operative systems have by default and for the below code to work... ?

RegistryKey^ currentUser;
RegistryKey^ softwareKey;

try
{
RegistryKey^ currentUser = Microsoft::Win32::Registry::CurrentUser;
RegistryKey^ softwareKey = Microsoft::Win32::Registry::CurrentUser->CreateSubKey("Software\\My Product");

softwareKey->SetValue("Description", "Description of my product");
softwareKey->SetValue("Version", "1.42");

}
	 catch(Exception^ ex)
	 {
		 MessageBox::Show(ex->Message);
	 }
	 __finally
	 {
		 if(softwareKey) softwareKey->Close();
		 if(currentUser) currentUser->Close();
	 }
Liszt 23 Junior Poster

In simple words:

How would I work with the Registry (Regedit) programatically in order to save Username from textBox1->Text and Password from textBox2->Text.

How will I in an encrypted way store/write these to the registry and how will I then read from the registry to understand that These has been registrated there ?

I have found this link:
http://www.codeguru.com/columns/dotnettips/article.php/c8859

Here they are talking about ex: "Creating a New Registry Key and Value"
Is this close to what I want to do etc... ?

Liszt 23 Junior Poster

>> Under MS-Windows the correct way to do it is to save the UserName and Password in the registry -- and encrypt the password

Thank you for this information. I have looked at the class code that was linked in the previous post and also googled around a lot of things about this subject but find it hard to understand of how to do. ("It is not really ordinary C++")

I do understand the logic of that I would check against the registry if user/password is registered there as encrypted etc and take this into considiration when promting the registerpanel or not in the application.

To be honest I have no clue of how to begin this. I dont know where and how I will put this Username and password in the registry. (I dont know what is what here really in the registry/regedit).

Would I put the class CRegistry{}; outside the Form class{}; as a beginning ?
And from here I would begin to do something. The ordinary C++ code will not be any problem, only the syntax and calls and how and where to write and read things from the registry(regedit) etc...
If I could get a startingpoint in where to understand of how to do this, that would be wonderful. I find this very interesting to learn...

Thank you


Under MS-Windows the correct way to do it is to save the UserName and Password in the registry …

Liszt 23 Junior Poster

I have done a windows form application that I have debugged in "Release Mode".

I need to ask 2 questions at the same time because I think they depend on eachother and that is my questionmark:

1. When starting this program, there will be a panel visible where you will enter: UserName and Password and when you write these correct the panel will be panel1->Visible = false; and some other buttons on the form will be ->Enabled = true; etc...

2. Now is the question also when you have written the correct Username and password I would like the panel to never show up again as you have written the correct one, once.

How would this be possible to do ?

I know that I could create a .txt file that contains any information under for example: C:\\Windows\\registerdoc.txt
that the application reads from in order to not show the panel1 but can this really be the correct way to do this and other computers perheps doesn´t use C:\\ but for example G:\\ and so on ?

Liszt 23 Junior Poster

Release mode seems to work.
It created under C:\\
Form1 (application)
Form1 (Incremental Linker File)
Form1 (Program Debug Database)

I suppose now that with these 3 files that you cant open them in VC++ and see the code behind...

Thank you...

that's rite..u can use "release mode"..and then hide ur codes somewhere..

Liszt 23 Junior Poster

Visual Studio 2008\Projects\Form1

This folder Form1 contains many things, Debug Folder, Form1 Folder and .h files etc...

The thing is that the goal is to create a real program of this. Now the folder just contains a lot of C++ files and .h files when debugging in "Active(Debug).

I am not sure how to ask the qeustion but what I initially want to do is to do a "Final Compile" so this program will be a program to use and where the "code is closed" as most/all programs are.

Will I use "Release mode", would I create a .DLL file out of the whole Form1 project.(The folder contains 38 files) I am not sure how to start out this.


Maybe as a DLL?
But, what's so "secret and special" about your code, are you embarrassed by it?