|
Hi Dewm,
You were getting your money's worth from Luc and Mark - here's my penny. I'll take the change with no insults...
1) Look at the generated IL. Richter does this extensively in his book CLR via C#[^]. Veryify the IL generated is what you wanted.
2) Change from initialization to assignment. I would expect if this is an issue, it is unveiled in (1).
3) WinDbg with SOS. WinDbg can debug IL. I've never had to do it, but John Robbins covers the topic extensively in Debugging Applications for Microsoft® .NET and Microsoft Windows®[^].
Jeff
|
|
|
|
|
|
Ok....I think I'm losing it guys.
I added a testclass like this:
<br />
public ref class TestClass {<br />
public: <br />
TestClass(String^ jj);<br />
~TestClass();<br />
<br />
private:<br />
String^ sPath;<br />
};<br />
With implementation like this:
<br />
TestClass::TestClass(String^ jj)<br />
{<br />
}<br />
<br />
TestClass::~TestClass()<br />
{<br />
}<br />
How much more simple can it get?
Instantiating it like this:
<br />
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {<br />
MFG::TestClass^ ttt = gcnew MFG::TestClass("test");<br />
MessageBox::Show("instance created");<br />
}<br />
Works fine on my dev station of course, but it hangs on two other stations here that are non dev.
Dewm Solo - Managed C++ Developer
|
|
|
|
|
Creation of such a testclass in my project of course works 100% on any workstation.
So now I'm going to create a new DLL with just a test class.
Dewm Solo - Managed C++ Developer
|
|
|
|
|
Ok,....Referencing a test DLL with just a test class does the same at instantiation.
The next thing I'm thinking of trying is a test app that will reference this new test dll and see what happens.
Dewm Solo - Managed C++ Developer
|
|
|
|
|
I creating a windows form application. I Referenced that test dll. In a button's click event created an instance of the test class.
Nothing can go wrong right? I have done this at least a million times. Well ...same problem on the workstation. Does anyone has an idea? There are no other dependencies. There is nothing that can cause such a hang.
...hmmm...Just thought of something. I'm going to try to run a release build. I don't expect much out of this, but who knows what compiler optimizations might come up with.
I tried this and the release builds does exactly the same. An empty app with just a button and reference to a dll that contains only a test class that has a ctor, dtor, and one string member only. It still hangs at creation of a test class object. Does anyone has suggestions? At this point I am wondering if this is not a problem that has to do with the .Net installation on the client station. Although this happens on more than one client station....
How can I debug this? On a client station nonetheless.
Dewm Solo - Managed C++ Developer
modified on Tuesday, December 18, 2007 2:53:56 PM
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. I have overridden the OnPaint() method. If I draw something on the form due to a button click and then Invalidate() is invoked the OnPaint() method then draws the Form1 over thus erasing what I just drew. My work around for this is to define a set of booleans (one for each object) and then check the values of the booleans in the OnPaint() method to see if they need to be repainted. Is there a better way to do this?
Buck
|
|
|
|
|
Handle WM_ERASEBKGND as well, and don't ever call the base class. You wil need to draw the whole form yourself then.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, I'm using visual Studio 2005 C++/CLI. I need to have some Graphics^ shapes on a display and I want them to have NO FILL so they will appear transparent. The System::Drawing::Color does not have a Color::None or Color::Clear. This is probably pretty simple but I can't seem to find the answer.
Buck
|
|
|
|
|
The color is transparent.
|
|
|
|
|
System::Drawing::Color::Transparent ?
*EDIT* Oops I see you knew that
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
dear Sirs,
I want that my forms size change according the screen size.
In MFC Visual C++ 6.0 I have got CHelpLayout Class. But In Visual C++ Net 2005 I don't know what to do.
When I put Maximise. The screen Is full but all controls are in the left only other place is empty.
Can you help me ?
|
|
|
|
|
Hi
I wrote this code with /clr , EnumChildWindows is C++ Interop
BOOL CALLBACK EnumWindowsCallback(HWND hWnd, LPARAM lParam){}
EnumChildWindows(hwnd, EnumWindowsCallback, 0);
Error error C3867: 'EnumWindowsCallback': function call missing argument list; use '&EnumWindowsCallback' to create a pointer to member
How to call EnumChildWindows function not using p/invoke ?
Thanks
|
|
|
|
|
EnumChildWindows(hWnd, (WNDENUMPROC)&enumChildWndCallback, 0);
D.
|
|
|
|
|
Thank for your reply , but
BOOL CALLBACK EnumWindowsCallback(HWND hWnd, LPARAM lParam){}
EnumChildWindows(Handle, (WNDENUMPROC)&EnumWindowsCallback, 0);
error C2276: '&' : illegal operation on bound member function expression
|
|
|
|
|
Hi,
I don't know the details in C++ but here is how I do it in C#; it takes a delegate,
and code along these lines where list happened to be an ArrayList:
public delegate bool LP_EnumWindowsProc(IntPtr hWnd, int lParam);
EnumChildWindows(hWnd, new LP_EnumWindowsProc(CollectVisibleWindows), 0);
private static bool CollectVisibleWindows(IntPtr hWnd, int lParam) {
if(IsWindowVisible(hWnd)) list.Add(hWnd);
return true;
}
|
|
|
|
|
I need to write this code in C++/CLI only , VS 2008 , /clr
After trying C++ Interop unsuccessfully , I use p/invoke and .NET delegate
delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
[DllImport("user32", CharSet=CharSet::Ansi, SetLastError=true, ExactSpelling=true)] static int EnumChildWindows(IntPtr hWndParent, EnumWindowsProc^ lpEnumFunc, IntPtr lParam){}
bool CALLBACK EnumWindowsCallback(IntPtr hWnd, IntPtr lParam){}
void UseIt()
{
EnumWindowsProc^ fp = gcnew EnumWindowsProc(EnumWindowsCallback);
EnumChildWindows(Handle, fp, IntPtr::Zero);
}
error C3350: 'EnumWindowsProc' : a delegate constructor expects 2 argument(s)
error C3867: 'EnumWindowsCallback': function call missing argument list; use '&EnumWindowsCallback' to create a pointer to member
I can't understand
|
|
|
|
|
delegate bool EnumWindowProc(IntPtr hWnd, Int32 lParam);
bool GlobalCallback(IntPtr hWnd, Int32 lParam)
{
return true;
}
DllImport("User32.DLL")]
public static extern void EnumWindows(EnumWindowProc callback, Int32 lParam);
EnumWindowProc^ ewp += gcnew EnumWindowProc(&GlobalCallback);
EnumWindows(ewp, 0);
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
How can I make a form so that,
I have a panel of the left where there are buttons, and when I clik one button; on the right side I have a form related.
It's must appear like codeproject forms; On left a menu and on right side details of each menu item when we click on.
Who can help me ?
I am using Visual c++ .NET 2005
|
|
|
|
|
Hi,
Does anyone has a good article or example to add the Flash.ocx to my application exe (VS C++).
I need to make a setup with a standalone flashplayer, without registering or installing the adobe flash ocx.
thx
Kurt
|
|
|
|
|
Dear Sir,
I am using Visual C++ Net 2005, I am a beginer.
I need to realise a Form like I see codeproject forms.
It means at left a column of items, when you choose an item the details appear at right side. And the left side stay like that without changing.
I try to use FLOWLAYOUTPANEL I put it at the left, but How to change on the right side.
I need that when I click on the button on the left side, I seen a panel with related control that I can fill or display on the right side
|
|
|
|
|
mikobi wrote: I need to realise a Form like I see codeproject forms.
Is this an ASP.NET form or Windows Form?
mikobi wrote: I try to use FLOWLAYOUTPANEL
Try using something else like a TableLayoutPanel or a Split Container.
|
|
|
|
|
I need to do it with windows forms
Can you help me
|
|
|
|
|
Your question is like a ASP.NET question did you ask on that forum?
|
|
|
|
|
Using Visual C++ 6.0, would like to detect anytime a variable value changes during execution, haven't yet discovered a way to do with the Microsoft Debug tool. Any ideas will be helpful. Thanks in advance, Sid Kraft.
Sid
|
|
|
|