|
|
Member 3273983 wrote: I want to do it in managed C++ which uses the form class instead of CWin* classes.
Yes. C++/CLI allows you to use managed and native code in the same project. So you can in fact use the approach from that article in your managed code. If you don't know how to create a C++/CLI project that supports managed and native code then you need to go read the Introductory CLI articles here on CodeProject.
|
|
|
|
|
Thanks for the info. I will look up the tutorials.
-Parth
|
|
|
|
|
I had one more question, is the same thing possible to get done with Java windows as target?
|
|
|
|
|
Hook up!
><O>
><O>
><O>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I have a situation where in i need to send the username and the password to a website and get the confirmation back from the website. Website takes the request in the form of query string.<b> The problem is when i send the request i am not getting the exact response, instead somtimes i get the html code of the website with the response or sometimes i get the url with response. below is the code, can someone please help me with this
mId is the username and mPwd is the password
try
{
String^ lcUrl = "http://login.somewebsite.com/Authorization/";
lcUrl = lcUrl + mId + "/" + mPwd;
HttpWebRequest^ loHttp = (HttpWebRequest^) WebRequest::Create(lcUrl);
String^ lcPostData = mId + "/" + mPwd;
loHttp->Method="POST";
loHttp->Credentials = CredentialCache::DefaultCredentials;
loHttp->ContentType = "application/x-www-form-urlencoded";
array<Byte,1>^ lbPostBuffer = gcnew array<Byte,1>(lcPostData->Length);
lbPostBuffer = System::Text::Encoding::UTF8->GetBytes(lcPostData);
loHttp->ContentLength = lcPostData->Length;
Stream^ loPostData = loHttp->GetRequestStream();
loPostData->Write(lbPostBuffer,0,lbPostBuffer->Length);
loPostData->Close();
HttpWebResponse^ loWebResponse = dynamic_cast<HttpWebResponse^> (loHttp->GetResponse());
Encoding^ enc = System::Text::Encoding::GetEncoding(1252);
StreamReader^ loResponseStream = gcnew StreamReader(loWebResponse-&gt;GetResponseStream(),enc);
lcHtml = loResponseStream->ReadToEnd();
loWebResponse->Close();
loResponseStream->Close();
MessageBox::Show(lcHtml,"Confirmation",MessageBoxButtons::OK);
}
catch(IOException^ exio)
{ MessageBox::Show(exio->Message,"Error",MessageBoxButtons::OK);
}
catch(WebException^ webEx)
{ MessageBox::Show(webEx->Message,"Error",MessageBoxButtons::OK);
}
catch(Exception^ ex)
{ MessageBox::Show(ex->Message,"Error",MessageBoxButtons::OK);
}
return lcHtml;
Naveen
|
|
|
|
|
Hi All,
I am Savitri here. I am new to this forum and also new to vc.net language.
I am getting confusion in delegates and events in vc.net. Please if any body have documents and examples for this topic please give me. I will read from that. I am not getting any examples in vc.net so i am asking you all. Please do needful for me.
Thanks in advance.
Regards,
Savitri p
|
|
|
|
|
There is a series of introductory articles for C++/CLI here on CodeProject. I imagine they cover delegates. Maybe you should check that out.
|
|
|
|
|
Hi,
I want to display online data in child windows of MDI application of VC++.Online data means the continuous messages which is receiving from other PC's. I want to know whether it is possible to display online and if it is possible how i can display. Or If any one knows any of activeX control for this.. please help me..
Thanks.
|
|
|
|
|
Your question is not clear. Are you doing this in C++/CLI? If not, this is not the correct forum.
|
|
|
|
|
I am getting the following message box whenever I try to debug the code.
<b>“The following module was built either with optimization enabled or without debug information:”
“To debug this module, change its project build configuration to Debug mode.
To suppress this message, disable the ‘Warn if no user code on launch’ debugger option”</b>
I have built the entire code in Debug mode and no where I have enabled the optimization setting.
I am using Microsoft Visual Studio 2008.
I am using the C# .NET for the very first time please help me out in this.
|
|
|
|
|
Are you sure that you have done a debug build? Do you have multiple projects in your solution? If yes, how you added the reference?
|
|
|
|
|
I have solved that issue .........
I just put my dll in GAC by usin Visual studio 2008 command prompt
|
|
|
|
|
deadlyabbas wrote: I just put my dll in GAC
Is that really what you wanted?
The GAC is not a dumping ground for fixing debugging error messages...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: The GAC is not a dumping ground for fixing debugging error messages
Says you! Next you'll be suggesting that people read the documentation.
|
|
|
|
|
Thnx 4 looking into my problem...........
Sorry 4 d pain i gave .......
Well it ended happily
|
|
|
|
|
Thank goodness for lingo2word.com, otherwise I wouldn't be able to
read his/her reply to you...
Wow...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I just figured he was replying to you anyway. Probably having trouble figuring out the whole tree structure concept.
|
|
|
|
|
Hi all,
I know, the question sounds simple, but I do not get it at the moment.
Drawing a rectangle into a picturebox is no problem. But as soon as I loaded
an image (here: a bitmap) into it, the image covers my rectangle and it is not to be
seen anymore.
I tried so much things now, getting a the Graphics-Handle of the image itself seemed to
be most logic for me, like:
Graphics ^g = e->Graphics->FromImage(this->pictureBox1);
g->DrawRectangle(gcnew Pen(Color::Black,3),*m_AreaRoi[i].AreaRect);
Failed!
Another try with this:
<pre>e->Graphics->DrawRectangle(gcnew Pen(Color::Black,3),*m_AreaRoi[i].AreaRect);
inside the OnPaint()-Function also failed.
The Project in this case is a Forms Control Library with a picturebox in it, as additional information.
I just want to draw a "region of interest"-rectangle onto the image loaded in the picturebox, it can't
be that difficult...
Please help me!
Thanks
|
|
|
|
|
Are you calling Invalidate() after finished drawing rectangle? If not, call this->pictureBox1->Invalidate() which will force the picture box control to redraw.
|
|
|
|
|
Great, it worked! Thank you!
Graphics ^g = this->pictureBox1->CreateGraphics();
g->DrawRectangle(gcnew Pen(Color::Black,3),*m_AreaRoi[i].AreaRect);
this->pictureBox1->Invalidate();
That's the way it does right.
Instead of Invalidate I used pictureBox->Refresh() and the rectangle always just twinkled a short time and
has gone away.
I don't understand this behaviour, why does Refresh() after calling the functioning code above also "delete" the rectangle?
So what are the Differences between Invalidate and Refresh?
Thanks a lot!
|
|
|
|
|
I am not sure why Refresh didn't worked for you. When you call Invalidate() , it just invalidates the client area. It will not repaint immediately. It will be repainted when the control receives a WM_PAINT message. So Invalidate() is not synchronous.
Refresh just calls other overload Invalidate(true) and Control.Update to force paint on the control. This is synchronous and you can see the effect immediately.
I tried your sample and Refresh worked just fine on my machine.
|
|
|
|
|
I'm trying to learn c++ and I just spent some time trying to use GetWindowText(). I was getting a linker error for unresolved token LNK2028, LNK2019. I finally added "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\User32.lib" path to Project->Properties->Linker->Input and it worked. But I have two questions for anyone who may know so that I may understand a little better. And maybe someone else can use this later, too.
.NET 2008 C++, WinXP Home
1) Why did I have to that? I kept telling myself the dll was already referenced and I had the "windows.h" #include going on. Everything looked correct (as far as my understanding goes (not far)).
The code is in a normal CLR project, .NET Form button_click (so it must be using User32.dll already, right?). If you check the Linker->Input Additional Dependencies it shows User32.lib in "Inherited Values" along with all of the other Windows libraries. So I assumed I didn't have to add it.
2) It may have worked but did I do it 'right'? I ran a search on my drive for user32.lib (I expected it in C:\WINDOWS somewhere but it was in the path listed above. Should I move it? There are others in "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" and the like.
Thanks.
|
|
|
|
|
thenutz72 wrote: Why did I have to that? I kept telling myself the dll was already referenced and I had the "windows.h" #include going on.
windows.h has nothing to do with the linker. It's the import library
you were missing that the linker needed.
thenutz72 wrote: The code is in a normal CLR project, .NET Form button_click (so it must be using User32.dll already, right?).
No. The .NET framework may use user32.dll internally but that has nothing to do with your project.
thenutz72 wrote: It may have worked but did I do it 'right'?
Not necessarily. If you're using native code from a managed class' code,
the you would use platform invoke: Using Explicit PInvoke in C++ (DllImport Attribute)[^]
You shouldn't be mixing paths to different SDKs. If you're using the
Visual Studio IDE for your project, then use its directories settings
to configure paths to the ONE SDK you want to use. Then you don't need
paths in all your project configurations unless you need to override something.
Learning C++/CLI is a pretty big undertaking for a beginner in C++...
Are you sure you don't want to get familiar with the C++ language before adding
the complexity of the managed world? All your questions are fundamentals you should know
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|