|
You are in the wrong forum, you need to be posting this in mobile development forum.
With a subject line like that, most of the people are going to ignore your post. Give a meaningful subject to get answers to your post.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Atleast you looked after man its not problem of creating wap application or smart device application you i just want to implement mscomm control
|
|
|
|
|
hi
i want to add any exe file(s) to my app and extract it at on Hard drive at runTime ?
thanks
|
|
|
|
|
You can embed any binary data as a resource in the project. However, I am suspicious of a request to hide any executable code inside another assemby. It seems to me to be the first step on the road to creating a Trojan.
|
|
|
|
|
no..no..no
i don't want to create trojan,virus,spyware or ...
i want to protect my exe file(s), that's right
|
|
|
|
|
And how is embedding it in another exe going to protect it?
|
|
|
|
|
Hello everyone,
I have a ContextMenu in my Windows Application with FOUR of options. I was wondering how I can add a check mark to the left of the options in order to show the user which one has been selected?
Thank you very much for your help and have a great day.
Khoramdin
|
|
|
|
|
The MenuItem in the Context Menu has a Checked property. Set it to true.
Ben
|
|
|
|
|
How can I refer to the image in the resource of ma project how 2 get its path.............
|
|
|
|
|
Hi,
if you add a resource (say the icon myIcon.ico) to your project (say myProject),
inside a folder called resources, then the following code would access it:
string resourceName="myProject.resources.myIcon.ico";
Assembly assembly=Assembly.GetCallingAssembly();
Icon icon=new Icon(assembly.GetManifestResourceStream(resourceName));
BTW the "Build Action" for the resource(s) should be set to "Embedded Resource"
(use context menu "Properties" in the Solution pane).
|
|
|
|
|
Luc Pattyn wrote: (use context menu "Properties" in the Solution pane
how????
I have made it embedded but still it gives an exception on
Luc Pattyn wrote: Icon icon=new Icon(assembly.GetManifestResourceStream(resourceName));
<red>Value of 'null' is not valid for 'stream'
|
|
|
|
|
Hi,
there is probably something wrong with your resource name.
you can try something like this to see all the resources and their correct name:
string[] sa=assembly.GetManifestResourceNames();
foreach (string s in sa) Console.WriteLine(s);
|
|
|
|
|
I have been searching like mad to try and find a way to use this namespace, but have been coming up empty handed. So far, I have found plenty (through google and msdn) to say that it DOES exist, but nothing showing me how to use it. adding using System.Diagnostics.Design does me no good, and trying to add it as a reference got me no where (it simply doesnt appear to exist on my pc).
i have both the 1.1 and 2.0 frameworks installed and I am using vs 2005. Does anyone have any idea how to get to this namespace?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
What is in the namespace that you want to use?
|
|
|
|
|
I ProcessDesigner , ProcessModuleDesigner and ProcessThreadDesigner.
Part is pure curiousity, part is i may be able to use this to finish a project i am wrking on. IF i cant use it, oh well, but knowing another part of the framework never hurts.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
The documentation says "This class supports the .NET Framework infrastructure and is not intended to be used directly from your code." for ProcessModuleDesigner[^] and ProcessThreadDesigner[^]. I didn't find anything on IProcessDesigner .
These classes are just the glue between existing .NET components and Visual Studio. I don't think (especially going on what the documentation says) that you are supposed to use these classes yourself.
It might be worth examining them in something like Lutz Roeder's Reflector[^] to see how they work and use that as a basis of creating your own classes, if you need to interact with the designer.
|
|
|
|
|
Great! I'm a little disappointed that i cant actually use it, but you have saved me days of banging my head against the wall.
I dont suppose you know how to access another program with a c# app? I have been playing around in the System.Diagnostics.Process area, but with no useful results so far. What I need to do is be able to actually observe what a particular program is doing. For instance, look at an open browser to see contents of a page, or to look at an open instance of Notepad and read the text, things like that.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
have you included the system.design dll in your project references list?
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
I have this code (it’s for picture resize):
<br />
public static void Resize(int newWidth, int newHeight, Bitmap Source, ref Bitmap Recipient)<br />
{<br />
IntPtr ptr = Source.GetHbitmap();<br />
System.Drawing.Image g = System.Drawing.Image.FromHbitmap(ptr);<br />
<br />
Size thumbSize = new Size(newWidth, newHeight);<br />
Bitmap imgOutput = new Bitmap(thumbSize.Width, thumbSize.Height);<br />
imgOutput.MakeTransparent();<br />
imgOutput.MakeTransparent(Color.Black);<br />
<br />
Graphics newGraphics = Graphics.FromImage(imgOutput);<br />
newGraphics.Clear(Color.FromArgb(0, 255, 255, 255));
newGraphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;<br />
newGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;<br />
newGraphics.DrawImage(g, 0, 0, thumbSize.Width, thumbSize.Height);<br />
newGraphics.Flush();<br />
<br />
newGraphics.Dispose();<br />
g.Dispose();<br />
ptr = new IntPtr();<br />
Recipient = new Bitmap(imgOutput);<br />
imgOutput.Dispose(); <br />
<br />
}
And I want to run it in the loop for some pictures. But when I try to do this, a lot of memory becomes busy (some times OutOfMemory error rises). When the loop ends memory is steel busy.
Seem like I have a memory leak. But I can’t understand what is wrong in my code?
Sorry for language -)
-- modified at 12:08 Monday 9th April, 2007
|
|
|
|
|
1. If there any exceptions in the lines between creation of Bitmap, Graphics objects and their disposal, you'll leak memory. The right way to write the code is to either use try/finally or use the using statement. Like
using (Bitmap imgOutput = new Bitmap(...))
{
}
or
Bitmap imgOutput = null;
try
{
imgOutput = new Bitmap(...)
}
finally
{
if (imgOutput != null) imgOutput.Dispose();
}
2. I can't see any memory leaks if there are no exceptions. However, I'm suspicious about the Source bitmap. Who allocates memory for that bitmap? If you create bitmap objects by supplying an IntPtr, you are responsible for cleaning up the memory pointed to by IntPtr, the bitmap object's Dispose only clears off it's internal memory.
I'd suggest using a memory profiler like CLRProfiler[^] to find out where the leak is. All you have to do is run the application under the profiler and it will show you a neat diagram with all the managed objects in the heap and their creation call stacks.
|
|
|
|
|
1. there are no exceptions in this program
2.
>"However, I'm suspicious about the Source bitmap. Who allocates memory for that bitmap?"
All ok. If you noticed, the last line in this method is a simlpe driver for testing: so, when i comment all lines except the last one, the method becomes wery simple to test. In such case no leak appears.
> "If you create bitmap objects by supplying an IntPtr, you are responsible for cleaning up the memory pointed to by IntPtr, the bitmap object's Dispose only clears off it's internal memory."
Hm.. I understand that i have to do something with IntPtr (and i decide to renew it). But how can i "cleaning up the memory pointed to by IntPtr"?
About profiler. At my computer it run wery slow and there are a lot of different data. I can't understand anything now
|
|
|
|
|
lak-b wrote: Hm.. I understand that i have to do something with IntPtr (and i decide to renew it). But how can i "cleaning up the memory pointed to by IntPtr"?
Simply calling new IntPtr() doesn't clear off the memory, you need to find out how memory was allocated for the pointer (like using Marshal.AllocHGlobal) and use the corresponding free function to free up the memory.
lak-b wrote: About profiler. At my computer it run wery slow and there are a lot of different data.
Yes, your app will run slower in the profiler. The word document that comes with the profiler can help you figure out what the data means. The first diagram that comes up shows the objects allocated so far and the method stack which led to their allocation. However, it only shows managed objects, so if you're leaking unmanaged memory (for e.g. by calling AllocXXX but not calling FreeXXX), CLR Profiler won't help.
To quickly find out whether you're leaking managed or unmanaged memory, fire up perfmon (Type perfmon.msc at the command prompt), right click on the graph, click Add Counters, select ".NET CLR Memory" from the Performance Object combobox, select your process in the list box in the right and select "#Bytes in all Heaps" in the listbox on the right. Hit Add, Close. Repeat the operation that leads to the memory leak and check if the "#Bytes in all Heaps" counter's value keeps increasing proportionately. If it does, you have a managed memory leak, otherwise, you are leaking unmanaged memory.
|
|
|
|
|
Hi,
I am building a class library for a reporting application. The following is the scenario and would like to know what type of pattern is appropriate for this kind of implementation:
To give a little bit of context, we are trying to determine the current status of various metric of a project. The status would be red, green or yellow based on the output value in an Metric. You can think of metrics are like Performance%, Security%, number of Bugs etc.
I have a class called as MetricReport which would produce one output number. This number would be compared to various targets to track the progress of the metric in question to produce status colors like Red, Yellow or Green.
Some scenarios of comparisons are:
1. MetricReport output number would be compared to Target values. The target values would be two numbers. Let’s assume that the target values for Performance Percentage are 90% and 70%. So, if the MetricReport value number is 80% then the metric is considered to be on Yellow status. If it is 95%, then considered as green. If it less 70% then it is considered as Red.
2. Baseline Scenario – Here MetricReport output number is compared to another report - BaseLineReport. Threshold values(which again is 2 numbers) are then applied on the BaseLineReport. So for example if Baseline Report produces a value of 70% as the Perf %, then threshold values of +5%(upper threshold) and 10%(lower threshold) are applied. Now, if our MetricReport produces a value greater than 70% + 5%(BaselineReport output plus the upperThreshold) then the metric turns green. If the MetricReport output value is lesser than 70% - 10%(BaselineReport output minus the lowerThreshold), then the metric turns red. Any values in between 75% and 60% is yellow.
3. Trend scenario – Here MetricReport output number is compared to a Trend. A Trend is something where you setup the start value, end value, start date and end date. The slope of the line is determined based on the start value and end value and the number of days between start date and end date. Threshold values(which again is 2 numbers) are then applied on the Trend. So for example if Trend produces a value of 70% as the Perf % (for a particular day), then threshold values of +5%(upper threshold) and 10%(lower threshold) are applied. Now, if our MetricReport produces a value greater than 70% + 5%(Trend output plus the upperThreshold) then the metric turns green. If the MetricReport output value is lesser than 70% - 10%(Trend output minus the lowerThreshold), then the metric turns red. Any values in between 75% and 60% is yellow.
So, you can summarize the above scenarios like:
MetricOutputValue + TargetValues – determines the color of the Metric
MetricOutputValue + BaselineReport + Threshold – determines the color of the Metric
MetricOutputValue + Trend + Threshold – determines the color of the Metric
The question is how to put this information into classes. I want this to be flexible so that in the future I would be expand it into new scenarios.
Currently I have the following classes:
1. MetricReport – produces one output number as a result
2. SimpleMetric – (supports scenario 1 above) This class takes a MetricReport as a child in the class, accepts TargetValues and does the calculations to determine the color.
3. BaselineMetric - (supports scenario 2 above) This class takes a MetricReport class and BaseLineReport class as children, accepts ThresholdValues and does the calculations to determine the color.
4. TrendMetric - (supports scenario 3 above) This class takes a MetricReport as a child in the class, accepts Trend information and ThresholdValues. With this data it does the calculations to determine the color.
I am thinking that this design is not that expandable, since Threshold is like a wrapper which is applied to classes and needs to be extracted to a separate class. Initially Decorator pattern looked like may suit this scenario. But all the examples I looked up for this pattern does not seem to suit this scenario perfectly. I thought of a scenario where I decorate a MetricReport with BaseLineReport and then decorate again on top with Threshold to support Scenario 2 above. But since the Threshold would need that the component be decorated with a BaseLineReport/Trend before it can be decorated with Threshold. I don’t know how to enforce this with the decorator.
Can you suggest what would be appropriate design for this situation..
Thanks a lot .
|
|
|
|
|
jubilanttiger wrote: I thought of a scenario where I decorate a MetricReport with BaseLineReport and then decorate again on top with Threshold to support Scenario 2 above. But since the Threshold would need that the component be decorated with a BaseLineReport/Trend before it can be decorated with Threshold. I don’t know how to enforce this with the decorator.
I'm not sure I understand to any depth the domain you've described, but my impression is that you have classes that wrap other classes and provide additional information/functionality. It's kind of like those Russian dolls where when you open one to find out what's inside, you find a smaller doll.
So say we have classes A, B, and C. 'A' is just a run of the mill class that represents something. Class 'B' takes an 'A' object in its constructor and "decorates" it with additional functionality. Class 'C' does the same using 'B'. Is this something along the lines of what you're trying to do?
It's the last line, "I don't know how to enforce this with the decorator" that has me a little confused. As long as the type of class you're decorating is specified in the constructor of the decorator class, the decorator/decoratee relationship is enforced.
It may be helpful if you can describe your problem in more abstract terms. With a problem like this, it's easy for someone not familiar with the domain to get confused by the details.
|
|
|
|
|
hi all,
i tried to abort thread but when i make
myThread.Abort();
it give me an exception of aborting thread so what can i do to avoid this exception
another thing is that Suspend Method is obsolete(help said)
what is the alternative
third and last:
when i declare thread as member data in class it refuses to identify the name of the method i used to initialize
like:
Thread packetsMovingThread = new Thread(new ThreadStart(threadProcedure));
private threadProcedure()
{
my method
}
thanx
Generator
|
|
|
|
|