|
a WinForm as cool as windows media player and real player using C#?
like their button,like their skin?
thanks!
|
|
|
|
|
how can i make y orientation to up in c# coordinate system ,such as in vc++ ,use SetMapMode(MM_HIMETRIC) functon .
|
|
|
|
|
I have developed an installer for an application that utilizes the cygwin gcc compiler. I have to bundle the gcc together with the application. I have copied the structure of the cygwin gcc directories as it is. There a few shortcuts in the gcc directory structure that point to some directories and files residing inside the gcc directory structure. I also corrected the shorcut targets using orca after making the release msi. The problem is that the compiler doesn't seem to find the files and directories reffered by the shortcuts. If i replace the gcc folder created by the installer with the original gcc directory all works well.
I have made sure that the directory structure is copied as is and double checked it as well.
Kindly help me out of this problem.
|
|
|
|
|
I am trying to figure out the best way to convert a HTML page to an image. I need to be able to do this without actually displaying the URL in the browser and need to capture the entire horizontal and vertical size.
I have see some commercial products that appear to be using the IE control to perform this functionality but I cannot find anything on the web that discusses how this is done.
Does anyone have any ideas about how this can be accomplished?
|
|
|
|
|
Take a screen shot.
/\ |_ E X E GG
|
|
|
|
|
Unfortunately, it is not that simple. I need to be able to capture the entire rendered page regardless of the size - not just what is displayed in a browser window. Additionally, I want to do this entirely in code with no UI. I believe most of the ActiveX controls and other utilities out there are using a hidden IE control but I have not been able to get past the "visible" window problem.
|
|
|
|
|
This has been really puzzling me.
I have a windows services, written in c#.
What I'm trying to do now is to force single-threaded apartment.
So here's how my code look like:-
//Main Entry for Process
static void Main()
{
Thread.CurrentThread.ApartmentState = System.Threading.ApartmentState.STA;
}
When services starts, it will call this:-
protected override void OnStart(string[] args)
{
if (Thread.CurrentThread.ApartmentState == System.Threading.ApartmentState.STA)
{
EventLog.WriteEntry("SvcTest","Single Thread Apartment");
}
else
{
EventLog.WriteEntry("SvcTest",Thread.CurrentThread.ApartmentState.ToString());
}
To my surprise, it's still showing the CurrentTread.ApartmentState as "MTA" (Multi-Threaded Apartment).
Can someone explain this.. .
Stanley
|
|
|
|
|
jbx1828 wrote:
static void Main()
{
Thread.CurrentThread.ApartmentState = System.Threading.ApartmentState.STA;
}
Try changing it to this:
[STAThread]
public static void Main()
{
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
Any help is greatly appreciated.
I've made a few changes.
<br />
[STAThread]<br />
static void Main()<br />
{<br />
Thread t = new Thread(new ThreadStart(WorkerThread));<br />
t.ApartmentState = ApartmentState.STA;<br />
t.Start();<br />
}<br />
<br />
static void WorkerThread()<br />
{<br />
ServiceBase.Run(new System.ServiceProcess.ServiceBase[] { new TestSvc() });<br />
}<br />
and in the onStart Method, when window services starts, it stills show
thread as MTA. I am just LOST... Unless, there is something I'm missing here.
Stanley
|
|
|
|
|
I am new to C# and I am having some problem understanding arrays. I am getting the following exception:
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
The problem seems to be (string)ie.Current. I do not understand why I cannot retrieve the value. Any ideas would be appreciated.
<br />
using System;<br />
using System.Collections;<br />
<br />
namespace ConsoleApplication2 <br />
{<br />
<br />
class Class1 <br />
{<br />
<br />
[STAThread]<br />
static void Main(string[] args) <br />
{<br />
Hashtable region = new Hashtable();<br />
IDictionaryEnumerator ide;
ArrayList al;<br />
IEnumerator ie;
string indicator = ""; <br />
<br />
do <br />
{<br />
Console.Write("Enter region name: "); <br />
region.Add(Console.ReadLine(), new ArrayList()); <br />
<br />
Console.Write("Enter another region? (y/n): ");<br />
indicator = Console.ReadLine();<br />
<br />
} while(indicator.ToUpper() == "Y");<br />
<br />
ide = region.GetEnumerator();<br />
while (ide.MoveNext()) <br />
{<br />
al = (ArrayList)ide.Value;<br />
al.Add("foo");<br />
}<br />
<br />
ide = region.GetEnumerator();<br />
while (ide.MoveNext()) <br />
{<br />
al = (ArrayList)ide.Value;<br />
ie = al.GetEnumerator();<br />
while (ie.MoveNext()) <br />
{<br />
Console.WriteLine("hash key: {1} array value: {2}",(string)ide.Key, (string)ie.Current);<br />
} <br />
<br />
Console.WriteLine(ide.Key);<br />
Console.WriteLine(ide.Current);<br />
}<br />
<br />
Console.ReadLine();<br />
}<br />
}<br />
<br />
<br />
}<br />
|
|
|
|
|
Have you made sure that ie.Current is a string ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Yes, actually I cast it just in case:
(string)ie.Current
|
|
|
|
|
I can see that you cast it, and I'm sure there is a magical world in which this will always work. Have you stepped through to make sure that it is a valid target for this cast, and checked what the value is when it fails ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
When I step into the program I see that ie.Current is equal to "foo" as expected. However, before it prints the line it throws an exception and highlights ie.MoveNext(). But, if I remover {2} from the string it operates as expected.
Like I said I'm new to C# so please bare with me as I may be missing something simple.
Thanks
|
|
|
|
|
Got it. The format string is zero indexed - you are asking for values 1 and 2, but the values you provide are numbers 0 and 1, hence the error on array indexing.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
This may be a stupid question but based on my code sample, how would I go about fixing the problem? I've been pulling my hair on this one for quite some time.
Thanks -- I owe you a beer for this one!
|
|
|
|
|
*grin* I remember when I was starting, asking questions that seemed impossible to me, and feeling dumb when I found out the answer. I recommend the book 'Inside C#' by Tom Archer. Make sure you get the second edition.
Replace the 1 with a 0, and the 2 with a 1. That way you're asking for the first two items specified, rather than the second and third ( currently non-existent ) item.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Oh my gosh -- I should have known that. I must have had one of those retarded moments.
Thank you once again!!!
|
|
|
|
|
Hello,
I want to use GPS in my Smart Device Application. Can anybody here give me any information about it? - It is difficult to implement? Is there any literature, code samples, etc. available?
thanks in advance.
regards
mat
|
|
|
|
|
Yes, and a search on google[^] would turn up lots of articles.
There's even several good ones here on CodeProject[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi! I'm quite new to c#, and i am currently learning a lot about interfaces and c#. Seriously, i never asked before for a problem, but THIS one drives me crazy!
Ok, first i'm using .Net Frameworks 2.0 with VC# Express Beta, on a XPSP2 system. The problem started when i tried to add custom icons for my forms. Every icons that I've added are handled in a xml file called resources.resx. I've removed some icons from this file whithin the editor and any declarations related to them and since, i got this exception every times i start the program:
ArgumentException was unhandled
ResourceManager base name should not end in '.resources'. It should be similar to 'MyResources', which the ResourceManager can convert into <base />.<culture>.resources, for example, 'MyResources.en-US.resources'.
Thats it. I've searched for hours on this problem and i wasn't able to find something about. In english, what does this exception means? Does my ResourceManager try to call an inexistant object?
Thanks if you can help me!
|
|
|
|
|
First of all, keep in mind that "Whidbey" is still in beta. Second, there is no reason that the ResourceManager should ever look for MyResources.en-US.resources if "en-US" is your neutral language (i.e., the language in which your application was written). You use the NeutralResourcesLanguageAttribute to specify the neutral language - an assembly attribute (prefix with "assembly:") - which avoids 4 or more look-ups for satellite assemblies.
Even without that attribute, the neutral language is simply "MyResources.resources" (for example).
To learn more about resources and the ResourceManager , read Resources in Applications[^] in the .NET Framework SDK.
If you're specifying a resource, you do not include the ".resources". You would only specify "MyResources". The ResourceManager and its derivatives like ComponentResourceManager take care of getting an object for the thread's UI culture (Thread.CurrentUICulture ), or another CultureInfo that you could specify. If you specified MyResources.resources or MyResources.en-US.resources, then the ResourceManager wouldn't play much role.
You only specify a Type or resource name without any localization information in it (like MyResources). The topics I linked above will explain more.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
problem: i have a web browser embedded in my form. the pages i am creating visually complicated enough that i don't want to do it by hand, so i'm going to make the pages in front page. the issue is getting that front page generated html back to my C# web app as a properly formed string. instead of having to manually do things like replace all the "s with \"s, i'm trying to embed the html page as a resource, and extract it at run time. will this solve all my formatting issues? how do i extract it at runtime? if i add the html page to my project, change build action to "Embedded resource", i thought i coudl do a resources.GetObject and pass it the name of the file, but i keep getting back null.
and please let me know if you know a better way to get html generated code from front page into C# as a properly formatted string. thanks!
|
|
|
|
|
ResourceManager.GetObject would not work. A ResourceManager is created for a specific .resources embedded resource.
If you change a build action for a file to "Embedded Resource", you use Assembly.GetManifestResourceStream with the full resource name ("namespace" plus file name):
private void ExtractResource(string resource, string destination)
{
using (Stream s = this.GetType().Assembly.GetManifestResourceStream(resource))
{
using (FileStream file = new FileStream(destination, FileMode.Create))
{
int read = 0;
byte[] buffer = new byte[4096];
while ((read = s.Read(buffer, 0, buffer.Length)) > 0)
file.Write(buffer, 0, read);
}
}
} To use this, specify the name of the embedded resource (like "MyProject.MyFile.htm" - however the concatenation of the root namespace (configured in the Project Settings) + sub-folders + filename would look) and the destination path of the file.
For the destination, I would recommend using isolated storage which requires fewer code access security (CAS) permissions than even writing to the TEMP directory (via Path.GetTempFileName or something). See the IsolatedStorage class in the .NET Framework SDK for more information. You wouldn't have to use it, but it would make your application more robust if you planned on deploying it from different security zones (intranet or Iternet, as opposed to just running it from a local machine).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|