Lukezzz 0 Posting Whiz in Training

Yes the OpenFile() should be null there as you say. I had the messageBoxes after each declaration and had actually 4 error messages the FIRST loop, then the second loop I did not get any error messages and the file was created fine.
It is little spooky, I have sent these to the support of those functions to see if I miss something. The code in their documenation is for C# so something might perheps dont be the same for C++.

As seen I have put 30 cycles in that loop now and I tried to upload the file 10 times now and it did succed 10/10 times, which is a good indication.

If it doesn´t succeed, a messageBox will tell to try in a few seconds again. Perheps I will be happy with this, what do you think ?

int succeded = 0;
String^ LongString = "testString";

for( int i = 0; i < 30; i++ ) //try 10 times
 {
	 succeded = 0;
	 Thread::Sleep(5);

	try
	{
			for( int aaa = 0; aaa < 1; aaa++ )//just for break
			{									
				Chilkat::SFtp^ sftp = gcnew Chilkat::SFtp();
				
				if( ! sftp->UnlockComponent("dummy") ){succeded = 1; break;}//Check if succeded

				sftp->ConnectTimeoutMs = 5000; 
				sftp->IdleTimeoutMs = 15000;

				long port = 2222;
				String^ hostname = "dummy.host.com";
												
				if( ! sftp->Connect(hostname, port) ){succeded = 1; break;}//Check if succeded
				
				if( ! sftp->AuthenticatePw(tr1,tr2) ){succeded = 1; break;}//Check if succeded
				
				if( ! sftp->InitializeSftp() ){succeded = 1; break;}//Check if succeded


				String^ handle1;

				handle1 = sftp->OpenFile("Folder1/Folder2/testFile.txt", "writeOnly", "createTruncate");
				if( handle1 …
Lukezzz 0 Posting Whiz in Training

yes I did check that before also.

It is not possible to write:
sftp->openFile in my compiler... this will be a compileError.

The container only have "OpenFile" with a versal like that.

So still the if( handle == 0 ) is confusing as it later is expected as String^ in the first argument. (I am still trying with your approach)

Lukezzz 0 Posting Whiz in Training

Yes I will go back and put all statments as you said from the beginning.
I just get confused as in their documenation they use bool succes in the way I showed here.

I dont know what return type the OpenFile() returns but the 1 page documentation for the whole scenario is here if you want to see. I just cant understand how if( handle1 == 0 ) in their documentation, as you say I also looks for an integer type from somewhere but cant find it.
http://www.example-code.com/mfc/sftp_writeUtf8.asp

I will put it like you said from the beginning now and check everything and I will tell what this leads me soon.

Lukezzz 0 Posting Whiz in Training

Yes you are right, I will have to check every statement and see if that succeds.
I have checked their documentation and I can put a boolean to see if things will be true or false and then show a messagebox with the error.

In their documentation they are writing "const char * hostname" and "const char * handle1"

I beleive that is for C# ? Because when I compile that I receive errors:
"cannot convert parameter 1 from 'const char *' to 'System:: String ^'"
cannot convert from 'System:: String ^' to 'const char *'

I beleive I can write: String^ hostname;
But I am more confused of const char * handle1 as the comparison below is:
if ( handle1 == 0 )

bool success = false;
								
long port = 2222;
const char * hostname = "dummy.host.com";
								
success = sftp->Connect(hostname, port);
if( success != true ){MessageBox::Show(sftp->LastErrorText->ToString());}//Check the error


const char * handle1;
handle1 = sftp->OpenFile("Folder1/Folder2/testFile1.txt", "writeOnly", "createTruncate");
if( handle1 == 0 ){MessageBox::Show(sftp->LastErrorText->ToString());}//Check the error
Lukezzz 0 Posting Whiz in Training

I did notice that this code does not work anyway.

The first time, it did upload the file to the server and showed the messagebox that it succed to create the file. That was correct.

I deleted the file on the server and runned the code again. I received the messagebox that the file was created succesfully but the file was not created this time.

My idéa here was the check the very last thing that happens, where I close the file.
I think this must be enough to check this as if the file was not created there is no file to close ?

So if closing the file returns true then I did assume that everything above went well:
if( sftp->CloseHandle(handle1) )

So I then wonder how this is possible ?

int succeded = 0;
try
{
		String^ LongString = "textString";
		Chilkat::SFtp^ sftp = gcnew Chilkat::SFtp();
		sftp->UnlockComponent("dummy");
		
		sftp->ConnectTimeoutMs = 5000; //  Set some timeouts, in milliseconds:
		sftp->IdleTimeoutMs = 15000;

		int port = 2222;
		String^ hostname = "dummy.host.com";
		sftp->Connect(hostname, port);
		sftp->AuthenticatePw(tr1,tr2);
		sftp->InitializeSftp(); //  After authenticating, the SFTP subsystem must be initialized:


		String^ handle1 = sftp->OpenFile("Folder1/Folder2/testFile.txt", "writeOnly", "createTruncate");
		sftp->WriteFileText(handle1,"ansi", LongString); //  Write some text to the file:
		
		if( sftp->CloseHandle(handle1) )
		{
			succeded = 1;
			MessageBox::Show("File successfully created!", "Info ", MessageBoxButtons::OK, MessageBoxIcon::Information);

			Application::DoEvents();
			can_exit = true;
			this->Close();
			break;
		}
		
}
catch(Exception^ ex){}


if( succeded == 0 )
{
	MessageBox::Show("File not created", "Info ", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
Lukezzz 0 Posting Whiz in Training

Thats wonderful, I have not really thought about in that way, then I feel comfortable to check it like that as for other parameters.

Thanks alot for your help!

Lukezzz 0 Posting Whiz in Training

I understand that sounds wonderful. I have to ask about one detail though of how to set up this parameter. Do I need to first connect and then check this in the if statment or will I just write the if statement.

For example do I need the first line here ?

sftp->Connect(hostname, port);

if (sftp->Connect(hostname, port)) {
  //perform your transfer if true/non-zero
} else {
  //error handling if false or zero
}
Lukezzz 0 Posting Whiz in Training

No I have not tried that.. I am not sure how to do it.
Without testing,

Are you sure that your example is correct there ?
I just have to be sure, because if I test that code and if it works I dont know if it is depending on that as my code sometimes work but it seems logical ?

Lukezzz 0 Posting Whiz in Training

thelamb, you are right, I am expected to check the return value. Actually I have not needed to do that until now, so I am not sure of how to check that.

I got this answer from them but have not got any other answer in over 2 days, so I might ask here then.

(Their answer)
>> You should be checking the return value of each call to a Chilkat method
to see whether it succeeded or not.
If it did not, then you should not proceed with the remainder. For
example, if
sftp->Connect(hostname, port);
returns false, then don't continue...

So as an example. How to check if return value is true or false here ?:

sftp->Connect(hostname, port);
Lukezzz 0 Posting Whiz in Training

Thanks cgcgames, in a way you were right here. The error shouldn´t pop up.
Actually the error was not directly for the flashcontrol.

I was putting this line in the _Load event of the form:
panel1->Controls->Add(AxShockwaveFlash1);

The thing was that the panel1 was not constructed yet so it couldn´t be added.

So I put the code in the _Shown event of the Form:
panel1->Controls->Add(AxShockwaveFlash1);

And now I dont receive the error. However a small questionmark there was that if flash was installed it was okay to have the code in the _Load event. So a bit confusing but in a way it make sense.

Thanks

Lukezzz 0 Posting Whiz in Training

Hi,

I have a code where I upload a file to a server. The code is shown below.
As seen I use a loop to try to connect 10 times if attempts is failing.

I have also put this in a try/catch block and at the end, I am showing a messagebox with confirmation that the file was created on the server.

The problem is this now. Sometimes the file is created and sometimes the file is Not created.
When the file is Not created, the messageBox is shown anyway. This is what I dont understand and that is the problem.

If the code have reached the messageBox it means that the above code has succeded but that is not the case, the file is not created on the serverpath.

How can this happen and can be done ?

Thank you...

for( int i = 0; i < 10; i++ ) //try 10 times
 {
 Thread::Sleep(200);

try
{
	String^ LongString = "stringWithText";
	Chilkat::SFtp^ sftp = gcnew Chilkat::SFtp();
	sftp->UnlockComponent("dummy");
	
	sftp->ConnectTimeoutMs = 5000; //Set some timeouts, in milliseconds:
	sftp->IdleTimeoutMs = 15000;

	int port = 2222;
	String^ hostname = "dummy.hostname.com";
	sftp->Connect(hostname, port);
	sftp->AuthenticatePw("userName","passWord");
	sftp->InitializeSftp(); //After authenticating, the SFTP subsystem must be initialized:


	String^ handle1 = sftp->OpenFile("Folder1/Folder2/testFile.txt", "writeOnly", "createTruncate");
	sftp->WriteFileText(handle1,"ansi", LongString); //Write some text to the file:
	sftp->CloseHandle(handle1);
	MessageBox::Show("Successfully sent", "Info ", MessageBoxButtons::OK, MessageBoxIcon::Information);

	Application::DoEvents();
	this->Close();
	break;
		
}
catch(Exception^ ex){}
}
Lukezzz 0 Posting Whiz in Training

Yes I understand that the player needs flash in order to play it so my idea was to "try" to play it in a try/catch block and hopefully it would just through an exception without showing the error like it does now.

I still searching for a solution to it since it could fail like in this scenario. The idea was that the try{} would have take care of all possible scenarios but something might be missing here or any other idea ?

Lukezzz 0 Posting Whiz in Training

Hello,

I use a a flashcontrol in the Form application. If I have Flash installed on the computer, the control plays the movie fine.
If I uninstall the flash from the computer, I receive this error when opening the form.

I have tried to put this code inside a try{} catch(){} block to prevent this error but that did not help.

Is there any other idéa of how to prevent this error. If I take the code inside the try{} away, I dont receive the error so
it depends on this. Thanks!

Error:
HRESULT: 0x80040154(REGDB_E_CLASSNOTREG))

AxShockwaveFlashObjects::AxShockwaveFlash^ AxShockwaveFlash1 = gcnew AxShockwaveFlashObjects::AxShockwaveFlash();

String^ movieURL = "MovieURL...";

try
{
		if( String::IsNullOrEmpty(movieURL) == false )
		{ 
			panel1->Controls->Add(AxShockwaveFlash1);
			AxShockwaveFlash1->BackgroundColor = 0;		 
			AxShockwaveFlash1->Movie = movieURL;
			AxShockwaveFlash1->Base = movieURL;
			AxShockwaveFlash1->AllowFullScreen = "false";
			AxShockwaveFlash1->AllowScriptAccess = "sameDomain";
			 				 
			 
			AxShockwaveFlash1->EmbedMovie = true;
			AxShockwaveFlash1->Enabled = false;

			AxShockwaveFlash1->Size = System::Drawing::Size(425, 55);				 
			AxShockwaveFlash1->Location = System::Drawing::Point(1, 25);
			AxShockwaveFlash1->Play();
		}
}
catch(Exception^ ex){}
Lukezzz 0 Posting Whiz in Training

I have done some progress and wonder if this is enough and correct:

This is what I have done:
In Project/Properties/C/C++/Code Generation/Runtime Library, I have put those settings which DO compiles:

Release:
Multi-threaded DLL (/MD)
Debug: Multi-threaded Debug (/MTd)

When I do this the debug.exe file will be 10.3 MB and the release is 10.1 MB(less in size).

This .exe file actually DO run on the XP computer that doesn´t have VC++ 2008 Express Edition installed.

Is this correctly done ?

Lukezzz 0 Posting Whiz in Training

>> http://www.ferdychristant.com/blog//articles/DOMM-6XPRW9

I found this article that says this:
1. In the project properties Window, section C/C++ ->Code generation, set the "Runtime library" value to "Multi-threaded (/MT)" for the release configuration (upper left dropdown), and "Multi-threaded Debug (/MTd)" for the debug configuration.
2. Next, rebuild the application, by right-clicking on the project in the solution explorer, and chosing "Rebuild".
3. Ship the dependable glut32.dll and opengl32.dll together with the release .exe file to make the .exe portable.

When trying to rebuild the application, I receive this error:
'/MT' and '/clr:pure' command-line options are incompatible

I belevie this is close to be the solution, perheps some other additional settings is needed?
I have googled this error but cant really find what it means or a solution to this.

Lukezzz 0 Posting Whiz in Training

Thank you, I have red the whole thread you sent. I have found this one before too.

This is really a big issue how to solve this. As seen in that thread this is not an easy thing to understand what really is needed to do, there is no real answer in that thread. It is to diffus.

So I need to take this from the beginning.

I have done a Form application in VC++ 2008 Express Edition. I have done a release .exe file of this application.
(This release file has the same size 10.3 MB as the debug .exe file 10.3 MB)

The release .exe file generates this error on a XP computer wihtout VC++:
"this application has failed to start because the application configuration is incorrect"

So what more is needed here?
I have tried to put all of these files in the very SAME folder as the .exe file on the XP computer without VC++ but that does not solve the problem.
I have taken almost all .dll files that is mentioned in that long thread from the previous post.
There must be a step by step method of how you do this as it is a complex problem?

Files:
ATL80.dll
atl90.dll
mfc80.dll
mfc80u.dll
mfc90.dll
mfc90u.dll
mfcm80.dll
mfcm80u.dll
mfcm90.dll
mfcm90u.dll
msvcm90.dll
msvcp80.dll
msvcp90.dll
msvcr90.dll
msvcrtd.dll
odbc32.dll
odbc32gt.dll
Form1.exe.intermediate.manifest

Lukezzz 0 Posting Whiz in Training

I have now also tried to install the vcredist_x86.exe on the XP machine that doesn´t have VC++ Express Edition installed.

I have tried to install both the 2008 and 2010 package seen below on the machine and that does not help. I receive the below error message when trying to execute the .exe release build:
"this application has failed to start because the application configuration is incorrect"
It is just impossible to find an answer to this. I have googled many days regarding this problem.

I have tried to install both these files with no success:
(Microsoft Visual C++ 2008 Redistributable Package (x86))
(http://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140/vcredist_x86.exe)

(Microsoft Visual C++ 2010 Redistributable Package (x86))
http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe

Lukezzz 0 Posting Whiz in Training

I found a post by you with exact this problem that I have here:
http://www.daniweb.com/forums/thread186843.html

You mention the .DLL files that should be in the same folder as the .exe. This is exactly what I have done but that did not help.
You mention that those .DLL will not help in that case.
Then the question is, how is this possible to do, how will I do a setup that simply works on another computer ?
---------------------------------------------------------------------------------------------------------------

I also now tried to install this setup file with the .exe from the release together with the .DLL files(Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT) on a XP computer just now that does not have the VC++ 2008 Express edition installed.

I get this error message when executing the application:
"this application has failed to start because the application configuration is incorrect"

I have difficult to beleive that a user have to install the whole .NET framework(http://download.microsoft.com/download/6/0/f/60fc5854-3cb8-4892-b6db-bd4f42510f28/dotnetfx35.exe) in order for the application to work. It is 197 MB ?

If I understand correct, the only thing that is needed is the .exe file that the release is creating but that does not work ?

Lukezzz 0 Posting Whiz in Training

Thanks

Yes I understood that the debug version did require debug versions of the Windows DLL:s that other computers might not have. I think this is exactly where my problems are, that these are not included in the .exe file that I create in the release.

I have to tell what I have done as I really have a problem to get this right. I have done a release in vc++ 2008 Express Edition and tried to install it on XP and Windows 7 just now. I tried it now and also included the .DLLs in that "Microsoft.VC90.CRT" folder (msvcm90.dll, msvcp90.dll, msvcr90.dll, Microsoft.VC90.CRT.manifest)

I get this error when trying to exectute the installed .exe file on Windows 7:
"The application has failed to start because its side-by-side configuration is incorrect. Please
see the application event log or use the command-line sxstrace.exe tool for more detail."

I am back to wonder about that this release .exe file has the same size as the one in the debugfolder which seems wrong ?

Then I also wonder if I should upgrade and instead use vc++ 2010 Express Edition. I wonder if this will solve the problem and can I convert the project just like that in that new version ?

Lukezzz 0 Posting Whiz in Training

>> 1. You can't use the debug version because (1) its size is at least twice the that of the release version,
>> 2. it contains alls to the debug version of Windows DLLs which other computers most likely do not have unless they also have the compiler installed.


(Yes ofcourse, I only asked about the ones in the release folder, no DLL:s)

1. I have to ask. As you said that the .exe file in the debug folder could be twice the size of the one in the release folder. In this case how I did this release, these 2 files have the exact same size, the .exe file in the debug folder and the .exe file in the release folder ? I have choosen release as configuration and described in the first post.

2. Then you mentioned that the debug file contains the debug versions of Windows DLL which other computer most likely dont have and this is why a release is needed.
This is a problem I had before where, I have automatically donwloaded the whole .NET framwork 3.5 to the users computer that also is 200 MB in size.
I think this is wrong but this is an answer I had from here before to be the solution for this problem.
I found on a post that the 4 DLL files that is in this folder "Microsoft.VC90.CRT" could be included in the setup to solve this problem …

Lukezzz 0 Posting Whiz in Training

Thank you.. I think it is much better to ask this question as it could have worked on XP to just copy the .exe file and on any other system, could have needed any other file.
Possible and unknown scenarios.

In that case I dont really understand the difference between release and dubug mode if only the .exe file is needed. Why not only take that file from the debugfolder ?

I will test this, thanks for help.

Lukezzz 0 Posting Whiz in Training

Hi..

I will make a "release" of a project I have done in VC++ 2008 Express Edition.
I go to: Project/Form1 properties.

Here I choose: Configuration: Release
In the General tab, I choose: Output Directory C:\Release & Intermediate Directory: C:\Release.
In Debugging tab I choose: Command: C:\Release

Now I press "Apply" and "OK" and press F7(Build Solution)
It creates 25 files in the "C:\Release", (I have 4 Forms in the application)

Now when doing a setup, wich files is needed for the setup of these ?
I dont beleive all of them is needed ?

Form1 (Precompiled Header File)
metagen.dep
mt.dep
stdafx(Object File)
vc90(VC++ Minimum Rebuild Dependencies)
vc90 (Program Debug Database)
AssemblyInfo(Object File)
Form1(Object File)
Form2(Object File)
Form3(Object File)
Form4(Object File)
app(RES File)
Form1.exe
Form1.exe.intermediate.manifest.dll
Form1.Form1.resources
Form1.Form2.resources
Form1.Form3.resources
Form1.Form4.resources
Form1 (Incremental Linker File)
Form1 (Program Debug Database)

Lukezzz 0 Posting Whiz in Training

Hi..

I have compiled a project made in Visual C++ Express 2008 Edition and have made a setup.exe of this using the "Inno Setup Compiler".
(The project needs Framework 3.5 to work.)

I can install this setup.exe fine on Windows XP and run the software. The setup is downloading the Framework 3.5 if it doesn´t exist on the computer checking this path: "Software\Microsoft\.NETFramework\AssemblyFolders\v3.5"

Now for Windows 7, I assume that it has Framework 3.5 installed as this is default for Windows 7 ?
If I install the software on Windows 7 with the same setup.exe, the installation runs fine and does not donwloading the Framework 3.5(checking the above path if it is the same for windows 7?)
However it should exist on the computer by default ?
But when trying to start the application, this message is received wich I dont understand what this means ?

C:\Program Files\oneapplication\oneapplication.exe

The application has failed to start because its side-by-side configuration is incorrect. Please
see the application event log or use the command-line sxstrace.exe tool for more detail.

Lukezzz 0 Posting Whiz in Training

Hello

I have compiled a project and are now doing a setup of this using the software "Inno Setup Compiler"

What I wonder is this:
This project that I am doing a setup of is done in Visual C++ 2008 Express Edition.

Now if the user doesnt have the .NET Framework 3.5 on the computer, this software will not work so this setup will download and install it with a script that I have coded in the Inno Setup.

Now, this file is big as 197 MB and takes very long time to install:
http://download.microsoft.com/download/6/0/f/60fc5854-3cb8-4892-b6db-bd4f42510f28/dotnetfx35.exe

My question is if everything in this file is needed in order to make the software to work. Perheps there is any other file that is much less in size that includes the nessecary components ?

Thank You!

Lukezzz 0 Posting Whiz in Training

Hi,

I have created a ToolStripMenuItem in the MenuStrip.

Is is called: OneToolStripMenuItem

What I need to do now is these tasks programatically:

1. Add one Item named: "Item1"
2. Create a Click Event for this "Item1"
3. Place a very small .JPG Image or Icon Before this "Item1"

I have managed to Add the Item but the click event is not well formed, I wonder what I am missing there and the Image before this Item I am not sure how to declare.

String^ text = "Item1";

	ToolStripMenuItem^ foo = gcnew ToolStripMenuItem(text); 
	foo->Click += gcnew EventHandler(Item1_Click); //Not correct ? 
	OneToolStripMenuItem->DropDownItems->Add(foo);

         //Add image before This Item ??

Thank You!

Lukezzz 0 Posting Whiz in Training

Hi,

I have a problem with a Flashcontrol(AxShockwaveFlashObjects).
The Flashmovie that I get plays well, this is not the problem.

I have to show a HTML code to explain the problem I have. I have received a link that is:
"http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D
"

This link in this HTML here will play a flashmovie and when the flashmovie is Clicked, a dialog box will appear where you will download a file.

<object id="Object11" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
                                        codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">
                                        <param name="allowScriptAccess" value="sameDomain" />
                                        <param name="movie" value="http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D" />
                                        <param name="quality" value="high" />
                                        <param name="bgcolor" value="#000000" />
                                        <embed align="middle" allowscriptaccess="sameDomain" bgcolor="#000000" 
                                            height="55" name="0" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" 
                                            src="http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D" type="application/x-shockwave-flash" width="425" />
</object>

The problem is when I play the Flashmovie with the same URL attached to it below and when you click this flashmovie, the Companies website will open up wich is wrong.
This link is ment for downloading a file wich works correct in the HTML code above.

I had this problem for months and simply dont know what this is depending on. I will be very happy for help. Thank you.

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) 
{
	AxShockwaveFlashObjects::AxShockwaveFlash^ AxShockwaveFlash1 = gcnew AxShockwaveFlashObjects::AxShockwaveFlash();

	Form1::Controls->Add(AxShockwaveFlash1);
	AxShockwaveFlash1->BackgroundColor = 0;		 
	AxShockwaveFlash1->Movie = "http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D";
	AxShockwaveFlash1->Base = "http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTM4MzA3MDk2OCZsYW5kaW5nUGFnZUlkPTEzNTEwMTUzJnByb2ZpbGVJZD01MjY5NTE%3D";
	AxShockwaveFlash1->AllowFullScreen = "false";
	AxShockwaveFlash1->AllowScriptAccess = "sameDomain";
	 
	AxShockwaveFlash1->EmbedMovie = true;

	AxShockwaveFlash1->Size = System::Drawing::Size(532, 68.82);				 
	AxShockwaveFlash1->Location = System::Drawing::Point(1, 25);
	AxShockwaveFlash1->Play();
}
Lukezzz 0 Posting Whiz in Training

Okay, Thanks Ketsuekiame,

I will try to understand this better then and start reading the documentations and take it step by step from there and see how I can figure this out.

Thanks for help

Lukezzz 0 Posting Whiz in Training

Thanks Ketsuekiame,

I have checked the documentation and will continue to read it. But I beleive I will need to understand some codingbasics of this is working.

What I first already know how to do is to send an email with the SmtpClient Class.
Here you will specify a server like this:
SmtpClient smtp = new SmtpClient("localhost");

I have seen in Local SMTP server documentation that you in this code put "localhost" to communicate with that particular SMTP server.

So let say that this code is OK now!

What now is needed is to code this SMTP server that simply is a socket server.

If I understand correct, it will work in this way:
SmtpClient code will send email to ----> Socket server that really do the send of the email to recepient ?

So this socket server must "listen" for an incoming message from the SmtpClient code and be able to send.

I have googled: "System.Net.Sockets.TcpClient" and find many different examples and do not know wich and what is relevant to be able to catch the message from SmtpClient code and send the email to recipeint.

I think this is quite difficult and then it could be good to have a "straight forward example" to easier understand.

I beleive this is what should happen:
(SmtpClient send email to ---> Listening socket server ---> Send Email to recepient)

Lukezzz 0 Posting Whiz in Training

Hello

I have been set a task to myself build a "Local SMTP Server" as the product found on this URL: http://www.softaward.com/1036.html

I have googled around but cant find any code of how to do this.
The thing is that I use the SmtpClient Class and now in this code will set "localhost" as the SMTP Server.

But in order to be able to do this, I have to code my own "Local SMTP Server"...
How can I begin to do this, perheps there are any code to start out with etc.

I will be happy for guidance of how to begin. (I know how to send email using the SmtpClient Class)

Lukezzz 0 Posting Whiz in Training

Hello,

I wonder how it works when you want to send an email through a proxy server.
I have code below that works if you want to send an email through for example smtp.gmail.com etc.

I have put the proxyserver address and port that the proxyserver has as the 2 arguments below.
However when I try to run the code the sending fails.

So my question is how it is possible to send an email using a proxyserver like this ?

using System.Net.Mail;

String^ Proxyserver = "210.212.85.146";   
int port = 1080;             
  
  
MailAddress^ to = gcnew MailAddress("To@hotmail.com");   
MailAddress^ from = gcnew MailAddress("From@hotmail.com");   
MailMessage^ message = gcnew MailMessage(from, to);    
  
  
message->Subject = "Hello1";   
message->Body = "Hello2";   
  
SmtpClient^ smtp = gcnew SmtpClient(Proxyserver, port);   
NetworkCredential^ NetworkCred = gcnew NetworkCredential();   
NetworkCred->UserName = "From@hotmail.com";   
NetworkCred->Password = "passWord";   
smtp->Credentials = NetworkCred;   
  
  
try  
{   
    smtp->Send(message);   
}   
catch (Exception^ ex)   
{   
    //Failed   
}
Lukezzz 0 Posting Whiz in Training

Hi,

I have a question about when you have compliled a Form application as a release where the product exists of:

- exe.file
- Program Debug Database
- Incremental Linker File

What I now wonder is that I have in my project some important usernames and passwords.

My question is if there are any possibility to reCompile and open up this code again as this is a release ?
How does this work and how difficult is this really ?

I will be happy for some knowledge about this ?

Thank You!

Lukezzz 0 Posting Whiz in Training

Hi,

I have 2 backgroundpictures that I want to change every second in a loop.
I beleive a backgroundworker and reportproress will work for this.

But what I wonder is about these 2 pictures themselves. Normally you can compile a project with a one backgroundpicture put to the buttoncontrol but how will this work if I will need to change between 2 pictures each second.

I dont want to use pathes on a users computer like C:\\ etc...
Is it possible to have the compiled in the project and call these in any way ?

(Inside a backgroundworker)

private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) 
{
  while( true )
  {	
      Thread::Sleep(1000);
      backgroundWorker1->ReportProgress(0); 
  }
}

private: System::Void backgroundWorker1_ProgressChanged(System::Object^  sender, System::ComponentModel::ProgressChangedEventArgs^  e) 
{
	if( button1->BackgroundImage == "Path1" )
	{
		button1->BackgroundImage = "Path2";
	}
	else
	{
		button1->BackgroundImage = "Path1";
	}
}
Lukezzz 0 Posting Whiz in Training

Hello,

I wonder if it is possible to have opacity on a textBox control.

What I initially is trying to do is that I have a multilined textBox where a lot of text is written and behind this textBox there is a panel with an backgroundimage that I would like to be a bit visible through this textBox.

I cant find a property for opacity on the textBox but perheps there could be any way to do this ?

Lukezzz 0 Posting Whiz in Training

I have found one solution but one problem in the solution remains.
There is a FlashControl in C++ avaliable. By adding these .DLL:s
- AxInterop.ShockwaveFlashObjects.dll
- Interop.ShockwaveFlashObjects.dll

From the beginning my HTML code look like the first example wich works in a ASP.net application. Now I want to take the nessecary parameters to insert into this FlashControl.

The flashmovie is seen in the Windows application nicely. Now when clicking this flashmovie, one browser will open up to show a webpage.

However when clicking this flashcontrol in the windowsapplication, a browser opens with the address: "http://undefined/"
So I beleive I need to put any additionaly properties for the control that is found in the HTML code but have problem to understand what could be needed ?

(This HTML is working correctly)

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="728" height="90" ><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTMzMTY2MTUwJmxhbmRpbmdQYWdlSWQ9MCZwcm9maWxlSWQ9NTI2OTUx&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTMzMTY2MTUwJmxhbmRpbmdQYWdlSWQ9MCZwcm9maWxlSWQ9NTI2OTUx" /><param name="quality" value="high" /><param name="bgcolor" value="" /><embed src="http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTMzMTY2MTUwJmxhbmRpbmdQYWdlSWQ9MCZwcm9maWxlSWQ9NTI2OTUx&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTMzMTY2MTUwJmxhbmRpbmdQYWdlSWQ9MCZwcm9maWxlSWQ9NTI2OTUx" quality="high" bgcolor="" width="728" height="90" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>

(C++)

AxShockwaveFlashObjects::AxShockwaveFlash^ AxShockwaveFlash1 = gcnew AxShockwaveFlashObjects::AxShockwaveFlash();

 this->Controls->Add(AxShockwaveFlash1);
 AxShockwaveFlash1->Movie = "http://online.casinotropez.com/promoLoadDisplay?key=em9uZUlkPTMzMTY2MTUwJmxhbmRpbmdQYWdlSWQ9MCZwcm9maWxlSWQ9NTI2OTUx&amp;clickTAG=http://online.casinotropez.com/promoRedirect?key=em9uZUlkPTMzMTY2MTUwJmxhbmRpbmdQYWdlSWQ9MCZwcm9maWxlSWQ9NTI2OTUx";
 AxShockwaveFlash1->AllowFullScreen = "false";
 AxShockwaveFlash1->AllowScriptAccess = "sameDomain";

 AxShockwaveFlash1->Enabled = true;

 AxShockwaveFlash1->EmbedMovie = true;

 AxShockwaveFlash1->Size = System::Drawing::Size(386, 56);
 
 AxShockwaveFlash1->Location = System::Drawing::Point(52, 82);
 AxShockwaveFlash1->Play();
Lukezzz 0 Posting Whiz in Training

The problem is that the stream will not be a static image. I understand how you meen and how to call a stream from the web as I am familiar of how to do that.

The thing here is that what I would need to do is to get a flash object.
This meens that the banner in this case more or less is an animation in that format. So I beleive a picturebox cant handle this type ?

I dont know if it is possible to get a stream wich will be located at an direct address like: "http://oneFLASHblabla" and put this Flash stream into any control in C++.

Please check this URL to see what type of banner I am thinking about.
http://www.123-banner.com/

(It is the one that is black with a clock on the side)

Thanks

You ought to be able to use a picturebox, the contents of which you can probably get as a stream from the web, go from a stream to an image. Were you planning on writing the text onto the banner directly? If so you could have a label that you align over the picturebox. I realize I'm being a bit vague but I'm not absolutely sure what the requirements are.

I did find this page which has an example in C# that I was able to put into C++/CLI using dynamic_cast instead of the c style casts.

Lukezzz 0 Posting Whiz in Training

Hi,

I have a special question about banners that usually is possible to put on a webpage with HTML code. The HTML code holds some addresses to this specific banner in form a http:// addresses.

As C++ can call addresses like this my quesiton is this:

Is there any possibility to have a banner in a Form application in any way. The code to the banner look like this more or less.

(HTML code for a banner)

<div style="FONT: 11px tahoma,sans-serif; 
WIDTH: 728px; 
TEXT-ALIGN: center">
<a href="http://webaddress" title="one Title ">
<img src="http://imageaddress" width="500" height="50" border="0" alt="one Title"/></a>
<br/>
<a href="http://oneaddress">oneString</a>
</div>
Lukezzz 0 Posting Whiz in Training

Hello,

I am using a button event to activate a backgroundworker that will copy a string to the Clipboard.

When debugging the code, I get this error for the Clipboard line in the backgroundworker.
I am not sure what this meens or what I need to do here. I have tried to put the [STAThread] attribute like this but it does not solve the problem:

error:
Current thread must be set to singel thread apartment (STA) mode before OLE calls can be made.
Ensure that your Main function has STAThreadAttribute marked on it.

[STAThread]
private: Void button1_Click(Object^ sender, EventArgs^ e)
{
            //Activate backgroundworker
            if (backgroundWorker1->IsBusy == false)
            {
                backgroundWorker1->RunWorkerAsync();
            }
}



private: Void backgroundWorker1_DoWork(Object^ sender, DoWorkEventArgs^ e)
{
           Clipboard->SetText("hello");
}
Lukezzz 0 Posting Whiz in Training

I think I am looking after this method where I will start a process and detect this opened process and kill() it but something with this code is not correct ?

I get this error:
(string, string) cannot be accessed with an instance reference; qualify it with a type name instead

Process^ myProcess = gcnew Process();
            myProcess->Start("Firefox.exe", "http://www.google.com");


            myProcess->Kill();
Lukezzz 0 Posting Whiz in Training

I have started an instance like this and how would it be possible to programatically close this instance that was opened ?

Process::Start("Firefox.exe", "http://www.google.com");

Thanks...

Usually, one would get the list of applications running and check if a particular application is in the list. In your case, you may want to check whether "firefox.exe" is running (or any other browsers). Once detected, kill the process and the browser will close.

NOTE: It may be too invasive to forcefully close the browser. It is better to prompt user to close it before proceeding.

Lukezzz 0 Posting Whiz in Training

Hi,

I wonder if there is any syntax that can detect if any Browserwindow is open on the computer and then close this/these windows.

I use Firefox and then would want to detect if any Firefox browserwindow is opened and then close them if any is open.

Thank you!

Lukezzz 0 Posting Whiz in Training

I googled and found this example here.

I have tried to set IE8, FireFox and Chrome as default browsers and this command actually works here.

This might be quite portable ?

Help::ShowHelp(this, "http://www.google.com");
Lukezzz 0 Posting Whiz in Training

I understand, it looks for the registry, it seems logical.

I tried to use this by setting Safari as a defaultbrowser but then this command does not work:
Process:: Start("http://www.google.com");

I have now tried both these lines below one at a time but get ca 100 lines of compileerrors where these are constantly repeating:
Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(4389) : error C2872: 'FILETIME' : ambiguous symbol
Program Files\Microsoft SDKs\Windows\v6.0A\include\windef.h(377) : _FILETIME FILETIME'
windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Runtime::InteropServices::FILETIME'
Microsoft SDKs\Windows\v6.0A\include\objidl.h(12671) : error C2872: 'IDataObject' : ambiguous symbol
windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject'

I use managed C++ and are not sure if any of these lines works here or what I should do ?

#include <windows.h>

HINSTANCE hInstance = ShellExecute(NULL, "open", "www.google.com", NULL, NULL, SW_SHOW); 
HINSTANCE^ hInstance = ShellExecute(nullptr, "open", "www.google.com", nullptr, nullptr, SW_SHOW);
Lukezzz 0 Posting Whiz in Training

I am not sure but the code seems a bit messy and not exactly targeted to the managed framework.

I have tested this out. This does open my Internet explorer browser with www.google.com and what I wonder is if this code identifies what browser that is installed and is used as the default browser as the browser isn´t specified here ?
I have 6 different browsers installed on my computer and uses Internet Explorer 8 as my default.

This code does open Internet Explorer 8 in this case.
Is this portable and will open a users default browser whatever that could be ?

Process::Start("http://www.google.com");
Lukezzz 0 Posting Whiz in Training

Thanks for that, I am happy that there this command exists. I use managed C++.
I have problem to compile the line though.
When trying to comple this, I get these errors:

HINSTANCE undeclared identifier
syntax error missing ";" before identifier "hInstance
SW_WHOW undeclared identifier
ShellExecute identifier not found

HINSTANCE hInstance = ShellExecute(NULL, "open", "www.google.com", NULL, NULL, SW_SHOW);

//I have also tried this
//HINSTANCE^ hInstance = ShellExecute(nullptr, "open", "www.google.com", nullptr, nullptr, SW_SHOW);

All MS-Windows computers have IE -- at least in USA. I've heard there have been some lawsuits about that around the world but I don't know the outcome. HINSTANCE hInstance = ShellExecute(NULL, "open", "www.google.com", NULL, NULL, SW_SHOW); The above will use the default browser, whatever that is.

Lukezzz 0 Posting Whiz in Training

I have a code that is opening a browserwindow like this:

Process::Start("iexplore.exe", "http://www.google.com"); //Open google in a defaultBrowser

I wonder something about this "iexplore.exe".

I am not sure what that meens. Does it meen that it Only will open Internet Explorer if that exists on the users computer.
What will happen if the users doesn´t have Internet Explorer but instead FireFox or Opera or something else.

If that is the case, I might wonder if there are any more portable code to open a browser for the browserapplication that does exist on the users computer ?

Thank you

Lukezzz 0 Posting Whiz in Training

Yes that was a good idéa, that is working great for the purpose.

Thanks for that !

What about calling the generateString function within your buttonclick function, except have generateString return the string instead of void

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
	String^ getgenerateString = generateString(); 
}

String^ generateString()
{
	String^ sendThisString = "SendThis";
         return sendThisString;
}
Lukezzz 0 Posting Whiz in Training

I wonder how it is possible to retreive a string from a function that is generating this string.
How is it possible to get the string "SendThis" when presssing the button1 in this case and declare it to getgenerateString ?

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
	String^ getgenerateString = ""; //How to get the string "SendThis" here ?
}

void generateString()
{
	String^ sendThisString = "SendThis";
}
Lukezzz 0 Posting Whiz in Training

Thank you, now I understand why it didn´t work, so that did solve that problem

Thanks alot for help!

This happens because StreamReader::ReadLine returns nullptr when the end of stream is reached (which is the case when reading an empty file).

That means that on line 8 of your code line is now nullptr , and not the initial empty string. Since they do not compare equal to each other, the second if statement is entered, and because nullptr does not have a string representation, nothing is printed between the two 2's.

To observe the correct behavior, change the last part to:

if ( String::IsNullOrEmpty( line ) )
{
	MessageBox::Show("1" + line + "1");
}
else
{
	MessageBox::Show("2" + line + "2");
}
Lukezzz 0 Posting Whiz in Training

Thanks, okay, but I am quite shure that this is a correct declaration for a string. Anyway this is the way I always have done it:

String^ line = "";
Lukezzz 0 Posting Whiz in Training

I have a little spoky problem here. I really cant understand what it is.
I am reading a file that is completely empty. But still the second MessageBox is showing this string:

"22"

I cant wrap my head around why if( line != "" ) is executing and no character is shown inbetween the "22" ?

String^ line = "";
 WebClient^ Client = gcnew WebClient();

 Client->Credentials = gcnew NetworkCredential("username", "password");
 Stream^ strm = Client->OpenRead("file1.txt");
 StreamReader^ sr = gcnew StreamReader(strm);    

 line = sr->ReadLine();
 sr->Close();
 strm->Close();


 if( line == "" )
 {
	 MessageBox::Show("1" + line + "1");
 }
 if( line != "" )
 {
	 MessageBox::Show("2" + line + "2");
 }