|
Hi.
I'm coding a c++ dll with visual studio 2005 and in my project configuration properties, the Common Language Runtime Support is set to "no".
What I want is to get executables which may run in every windows machine without the need of the .NET framework, and I was wondering if I'd need another IDE to do that.
Also I'm having problems mixing up a VB 6 program which uses a c++ dll compiled with vs2005. When I run the vb executable, it holds in the process list once it's close. Nevertheless, if I compile the same VB code with vs2005 and use it with the same dll, it all works like a charm.
If you don't know the answer, clues and tips are also welcome.
Thanks in advance.
|
|
|
|
|
I don't know about VS 2005, but in 2003, there are project types in the C++ folder for ATL, MFC and Win32. Pick one of those and your application won't depend on the .NET runtime. Programmer beware: just about anything fun needs at least one external DLL linked in, and you need to ensure that those libraries are on the target client yourself. MFC requires a runtime DLL, and I'd guess ATL does too (not sure, though). If you're trying to avoid dependencies, write pure Win32, and refer heavily to Petzold.
As for the VB6/C++ project you have, if it's not unloading itself it's highly likely that your C++ DLL is leaving a thread running. Look through your C++ code for anything that's creating threads or any dependencies that may be (external libraries often do this for polling, async I/O, etc.). Make sure they're giving back the threads when the message loop for the application dies.
Stephan
|
|
|
|
|
Hi, everybody. I have to make a report with FastReport. I have a distributive for Borland CBuilder, but I don't want even install it. Today I was said that there is FastReport for .Net. If anyone hear about it please send link where I can download it and where I can read some info about FastReports.
Thanks
|
|
|
|
|
looking for wumpus1 to awnser some led sign questions on the betabrite sign
-- modified at 22:07 Thursday 25th May, 2006
|
|
|
|
|
Hi,
Can anyone explain me the internals of GC in terms of generations,freachable queues and the algorithm involved!
Thank you!
Deepa!
Be the Change you want to See!
|
|
|
|
|
|
Is there a way to customize the DataGridView ColumnHeaders?
I mean, make them look gradient or something like that?
|
|
|
|
|
I work on a web service project. Now, it has a 3rd part service which I must ask for data regular time on my own. How can I make a regular request at my server which is running the web service?
One way is I create a window service to ask the 3rd part datas at regular time, and if has datas then the window service send a request to the web service in order to transmit the receive datas to web service. I do not like this way, cuz it must create more service. How can web service send a request on it's own?
=== Interest is power! ===
|
|
|
|
|
If MS BizTalk is already a part of you existing solution - you may use it to perform periodic calls to 3rd party web service.
Otherwise - creating simple Windows service seems like a reasonable solution to me. Implement a service which will call 3rd party web service with the given period of time.
If 3rd party WS reports that remote data were changed - retrieve the new data and store it locally.
When user call your (local) web service - just retrieve that data from local storage (previously retrieved by Windows service) and pass that data back to client.
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
-- modified at 1:17 Monday 29th May, 2006
|
|
|
|
|
I have a dll that I created in C# using .NET 1.1 and am calling this dll from a win32 app (to make a long story short, we need to use this approach as one of the components we have used and invested heavily in is no longer supporting win32 development. We have been advised to make a .NET dll and call it from the win32 app via COM).
When I load the dll on a machine with .NET 2.0 intalled, the dll throws errors when trying to access functions from the third party component. Apparently, the dll is loading the .NET 2.0 assemblies. On a machine with only .NET 1.1, the dll functions correctly.
How do I force the dll to load the .NET 1.1 assemblies? I am using C# Builder 2006 to generate the C# dll.
Mark
|
|
|
|
|
By using a app configuration file, i.e. an xml file in the same directory as the executable with the same name as the executable but with a .config appended to it.
E.g. if your app is in C:\app.exe then put this:
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
<requiredRuntime version="v1.1.4322" />
</startup>
</configuration>
in a file called C:\app.exe.config
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
I have created a Form that has a PictureBox in it used for displaying multiple images. The constructor for the Form receives an array of filenames. The Form will then display the first image, Sleep() for a user-specified interval, then show the second image, Sleep(), etc.
This all works find and dandy in the normal case. However, if I am dragging another window and it overlaps the Form while trying to change the image, I get an InvalidOperationException telling me that "the object is in use elsewhere", but it won't tell me which object, and then the area where the picture is supposed to be turns into a big red X.
The entire class is about 550 lines so I won't post it here, but here are some relevant code snippets:
[Everything looks OK in the preview but it looks like it eats my whitespace in the <pre> tags when it actually gets posted]
System::Void initialize_thread()
{
using System::Threading::Thread;
using System::Threading::ThreadStart;
draw_images_thread = new Thread(new ThreadStart(this, &PlotDisplayWindow::draw_images));
draw_images_thread->IsBackground = true;
}
System::Void draw_image(int image_num) {
picturebox->Image = __try_cast<System::Drawing::Image*>(images_[image_num]);
Text = filenames_[image_num];
graphics = this->CreateGraphics();
graphics->DrawImage(images_[image_num],
AutoScrollPosition.X, AutoScrollPosition.Y,
images_[image_num]->Width, images_[image_num]->Height);
graphics->Dispose();
}
__delegate System::Void DrawImageDelegate(int image_num);
System::Void draw_images()
{
using System::Threading::Thread;
while (running) {
if (picturebox->InvokeRequired) {
DrawImageDelegate* draw_image_delegate = new DrawImageDelegate(this, &PlotDisplayWindow::draw_image);
draw_image_delegate->Invoke(image_number);
}
else {
draw_image(image_number);
}
Thread::Sleep(sleep_time_ms);
++image_number;
if (image_number == filenames_->Length) {
image_number = 0;
}
}
}
System::Void PlotDisplayWindow_Paint(System::Object* , System::Windows::Forms::PaintEventArgs* e)
{
using System::Threading::ThreadState;
if (filenames_->Length > 1) {
if (draw_images_thread->ThreadState & ThreadState::Suspended) {
draw_images_thread->Resume();
}
else if (draw_images_thread->ThreadState & (ThreadState::Unstarted | ThreadState::Stopped)) {
initialize_thread();
draw_images_thread->Start();
}
}
else {
draw_image(0);
}
}
Here is the text of the exception box that comes up:
************** Exception Text **************
System.InvalidOperationException: The object is currently in use elsewhere.
at System.Drawing.Image.get_Width()
at System.Drawing.Image.get_Size()
at System.Windows.Forms.PictureBox.get_ImageRectangle()
at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:----------------------------------------
driver
Assembly Version: 0.0.0.0
Win32 Version:
CodeBase: file:----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:----------------------------------------
Can anybody give any advice? I can email a sample project to somebody if they want a closer look.
--
Marcus Kwok
-- modified at 16:07 Wednesday 24th May, 2006
|
|
|
|
|
Hi,
to be honest I didn't even try to understand the whole code but I most probably know the problem:
Don't mix threading and painting! Dragging another window over your form will trigger dozens of paint events and generally its not safe to access the GUI from a different thread that it was created in.
In your case a simple Timer should be all you need.
|
|
|
|
|
Thanks.
Dragging another window over your form will trigger dozens of paint events Yeah, that's pretty much what I thought was happening but I couldn't see a way to make it safe.
I originally tried using a Timer but I couldn't get it to work right so I switched to the Threaded approach. However, this seems to add too much complexity. I will look at Timers again.
I assume I should use System::Windows::Forms::Timer instead of System::Threading::Timer or System::Timers::Timer, but I am still a little unclear on the differences among the three.
--
Marcus Kwok
|
|
|
|
|
Well, I did find an article[^] discussing the differences in the timers.
Time to start reading...
--
Marcus Kwok
|
|
|
|
|
Use the windows forms Timer. Basically I would just set some member variable to the image you want to show and then call Invalidate on your form/control in the Tick eventhandler.
In the paint function you could then draw the image according to the field.
|
|
|
|
|
Robert,
Thank you for your advice. I was able to get the System::Windows::Forms::Timer to work, and it works well, and is much cleaner than my threaded solution.
I am now getting some flickering and a little bit of weirdness when painting, but these problems are orthogonal to my original issue so I will do my research and start a new thread (no pun intended) once I figure out some stuff.
Thanks.
--
Marcus Kwok
|
|
|
|
|
Look for double buffering and SetStyle from the Control class .
|
|
|
|
|
Thanks, I will take a look.
--
Marcus Kwok
|
|
|
|
|
I'm making a custom control which has a collection of items. I've inherited this collection from System.Collections.CollectionBase and I've implemented all interface methods. But when I insert new item in design time, new code is not generated in "Windows Form Designer generated code" section.
What do I have to do to make designer gerenate this code?
|
|
|
|
|
Hi All,
In the stuff I'm working on at the moment, I have a C# application which has to make calls via interop to a legacy C dll, and in doing its stuff the C dll uses a lot of memory.
So, an out of memory exception is thrown, but by using various monitoring tools, its seems this is happening around about 500MB, my computer has 3GB of RAM in it. My question is this, is there an upper limit on how much RAM a .NET process can use? Or, is there a limit on how much memory a traditional dll when used via Interop can use? Where is the bottleneck? And is there a way of widening it?
Help as always appreciated.
Regards,
Rob Philpott.
|
|
|
|
|
hello,
I am creating a windows form app using VS.Net and I am having a fundamental problem with window sizing. I would like to specify the exact size of each form programmatically. Despite my efforts, the forms seem to be resizing themselves sometime between when the constructor is run and the window is actually displayed. Does anybody know why or where in the code this is happening? Any insight would be much appreciated.
Thanks!!!
rc
|
|
|
|
|
If you post some code I might be able to help.
Programatically setting the .Size, .Height, or .Width properties of the form works if the values are within the .MaximumSize and .MinimumSize properties.
|
|
|
|
|
Find something like that in Windows Form Designer generated code section.
this.ClientSize = new System.Drawing.Size(30, 373);
But even if you comment this code, designer'll generate it again. It'd be better to override OnLoad methods, where set the size of the form.
|
|
|
|
|
How do I have a form appear with the text in a TextBox selected?
I have a simple dialog window that has a single textbox for user input and two buttons (OK and Cancel). When the dialog window loads, I would like the text in the TextBox to be selected so that the user can start typing as soon as the window comes up, instead of having to manually click on (or tab to) the textbox. I have tried placing the following line:
textbox_sleep_time_ms->Select(0, textbox_sleep_time_ms->Text->Length);
both as the last statement in the constructor for the form, and as the only statement in the form's Load event handler, but neither one will select the text. I don't know if it's relevant, but I have set the default button for the form to the OK button so that the user can just press Enter to accept the value.
--
Marcus Kwok
|
|
|
|