|
i'm currently working with visual studio 2008 express edition. Why the coode doesn't agree with my original description ?(maybe i used different variabiles name but that was just an example, i'm going to correct it). pls help me point out. Now i give you all the things i have done:
1) we want to develop an application that can speak with database
2) i am making the visual side of the project using visual studio 2008 express
3) my friend is developing the 'wrapper' to connect to mysql but it's developing not in vs2008 express edition
4) now i want to integrate his code with mine
5) i take his code and if i make a program (without using clr) it works fine
6) i take his code and put it on a form, using clr option to compile,it compiles well but then it crash giving me the error you see in the starter thread
any ideas...do i have to be more specific?
thx man i really want to understand where is the problem and you are trying to help me
ps you need to correct the path of the linker to where you have the project to get the lib
ps2 maybe you need mysql do be installed on your pc with developer option to use because it use a mysql dll to run
or --> you have to put this dll in the project folder and you'll get it--download--
modified on Thursday, October 1, 2009 8:24 AM
|
|
|
|
|
carlo.andreoli wrote: 6) i take his code and put it on a form, using clr option to compile,it compiles well but then it crash giving me the error you see in the starter thread
Well, as I stated before, you have all the tools to track down where it is failing. Use the debugger, step through the program to the fail point and then look at the variables and stack trace to see what is going on. If the problem lies in your friend's library then get him to fix it.
|
|
|
|
|
i'll give it a try...but i'm new to c++ programming..i have only developed thing through application by now so i have to skill a lot. Now i'll try to look at the stack frame to see if i can understand something
|
|
|
|
|
carlo.andreoli wrote: i'll give it a try...but i'm new to c++ programming
Maybe you should have started with a simpler project! Learning C++ is not the easiest task, even for programmers coming from C or Pascal background. You made it even harder by going for the managed C++/CLI form which adds a whole extra level of complexity. Buona fortuna!
|
|
|
|
|
Hello Everyone, I am struggling with a problem for two days and could not figure out what to do.
Here what I am trying to do.
I have cli<array> which is two dimentional. I get data in that array but is not in order. I want to copy that data in a temp array [same type] in order. I want change the location of the column and put it indore to the temp array.
example,original array A[0,0]
A[0,1]
A[0,2]
A[0,3]
I want to copy column in a different location of the new array
B[0,0]=A[0,2]
B[0,1]=A[0,3]
B[0,2]=A[0,0]
B[0,3]= A[0,0];
If anybody can please give me a hint would be very helpful.
if you did not understand the question please ask me I really need it soon.
Thanks in advance.
|
|
|
|
|
What specific problem are you facing here?
|
|
|
|
|
Hi Navaneeth, Sorry to answer you late but thanks for your kindness.
the question I have is I want to copy a two dimentional array but not just a carbon copy. I want to get what ever index I want and insert into a new array.
for example, array A has 10 index and I want to copy array A to Array B but not same order.array A's index 1,3,6,8 I want it to be array B's index 1,2,3,4.
how do I do this.
Sorry question may trivial but I need to know it since I am not a expert yet.
thanks
Jashim
|
|
|
|
|
jashimu wrote: I want to copy column in a different location of the new array
B[0,0]=A[0,2]
B[0,1]=A[0,3]
B[0,2]=A[0,0]
B[0,3]= A[0,0];
I think this is your only solution, since there appears to be no logical order to your input data.
|
|
|
|
|
I figure it out the same. I did manually everything.
thanks for your reply Richard.
jashim
|
|
|
|
|
googling around i found some extension to the default tiempicker to make backcolor suitable...what i have till now is:
namespace primoAlpha {
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
using namespace System::Security::Permissions;
public ref class extendedDateTimePicker : DateTimePicker
{
private:
Color _BackColor;
public:
property Color BackColor
{
virtual Color get() override {
return _BackColor;
}
virtual void set(Color value) override {
_BackColor = value;
Invalidate();
}
}
protected:
[SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)]
virtual void WndProc( Message% m ) override
{
if ( m.Msg == (int) 0x0014 ) {
Graphics ^g = Graphics::FromHdc(m.WParam);
g->FillRectangle(gcnew SolidBrush(_BackColor),
ClientRectangle);
g->ReleaseHdc();
return;
}
WndProc(m);
}
};
}
the code compile with no error but when i run it gives me an
"An unhandled exception of type 'System.StackOverflowException' occurred in primoAlpha.exe"
any help is really apprecieted, i'm a noob in c++
|
|
|
|
|
Hi,
IMO your WndProc is calling itself instead of the base WndProc method. I don't know the correct C++/CLI syntax for it though.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
the code from which i constrcuted the code tell to use
Form::WndProc(m);
but if try to use it it tell me "candidate function(s) not accessible"
cause Form::WndProc is a private code.
|
|
|
|
|
it works in C#:
public class extendedDateTimePicker : DateTimePicker {
protected override void WndProc(ref Message m) {
base.WndProc(ref m);
}
}
BTW: the message parameter takes a reference.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Luc Pattyn wrote: the message parameter takes a reference.
Do you have any idea why it is passed as reference?
|
|
|
|
|
the message is a struct you may want to modify and pass on.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Ahh. That was simple. I was not aware that Message is a struct.
Thanks
|
|
|
|
|
With the number of messages flying around in Windows, they'd better be structs.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Correct syntax is BaseClassName::MethodName . So you write DateTimePicker::WndProc(m) .
public ref class extendedDateTimePicker : DateTimePicker
{
protected:
[SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)]
virtual void WndProc( Message% m ) override
{
if ( m.Msg == (int) 0x0014 ) { }
DateTimePicker::WndProc(m);
}
};
|
|
|
|
|
antd the winner is "N a v a n e e t h" ...thank you man...you pointed out the problem...still i'm wondering why i didn't get it by my self
|
|
|
|
|
Winner should be Luc as he pointed out the problem. I am just a syntax provider.
modified on Monday, September 28, 2009 10:22 AM
|
|
|
|
|
yes...but i know only c++ and base for me before today was an unknown identifier... now i know it's a pointer to the "base class" from which i derive mine
|
|
|
|
|
I have a background worker thread which I run to analyse some data the results of which I want to dipslay in the GUI. My question is how do I inform the main GUI thread that the worker thread has finished (the data is ready) so that it can update the GUI. I do not want to pause the main GUI thread to wait for the worker thread.
The only method I know (used back before Managed C++/CLI) is to send a windows message from the worker thread. This is handled in the message loop of the main GUI thread and so the GUI can be updated. However this feels a bit clunky to me and can cause problems when a dialog is open and the windows message is handled in the dialog's message loop and not that of the main application.
Does anybody know of a better method?
|
|
|
|
|
LetsMond wrote: how do I inform the main GUI thread that the worker thread has finished (the data is ready) so that it can update the GUI
Once done, call a method that updates GUI thread. Only thing to take care is to use Invoke/BeginInvoke. Here is a sample code.
MethodInvoker^ method = gcnew MethodInvoker(this, &YourForm::UpdateUI);
this->BeginInvoke(method); This sends a message to the main thread's message loop. You can update the controls inside the method UpdateUI .
MethodInvoker is delegate supplied with .NET framework. If you want to pass additional arguments to method, you may need to create your own delegates.
LetsMond wrote: The only method I know (used back before Managed C++/CLI) is to send a windows message from the worker thread. This is handled in the message loop of the main GUI thread and so the GUI can be updated.
This is the correct method. Message sending is encapsulated inside Invoke or BeginInvoke methods. These methods calls win32 SendMessage and PostMessage .
|
|
|
|
|
Thanks. This will do what I need.
|
|
|
|
|
Good to hear that it helped.
If you are interested, another possible method to do cross thread communication is to use SynchronizationContext[^] class. This will do the marshaling and provide a neat way for cross-thread communication.
Here is a sample code.
SynchronizationContext^ context = SynchronizationContext::Current;
Thread^ t = gcnew Thread(gcnew ParameterizedThreadStart(this, &YourForm::Execute));
t->Start(context);
void Execute(Object^ obj)
{
SynchronizationContext^ context = dynamic_cast<SynchronizationContext^>(obj);
context->Post(gcnew SendOrPostCallback(this, &YourForm::UpdateUI), "Sample text");
}
void UpdateUI(Object^ obj)
{
}
|
|
|
|