|
Maybe get_ResponseContext() or get_Attachments() return null. Why don't you break this big line and check for null?
|
|
|
|
|
woops!
That is true, they both return null.
Now I´m even more lost.
With the highest regards
// Daniel
|
|
|
|
|
I guess you need to put a complete codes for ppl to study your problem. It could be just some typos or small problem.
Like namespace stuff or anything. Having too short of explanation of your problem will only return less understandable answer. (i learn this from someone in codeproject)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Sure sir.
I´m using WSE 1.0 SP1 on Microsoft.NET framework 1.0
I have installed WSE 2.0, but I don´t get it to work.
Here goes.
//Create a new DimeAttachment class
CString m_sFilepath = Server->MapPath("/.../.../");
CString m_sFilename(inFileName) ; // an incomming string
FileStream *fs;
try
{
fs = new FileStream(m_sFilepath + m_sFilename,FileMode::Open,FileAccess::Read);
//copy stream to stream
unsigned char sbuf __gc[];
sbuf = new unsigned char __gc[fs->Length];
fs->Read(sbuf, 0, sbuf.Length);
MemoryStream *ms;
ms = new MemoryStream();
//close file
fs->Close();
//attach body
DimeAttachment* da;
da = new DimeAttachment("application/octet-stream", TypeFormatEnum::MediaType, ms);
HttpSoapContext *hsc;
hsc->get_ResponseContext()->get_Attachments()->Clear();
hsc->get_ResponseContext()->get_Attachments()->Add(da);
}
I can compile it but not run it, due to "Object not set to an instance"
HttpSoapContext->ResponseContext->Attachments->Clear();
HttpSoapContext->ResponseContext->Attachments->Add(attachment);
The above doesn´t work either. "Left of -> must point on a class/struct/union/"
I have had the thread in ExpertsExchange
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20714751.html#9208316
With the highest regards
// Daniel
|
|
|
|
|
Could you divide your code so that it is like this
SoapContext* sc = HttpSoapContext::ResponseContext;
and then make sure your call is within [Web Method] function scope.
Check out Consuming web service from Managed C++[^]
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thank you sir
... but this is old news, I have tried the diffenent codesnippets back and forth and now the problem isn´t the code. It is the WSE and DIME, and why I can´t make that work. I have uninstalled the WSE and reinstalled it (WSE 2.0) and still it points on WSE 1.0, I get an errormessage when I run it in the Fusion Log
"File or assembly name Mirosoft.Web.Services or one of its dependencies, was not found."
Do I need to make any changes in a config-file? I have tried changes in both web.config and machine.config, but I can´t get it to work.
With the highest regards
// Daniel
|
|
|
|
|
there are variety of static utility object in C# or C++.NET which you do not need to instantiate and to be used immediately. It is call static object.
For example.
//In Managed C++. It is call this way
String *myString = System::Environment::CurrentDirectory;
//In C#. It is call this way. Syntaxes are slightly different but objective
//are the same which to the current working directory for your app.
string myString = System.Environment.CurrentDirectory;
You do not need to call
System.Environment.CurrentDirectory = new System.Environment.CurrentDirectory();
It is a static object.
Like in MFC 6.0, CDialog::OnOK();
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thank you sir
I do understand that and when I don´t instantiate the object HttpSoapContext the compiler doesn´t complain.
The proble occurs when I try to run/debug the program. Then I get the response "Object not set to an ..."
This I found very strange? Is there a bug somewhere? Do I need to make any other adjustment?
With the highest regards
// Daniel
|
|
|
|
|
It could be the object is NULL or you did not call new.
In managed world. Everything needs to be called new youClass().
There is no old object in managed world. (this line is a joke)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thank you sir
As I wrote before, the object is NULL, not very good. But what do I do? Remember that I´m a newbie.
With the highest regards
Daniel
|
|
|
|
|
I maybe out of sync on this one, but shouldn't you be using S prefix in String declaration? I mean:
attachment = new DimeAttachment(S"application/octet-stream", TypeFormatEnum::MediaType, ms);
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
I have been tasked with writing an HTTP reverse proxy to run under IIS to re-route HTTP requests to other IIS servers based on some URI mapping rules and addding some message authentication codes (HMACs) to the request for security.
I have been considering writing this component in managed C++. I have created a prototype ISAPI filter in managed C++ and it seems to work OK.
My questions are:
- Does anybody have any experience doing this?
- Are there any bad interactions of running the CLR in IIS's process space?
- Should I go down the unmanaged C++ route? I have had good experience with this before, but I like being able to take advantage of all the classes in the .NET Framwork and not having to deal with MSXML, CryptoAPI, WinHTTP, etc.
- Right now we are using IIS 5.X and we'll probably upgrade to IIS 6 in the next 9 months, is there anything I need to consider for IIS6>
Thanks
Martin
|
|
|
|
|
martinbertolino wrote:
I like being able to take advantage of all the classes in the .NET Framwork and not having to deal with MSXML, CryptoAPI, WinHTTP, etc.
Have you looked at ATL Server classes? Everything you want in unmanaged C++.
|
|
|
|
|
Yes, I have looked at them briefly and they seem reasonable.
The only thing I did not complete liked was the fact that for a lot of the wrapper classes the HRESULT still has to be checked after method invocation and this opened up the possibility of missing some error checking and having the error go undetected.
The thing that I liked about the .NET Framework classes is that all errors are reported through exceptions.
Not a huge deal though.
Thanks for the response.
Martin
|
|
|
|
|
I've been looking for the way to get system BIOS information similar to the manner in which msinfo32 works so that I can store the value in a variable for a BIOS Update Utility that I'm writing.
So far I haven't been able to find much on the subject. Can anyone help?
|
|
|
|
|
|
Can you tell me how to read/write the BIOS
I have taken up a project about cmos
Thank you in advance
|
|
|
|
|
|
Hi Dears
I want to develop a MS Word Addin. The main functionality of this addin is:
--> I have to convert a MS Word file (.doc) into (.pdf) file format.
What should I take as first step to implement this functionality.
Kindly guide/help me in the form of some code/link.
I'll be grateful to you.
Kind Regards
Atif
Watch Your Thoughts for they will become your actions.
Watch Your Actions for they will become your habits.
Watch Your Habits for they will become your beliefs.
Watch Your Beliefs for they will determine your destiny.
|
|
|
|
|
How do I invoke a thread that will be able to update Form components? In managed c++ it seems that the thread function needs to be declared as a static function. Then inside my funtion I do not seem to have access to the form.
Help.
I'm looking for a code snipit that show the thread invocation and the code inside the thread function that accesses a form component.
Thanks in advance
Jonathan Beck
|
|
|
|
|
You can just add a thread function to your form class:
public __gc class T3DConfiguration : public System::Windows::Forms::Form {
...
void ThreadProc ();
...
};
And then start the thread like this:
System::Thread *t = new System::Thread (new System.ThreadStart (this, YourForm::ThreadProc));
t->Start ();
Inside the thread procedure you can acces your form as you like. It does not have to be static.
|
|
|
|
|
I'm reading a binary column from an ADO.NET dataset into a byte array with no problem. I can then write that buffer out to disk. I've opened my images with other products and the data is being written correctly.
Now the problem. How can I display the image? I put a static control on a dialog and tried the following but to no avail:
Bitmap* image = new Bitmap(S"c:\\sample.jpg");
CPaintDC dc(&m_wndPhoto);
Graphics* g = Graphics::FromHdc(dc.m_hDC);
g->DrawImage(image, 0, 0);
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Tom, just my 2 cents:
1. You are using CPaintDC: are you doing this inside processing WM_PAINT?
2. Your m_wndPhoto window may have empty invalidated region;
3. Shouldn't you be using CDC?
Cheers,
I
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Yep. There was that problem and a couple of others. Here's the corrected code for anyone reading this thread in the future:
<br />
void CBLOBDataDlg::DisplayImageFile(Byte pictureData __gc[])<br />
{<br />
#pragma push_macro("new")<br />
#undef new<br />
System::IO::MemoryStream* dataStream = NULL;<br />
Bitmap* image = NULL;<br />
Graphics* graphics = NULL;<br />
CClientDC dc(&m_wndPhoto);<br />
<br />
try<br />
{<br />
CWaitCursor wc;<br />
<br />
if (NULL != pictureData)<br />
{<br />
dataStream = new System::IO::MemoryStream(pictureData);<br />
<br />
image = new Bitmap(dataStream);<br />
graphics = Graphics::FromHdc(dc.GetSafeHdc());<br />
<br />
RECT clientRect;<br />
m_wndPhoto.GetClientRect(&clientRect);<br />
<br />
graphics->FillRectangle(SystemBrushes::Control, <br />
clientRect.left, clientRect.top,<br />
clientRect.right - clientRect.left,<br />
clientRect.bottom - clientRect.top);<br />
<br />
graphics->DrawImage(image, 0, 0, image->Width, image->Height);<br />
}<br />
else<br />
{<br />
graphics = Graphics::FromHdc(dc.GetSafeHdc());<br />
<br />
RECT clientRect;<br />
m_wndPhoto.GetClientRect(&clientRect);<br />
<br />
graphics->FillRectangle(SystemBrushes::Control, <br />
clientRect.left, clientRect.top,<br />
clientRect.right - clientRect.left,<br />
clientRect.bottom - clientRect.top);<br />
}<br />
}<br />
catch(Exception* e)<br />
{<br />
MessageBox::Show(e->Message, S".NET Exception Thrown", MessageBoxButtons::OK, MessageBoxIcon::Error);<br />
}<br />
__finally<br />
{<br />
if (graphics) graphics->Dispose();<br />
if (image) image->Dispose();<br />
if (dataStream) dataStream->Dispose();<br />
}<br />
#pragma pop_macro("new")<br />
}<br />
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Is there anyway to convert a .Net String class or a __wchar_t __gc[] array to an unsigned char __gc[] array?
thanks
|
|
|
|