|
Hello,
at the moment I'm searching some logging possibility that I can use in .net and in native c++. For pure .net implementation I have used until now the Enterprise logging application block. But for the native c++ application I don't cant use this, because in this parts I really need a fast solution.
Does anyone now a solution that works in booth managed and unmanaged parts and is also fast?
Best regards
Hansjörg
|
|
|
|
|
Develop a simple WIN32 dll - Use it from both unmanaged and managed worlds.
Cheers,
Suresh
|
|
|
|
|
Helo...I have my inteface in c++ and I want to take the data from the interface in the main program like this:
int main(array ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
int container = Convert::ToInt32(forminterface::Form1::ContainerWidthtextBox::...., System::Globalization::CultureInfo::CurrentCulture);.........}
in the interface I have a TextBox...ContainerWidthtextBox in which I introduce the data ...how can I use this value in my main ....because it doesn't let me to use:
int container = Convert::ToInt32(forminterface::Form1::ContainerWidthtextBox->Text, System::Globalization::CultureInfo::CurrentCulture);
it give me an error like Error 5 error C2227: left of '->Text' must point to class/struct/union/generic type please help me.......
lavi
|
|
|
|
|
Please help me...how can I get a value in main from my interface....it's a method?...I am disperate..I must solve this...
|
|
|
|
|
Following snippet should give you some idea about usage.
TestForm::Form1^ myform = gcnew Form1();
Application::Run(myform);
MessageBox::Show(myform->textBox1->Text);
-- modified at 5:25 Wednesday 16th May, 2007
Probably, you need better alternative. But, you was facing problem, because, of using object in wrong way, infact, I guess, edit box variable was not recognized by compiler.
Prasad
MS MVP - VC++
|
|
|
|
|
It seems to me Prasad had it right...you need an actual object to access its "Text" property:
Form1^pForm1 = gcnew Form1()
Application::Run(pForm1);
int container = Convert::ToInt32(pForm1->Text, ...);
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
thanks .....I solved the problem
|
|
|
|
|
|
I’m converting an old MFC program to Windows Forms. In one function there is a TIMESTAMP_STRUCT type. That is defince in an MFC library function (afxdb.h).
I can’t find a replacement for this library. Any leads to locating a way to replace this would be very helpful.
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
TIMESTAMP_STRUCT is an ODBC type defined in sqltypes.h.
It looks pretty similar to a Windows SYSTEMTIME structure or a .NET System.DateTime struct.
Are you looking for a database class/framework replacement or just for the time struct?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I think this will work. Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Right now I'm creating a program that declares a structure, which also has enum inside it. Now I believe I declare the structure right, but the next step is to create a loop that has the user enter 5 different items of data for library information. But I have to use pointers, so when the loop runs and I enter the information, the data has to be sent to a structure variable only once all six attributes are entered, and the pointer values should be used to create the structure.
I was given an example:
cin >> a;
cin >> b;
library.dewey = &aptr;
This is my code so far:
struct card_catalogue<br />
{ <br />
float dewey;<br />
string title;<br />
string author;<br />
int released;<br />
int num_pages;<br />
enum type {fiction = 1, non-fiction, reference, pond};<br />
};<br />
<br />
int main()<br />
{<br />
return 0;<br />
}<br />
|
|
|
|
|
Why would you post this question in the C++/CLI forum? I would think being able to 'read' would be a prerequisite for whatever course this assignment is from.
led mike
|
|
|
|
|
Hello... I have a function which takes my data from "Contload.xml"...and put it in the variable "Wc", how can I use this variable in the main program ...so that it be able to see it in the console.....
void readfromfile(String^ strFName,int Wc)
{
strFName = gcnew String("e:\\Contload.xml");
DataSet^ dataset = gcnew DataSet();
dataset->ReadXml(strFName);
DataRowCollection^ rows;
int Wc,Hc, Dc,idi,ix;
int id[100];
int w[100];
rows = dataset->Tables[0]->Rows;
for each (DataRow^ row in rows)
{
Wc = Convert::ToInt32(row["ContainerWidth"], System::Globalization::CultureInfo::CurrentCulture);
}
how can I cal this "Wc" in the main ...?
int main(int argc, char *argv[])
{
String^ filename = gcnew String("e:\\Contload.xml");
readfromfile(filename);
Console::WriteLine("Width: {0}",Wc);b>
lavy
|
|
|
|
|
Maybe
Console::WriteLine("Width: {0}", Wc.ToString());
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
If you want both readfromfile and Main to know about the variable Wc, then one option is to use what is called 'file scope'. If you define 'Wc' in file scope, then the variable becomes global for this ONE file. You simply define 'int Wc;', or perhaps 'static int Wc;' at the top of your file. Now you can use Wc anywhere in this file.
The current code will only print out the last result of Wc. Is that what you want? If you want to print Wc for each loop, you will need the WriteLine inside the for loop.
|
|
|
|
|
|
Hi,
I declared a managed struct
public ref struct FconvertRecord
{
};
This i am using in unmanaged class like this
Convert(FconverRecord *);
But this is giving error missing ; before *.
Thanks in advance.
Regards, Eswari
|
|
|
|
|
Shouldn't you be using ^ instead of *?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello gurus,
I have a compilation and linking problem with the __loctotime_t .
Is there an equivalent of this function in Win32?
To wich library belongs this function?
How can I solve my problem?
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
I have a little bit of interop in C# which calls StgOpenStorageEx and returns an IStorage COM object:
[DllImport("ole32.dll")]
//AJ: http://www.pinvoke.net/default.aspx/ole32/StgOpenStorageEx.html
//AJ: http://msdn2.microsoft.com/en-us/library/aa380342.aspx
private static extern int StgOpenStorageEx([MarshalAs(UnmanagedType.LPWStr)]string pwcsName,
uint grfMode,
uint stgfmt,
uint grfAttrs,
ref STGOPTIONS pStgOptions,
IntPtr reserved2,
[In] ref Guid riid,
[MarshalAs(UnmanagedType.IUnknown)] out object ppObjectOpen);
IStorage structuredStorageFile = (IStorage )ppObjectOpen;
The IStorage interface isn't defined in the BCL's so we're making it ourselves:
[ComImport]
[Guid("0000000b-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
//AJ: http://www.pinvoke.net/default.aspx/Interfaces/IStorage.html
public interface IStorage
{ ... }
This object is used in various places inside our C# code with perfectly good results and all is well. Now though we're wanting to pull that object into C++/CLI, which is no problem. Then we want to pass it to 'BindIFilterFromStorage' to retrive the appropriate IFilter, which is a problem. We've had a bit of a poke around and tried getting 'BindIFilterFromStorage' to take the object but we just get '8000ffff' Catastrophic failure all the time.
If any one could shead any light on how we can achive this or indeed even if its just not possible that would be great!
Andy
|
|
|
|
|
I created the Xml file, I want to put the data from xml in a table....I have my function like this...
void readfromfile()
{
String^ strFName = gcnew String("d:\\Contload.xml");
DataSet^ ds = gcnew DataSet();
DataTable^ table;
DataRow^ row;
int i;
try
{
ds->ReadXml(strFName);
DataRowCollection^ dr = ds->Tables[0]->Rows;
}
finally
{
delete strFName;
}
}
but I don't know how to do next....to put the data from the Xml in Tables[]
I created an for like...
for (i=0; iTables->Count; i++)
{
table = ds->Tables->Item[i];...................
.......}
but it give me an error :
Error 6 error C2039: 'Item' : is not a member of 'System::Data::DataTableCollection' ...
can you tell me at least why it give me this error...please
|
|
|
|
|
With C++/CLI you can use 'for each':
for each(Table table in ds.Tables)
{}
|
|
|
|
|
Hello, I have an Xml and I want to put data from it in tables how can I do this ...please if you have an idea of example or something like this..help me...thanks
lavi
|
|
|
|
|
See this[^] is helpfuls for you?
|
|
|
|