|
Cool, you just proved that I'm e n00b.
I don't know how but I looked over that line a hundred of times and still couldn't figure it out.
Whatever, problem's solved....
|
|
|
|
|
i want to create a file at the application path, i.e where my exe is located, but i am not finding any ways of determining the app path.can any one help
thanks well in advance
Naveen
|
|
|
|
|
Application.ExecutablePath or Application.StartupPath
|
|
|
|
|
Thanks a lot, its working fine now
Naveen
|
|
|
|
|
How to send a serialized object to the networkstream?
In the serialize method of binaryformatter, if I pass to first the parameter a NetworkStream object? what will happen?
I want to send a serialized object from a server to client...
|
|
|
|
|
Ahmed Manzoor wrote: In the serialize method of binaryformatter, if I pass to first the parameter a NetworkStream object? what will happen?
The bytes will be sent across the connection. Somehow I doubt that helps you. Perhaps you want to ask a more specific question?
led mike
|
|
|
|
|
How will the bytes be sent across the connection?
I get a NetworkStream from the GetStream method from the TcpClient object, then I serialize an object to the NetworkStreamwhich I received using BinaryFormatter.
1) Will the serialization happen properly?
2) If it does, how to get that object then which is serialized, how is deserialization gonna happen on the client side?
modified on Thursday, January 22, 2009 2:10 PM
|
|
|
|
|
Ahmed Manzoor wrote: how is deserialization gonna happen on the client side?
Are you just winging this? I strongly suggest not doing that. One should prefer to introduce themselves to the Serialization topic by reading one or more of the many Many articles available on the subject. Try some of these.[^]
led mike
|
|
|
|
|
What winging? I know how to serialize to File streams, but I'm not sure if it is done the same way with Network streams.
I need to know how to deserialize the object on the client side when it is serialized on the server side first. Is it the same as serializing to a File stream?
Rather than giving articles on serialization you shall suggest me articles with serializing over networks.
Help !!!
modified on Friday, January 23, 2009 6:32 AM
|
|
|
|
|
Ahmed Manzoor wrote: I know how to serialize to File streams
Do you know how to Deserialize them from Files? If not you need to read the subjects I suggested. If you do then it's the same thing.
led mike
|
|
|
|
|
Lol, Thanks then. I'm going to try if it works properly then get back to you.
|
|
|
|
|
i am trying to write a small window form application. I use a file dialog to select a file in my computer. However, in the debug mode, when pressing the browse button, i got this error message :
"An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
Additional information: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process."
This problem happen only when i try to create a object of a class in the Form1.h file. If i delete the code of creating object, everything goes fine.
I have checked the main function, it already had [STAThreadAttribute] marked on it. So, can you give me any suggestion, please? thanks
|
|
|
|
|
You must set the Apartment state of the thread, to be STA ( Single Threaded Apartment ) to work with OLE.
// Run application Thread
Thread _threadAppProcessor = new Thread(new ThreadStart(StartThread));
_threadAppProcessor.SetApartmentState(ApartmentState.STA);
_threadAppProcessor.Start();
|
|
|
|
|
Hi,
How to use T-Sql in Sql server 2005,bec i'm new to it plz plz help me out.
With Regards
Mahesh
|
|
|
|
|
Welcome to CodeProject
You are using an improper forum for your question. Please read the first message in this forum as it explains what the purpose of this forum is. Try asking a Database programming question in the Database Forum[^].
Also don't repost your questions. To get the most out of this site you should take some time to read some of it and get the idea of how it works. Otherwise you might just be irritating people to the point where no one will help you.
CodeProject Forum Guidelines[^]
led mike
|
|
|
|
|
Hi,
How to use T-Sql in Sql server 2005,bec i'm new to it plz plz help me out.
With Regards
Mahesh
|
|
|
|
|
Sorry, I want to display an video media file in window form application of visual c++ 2008,but I have no idea how to make it?Is it possible .And if it is yes,can anyone tell me how to do.Thanks.
modified on Wednesday, January 21, 2009 9:35 AM
|
|
|
|
|
If the media is something Windows Media Player can play, you could use
the Windows Media Player control:
Using Windows Media Player with .NET[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have followed the insruction and still fail to load a video...does anyone try to use window media player in c++ before?
|
|
|
|
|
I've used the Windows Media Player control in Native C++, Managed C++, and Silverlight,
and every time it took one or two lines of code to play a video...
If you really want to know how to use the control, the
Windows Media Player SDK[^]
is the ultimate source of info.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
#include "stdafx.h"
using namespace System;
using namespace System::Net;
using namespace System::Net::Sockets;
using namespace System::IO;
using namespace System::Text;
void main(void)
{
Stream^ fS = gcnew FileStream("D:\\TextOut.txt", FileMode::Create, FileAccess::Write);
StreamWriter^ sWriter = gcnew StreamWriter(fS);
Console::WriteLine("Encoding type : " + sWriter->Encoding->ToString());
Console::WriteLine("Format Provider : " + sWriter->FormatProvider->ToString());
sWriter->WriteLine("Today is {0}", DateTime::Today.DayOfWeek);
sWriter->WriteLine("Today we will mostly be using StreamWriter");
for (int i = 0; i < 5; i++)
sWriter->WriteLine("Value {0}, its square is {1}", i, i * i);
sWriter->Write("Arrays can be written : ");
array<system::char xmlns:system="#unknown">^ myArray = gcnew array<system::char>(5) { 'a', 'r', 'r', 'a', 'y' };
sWriter->Write(myArray);
sWriter->WriteLine("\r\nAnd parts of arrays can be written too");
sWriter->Write(myArray, 0, 3);
sWriter->Close();
fS->Close();
}</system::char></system::char></char>
The error is
error C2664: 'void System::IO::TextWriter::Write(cli::array<type,dimension> ^,int,int)' :
cannot convert parameter 1 from 'cli::array<type> ^' to 'cli::array<type,dimension> ^'.</type>
If I declare the array as array<char>, I get errors. But when I declare it as Char, there isn't any error.
And there is one more thing,
the Write() method for StreamWriter have only four overloads (the IntelliSense only shows four), but in MSDN it shows more than it 17... Why whats wrong here?
For instance, there is a Write() StreamWriter.Write Method (System.IO) method that takes a Boolean parameter, but when I write the following statement it generates an error
sWriter->Write(true);
Writes a
modified on Tuesday, January 20, 2009 11:45 AM
|
|
|
|
|
Ahmed Manzoor wrote: For instance, there is a Write() StreamWriter.Write Method (System.IO) method that takes a Boolean parameter, but when I write the following statement it generates an error
The following code works as expected in VS2008
FileStream ^ fs = gcnew FileStream("testfile.txt", System::IO::FileMode::Create);
StreamWriter ^ sw = gcnew StreamWriter( fs);
sw->Write( true);
sw->Close();
fs->Close();
delete sw;
delete fs;
led mike
|
|
|
|
|
array^ myArray = gcnew array(5) { 'a', 'r', 'r', 'a', 'y' }; should be
array<wchar_t>^ myArray = gcnew array<wchar_t>(5) { 'a', 'r', 'r', 'a', 'y' };
array requires a type, and in this case 'wchar_t'!
StreamWriter::Write (with 4 overloads) is the overloaded version of TextWriter::Write that has 17 overloads.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
I want to connect the SQL server 2005 through VC++ with out using ADO.net application. I have achieved through ADO.net. So i need some exmple plz provides.
With regards
Mahesh
|
|
|
|
|
Aren't you using C++/CLI?
|
|
|
|