|
Since this is your own dialog you need to review the constructor to ensure you are correctly instantiating from a base CDialog() [^] class.
|
|
|
|
|
I told you everything works fine in VS2003. Also in VS2008 Release mode.
Yes,my dialog inherits from Dialog class, and in instructor, I do something like the following:
CEditDlg::CEditDlg( System::Object * mainApp, NCGenericCompont* pCompont, UINT menuSel, CString type,CWnd* pParent /*=NULL*/)
: CDialog(CEditDlg::IDD, pParent)
The codes should have no problem, the problem should be it cannot locates the resource file, there are a lots of people ask this questions about this in internet, but seems cannot find answer.
|
|
|
|
|
Well it's always possible this is a bug that should be reported to Microsoft.
|
|
|
|
|
Hi, Please check whether ur object is created properly before u call the domodal().
If it is fine, keep the break point in the dialog class's "oninitdialog" function and move forward step by step.
I guess the issue would be in any of the controls u have used.
Thanks,
Arun P.
|
|
|
|
|
Hi all, I am working on class to wrapp unmanaged pointer. I am just confused, whether pinning of value struct is needed in C++/CLI, i.e. whether if I will not do it, it can cause some problems.
In C#, I am not able to fix structs:
Point pntA = new Point(10, 25);
Point pntB = new Point();
unsafe
{
fixed (Point* ptrA = &pntA, ptrB = &pntB)
{
ptrB->X = ptrA->X;
ptrB->Y = ptrA->Y;
}
}
but, I can simply use address-of operator:
Point pntA = new Point(10, 25);
Point pntB = new Point();
unsafe
{
Point* ptrA = &pntA, ptrB = &pntB;
ptrB->X = ptrA->X;
ptrB->Y = ptrA->Y;
}
What is confusing me is that pin_ptr lets me pin structures as well as use address-of operator:
generic <typename T> where T : value struct
T GetValueA(void* ptr)
{
T val = Activator::CreateInstance<T>();
pin_ptr<T> valPtr = &val;
memcpy(valPtr, ptr, sizeof(T));
return val;
}
generic <typename T> where T : value struct
T GetValueB(void* ptr)
{
T val = Activator::CreateInstance<T>();
memcpy(&val, ptr, sizeof(T));
return val;
}
My questions are:
Is pinning needed in C++/CLI functions to fix value struct
before using its pointer in unmanaged function?
Are value structs allocated in the unmanaged heap?
Thanks all,
Dusan
|
|
|
|
|
Hi,
I have created a checkbox using MFCRibbonCheckBox. Depending on certain conditions i want to disbale it.
But it does not have any property for disabling. Can anybody help me out?
thanx in advance
|
|
|
|
|
Hello everybody.
I'm doing a little project for my B.Sc degree, in which i need to retreive tcp parameters and proceess them.
I'm kinda new to all this socket proggraming and network progamming, can you help me with writing a proggram that gets the TCP parameters in c++?
thanks
|
|
|
|
|
Assuming you are doing this in Windows then you can start here[^].
The best things in life are not things.
|
|
|
|
|
Richard's suggestion is accurate, but if you'd like to see what your target program should look like, see Wireshark[^]. If you're allowed to use libraries for your programs, Wireshark is based on a library called WinPCap[^] (which you can pull into your code and query to capture different types of traffic).
|
|
|
|
|
He's doing a BSc and cannot even start to research his chosen subject!
The best things in life are not things.
|
|
|
|
|
Maybe he just needs a little push... 
|
|
|
|
|
Joking aside, I am constantly amazed at the number of people doing degrees who do not seem able to use the most basic bit of initiative to start investigating the subject they choose to do their dissertations on. How anyone can be doing a college/university course in computing and not know how to perform a simple Google search is quite worrying; how on earth are these people going to fare when working in the real world?
[edit]Yes, I know, this is not really the place for a rant.[/edit]
The best things in life are not things.
|
|
|
|
|
I do agree, quite surprising to see that many people ask questions without research... Maybe these are the people who never finish a degree or change major after a few courses.
|
|
|
|
|
A little help please.
Is there any reason why the following will not work in a managed C++/CLI project?
A vector of pairs of managed Strings.
cliext::vector<cliext::pair<System::String ^, System::String ^> > ^attributes;
When linking I receive the following error...
1>Linking...
1>Generating code
1>Finished generating code
1>gm_vcet_k010_dimension_exporter.obj : error LNK2020: unresolved token (060000EB) cliext.vector<cliext::pair<System::String ^,System::String ^> >::Clone
1>C:\Documents and Settings\zzmgd6\My Documents\nxopen\k010_vcet_dimension_reporter\Release\gm_vcet_k010_dimension_exporter.dll : fatal error LNK1120: 1 unresolved externals
Thanks for any help.
modified on Wednesday, July 20, 2011 9:27 PM
|
|
|
|
|
You don't need the ^ in front of attributes. Here's a working example:
#include "stdafx.h"
#include <cliext/vector>
#include <cliext/utility>
#include <cliext/algorithm>
using namespace System;
int main(array<System::String ^> ^args)
{
using namespace cliext;
vector<pair<System::String^, System::String^>> attributes;
attributes.push_back(make_pair(gcnew String("Background"), gcnew String("Red")));
attributes.push_back(make_pair(gcnew String("Visibility"), gcnew String("Collapsed")));
attributes.push_back(make_pair(gcnew String("Happy"), gcnew String("True")));
for_each(attributes.begin(), attributes.end(), [](pair<System::String^, System::String^> p){
Console::WriteLine(p.first + " = " + p.second );
});
return 0;
}
|
|
|
|
|
I developed Web Services program in WCF with VS 2008 C++/CLI on server side and deployed it. But I have no idea how to generate wsdl file. My template is Visual C++ CLR console application. So i can't see any wsdl file.
I need your advice! Thanks in advance.
Best Regards!
Joseph Hwang
|
|
|
|
|
Have you tried putting the service address in a browser and appending ?wsdl to the address?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
how to use crystal report in c++/clr?
is it possible to do so or i have to use other options?
i need to print some labels and a picture box, is it a good idea to use reporting or i should consider capturing the form screen and then print it.
|
|
|
|
|
|
Hi all
we have unmanaged C++ third party library which needs to be used in C# Environment. hence I am writing managed C++ wrapper on top
to use it in C# environment
I came across some of the situation put me into trouble.Can any one resolve my doubts
1) I was using the pin pointers to convert from managed string (String^) to unmanaged string(char * buffer)
is it safe? are there any performance issues with this ?
If then what is the best logic to do? please see the code snippet below i used
for converting from C# string to char * buffer(unmanaged string)
bool bRet = false;
pin_ptr<const wchar_t> w_string = PtrToStringChars(s);
size_t converted_chars = 0;
size_t size_bytes = ((s->Length + 1) * 2);
if ((size_bytes / 2) <= output_len)
{
memset(output, '\0', output_len);
if (!wcstombs_s(&converted_chars, output, output_len, w_string, size_bytes))
bRet = true;
}
return bRet;
2)Can i use System::Generic::Collections such as Dictionary and List for sending data from C# to managedC++
and viceversa?
I need to send collection of datasets from managed C++ to C# code. Can i use the List to do this.
if not are there any best practices to achieve this?
3)Is it necessary to use gc when i am creating any memory in managed C++
Waiting for ur reply
Thanks in advance
Sukumar
|
|
|
|
|
Hi,
1) I tend to use the msclr::interop::marshal_as templates for string conversions rather than pinning memory as they work in a nice tidy C++ RAII way, clearing up any temporary/locked memory when going out of scope. They handle stl, COM and straight const char * type conversions. See http://msdn.microsoft.com/en-us/library/bb384859.aspx[^]
2) Yes. Works just the same, except with C++/CLI syntax. You will need to do some translation (e.g. to copy into an stl data type) to send to purely native code though.
3) The general rule is if you are creating a managed object, use gcnew, otherwise use straight c++ new. The garbage collector will do the rest. You can still delete sooner if you want to.
Hope that helps.
|
|
|
|
|
Hi
Is it necessary to use delete when i am using gcnew to create an object
i got this code snippet from msdn deletes the context that was created by gcnew
is it correct?
marshal_context ^ context = gcnew marshal_context();
const char* str4 = context->marshal_as<const char*>(str);
puts(str4);
delete context;
|
|
|
|
|
The delete is not necessary as this is a references and the GC will collect that context object when there are no more outstanding references. The delete is probably just attempting to make it explicit and hope to clean up sooner from what I can tell.
|
|
|
|
|
Hi All,
Can any suggest me book that explains better for mangaged extenstions for VC++ for .Net Version 2.0 and above ?
|
|
|
|
|
Try Pro Visual C++/CLI for .Net 3.5 by Stephen Fraser from Apress
Ger
|
|
|
|