|
Jammer wrote: I was going to create a location under CommonApplicationData from inside my app on first launch
That's what I do as well. I suppose it depends on the install scenario.
I require the first run to be elevated, so programatically creating the folders and
giving them specific access rights is no problem.
Jammer wrote: I was also thinking of omitting the app version info in the path
That's cool. That was just the recommendations from MS docs.
I suppose company name (or equivalent) is the most important just to
differentiate your folder from all the other installed software's folders...
under that, I suppose anything goes
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Great stuff! Thanks for this info Mark, much appreciated.
|
|
|
|
|
Hi
I have developed a toolbar which needs to invoke a javascript function based on some criteria on specific web page.
To be simple, I want to know how to invoke javascript from BHO(using C#).
I have done everything already but just this one needs help.
Thanks in anticipation
Mujtaba Panjwani
|
|
|
|
|
We have an ASP.NET forum.
MAP Tiger wrote: I want to know how to invoke javascript from BHO(using C#).
You need to do some reading, you obviously don't know what ASP.NET is, or what it does. Specifically, C# runs on the server, js on the client. To run js code, you need to inject it into the page.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi
Thanks for the reply.
If you could read clearly what I said in my question which clearly states that I am running it from BHO (Browser Helper Object) which of course means that the javascript function is already injected in the code but when that specific page is loaded in the browser then the BHO has to invoke that specific javascript function.
Regards,
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
Hi
I would also like to mention that as I am working with BHO so I have the access to WebBrowser object and Document object. I think the solution has to be within these objects but dont know how...
Regards,
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
Map Tiger,
Did you ever get an answer to this? If so, do you have any code samples?
Thanks,
|
|
|
|
|
Hi
I am working with iTunes library. I am supposed to implement it into a class library.
The problem is that to respond to events associated to iTunesApp I had to disable CheckForIllegalCrossThreadCalls but however in class library, this property isnt supported. Now, I am stuck in between and not able to figure out the solution.
Please help me that how to enable Cross thread operations or how to call the event safely without compromising cross thread restriction.
I would be very thankful for your kind response.
Thanks
MAP Tiger
|
|
|
|
|
When a function is called on a background thread, just post to the synchronization context:
void SomeFunctionOnABackgroundThread()
{
SynchronizationContext.Current.Post(DoSomethingOnCorrectThread, "hello");
}
void DoSomethingOnCorrectThread(object state)
{
Console.WriteLine(state);
}
The above code works for both WPF and WinForms.
|
|
|
|
|
Hi
Thanks for the reply.
I actually needed it in class library which will be basically hosted as a BHO to IE. Moreover, I have solved the problem and mentioning that here so may be useful for any other person.
SongName = "Artist: " + myTrack.Artist + " - Name: " + myTrack.Name;
Thread myThread = new Thread(ChangeText);
myThread.Start();
SongName is defined on class level and ChangeText procedure do the work needed with SongName
Now the other question needs attention which is about invoking javascript function if someone can do help.
Regards,
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
I want to validate an XML file using a pre-made DTD. I am aware that you can do this with either an internal DTD or a DTD linked to from the file, but I would like to use a DTD that isn't either.
I know the location of both the XML File and the DTD. Is there a way to do this, whe the two aren't linked? Or is there another way to validate the XML file?
thanks in advance - and sorry if it is hard to understand
|
|
|
|
|
Here is the code. I hope it works for you.
private Point mousePos;
private Point panelPos;
private bool isDragging;
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
isDragging = true;
Cursor.Current = Cursors.Hand;
mousePos = panel1.PointToScreen(e.Location);
panelPos = panel1.Location;
}
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
if(isDragging)
{
isDragging = false;
Cursor.Current = Cursors.Default;
}
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (!isDragging) return;
Point point = panel1.PointToScreen(e.Location);
panel1.Left = panelPos.X + point.X - mousePos.X;
panel1.Top = panelPos.Y + point.Y - mousePos.Y;
}
|
|
|
|
|
Thanks, but is there a problem or what?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
there is no problem I just wanted to share it with you.
|
|
|
|
|
That's cool. How about you write a quick little beginner article on it. As simple as it is, some folks might find it helpful
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
Ummm, you don't know what?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I don't know that I can write an article,because I'm working on a project for Infomatrix. How about you? I guess you're a Software Developer.
|
|
|
|
|
Furkan93 wrote: How about you?
Could just add it to the never ending list to todo
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
what does this code code ....upload a picture
|
|
|
|
|
Hey guys,
When I was programming a chip in C, the chip had a built in function to check if the COMPort is busy. Is there an equivalent function in C#?
This is my first time doing it in C#, and I am trying to use the serialPort control to send/receive packets of data, but I don't think it's as easy as just reading bytes instantaneously, so I would imagine there needs to be a way to check if the COMPort is busy.
Any ideas would be appreciated.
|
|
|
|
|
Hi,
since .NET 2.0 there is a System.IO.Ports.SerialPort class that offers a lot of functionality.
See_Sharp wrote: a built in function to check if the COMPort is busy
Not sure what you mean by busy.
IIRC the SerialPort(portname) constructor will fail (=throw an exception) if the port does not
exist, or is already in use by another process.
whether data is currently being sent/receives by another process is something you cannot or cannot easily figure out, since you won't be able to create a SerialPort object under those conditions.
whether data is currently being sent/received by your own process is something you can figure out by using the SerialPort properties and events.
I suggest you thoroughly read the SerialPort documentation.
|
|
|
|
|
I've tried unsuccessfully to get the AnimateWindow API to work. As far as I know, my flags are correct, but no matter what I do, the form just pops up on the screen. Can anyone see anything wrong with this code?
using System;
using System.Runtime.InteropServices;
namespace WinAPI
{
public class AnimateWindowAPI
{
public const int AW_HIDE = 0x10000;
public const int AW_ACTIVATE = 0x20000;
public const int AW_SLIDE = 0x40000;
public const int AW_BLEND = 0x80000;
public const int AW_HOR_POSITIVE = 0x00000001;
public const int AW_HOR_NEGATIVE = 0x00000002;
public const int AW_VER_POSITIVE = 0x00000004;
public const int AW_VER_NEGATIVE = 0x00000008;
public const int AW_CENTER = 0x00000010;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int AnimateWindow(IntPtr hWnd, int dwTime, int dwFlags);
}
}
I'm calling the function from within the Shown() event handler, like so:
using WinAPI;
private void Form1_Shown(object sender, EventArgs e)
{
int flags = AnimateWindowAPI.AW_ACTIVATE|AnimateWindowAPI.AW_BLEND;
AnimateWindowAPI.AnimateWindow(this.Handle, 3000, flags);
Show();
}
I also wrote some threaded fader code (that doesn't use the AnimateWindow function) to see if I was calling it from the wrong place, and that code works fine.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
It's too late in the Shown event - move it (minus the Show(); ) to the Load and it works fine.
private void Form1_Load(object sender, EventArgs e)
{
int flags = AnimateWindowAPI.AW_ACTIVATE | AnimateWindowAPI.AW_BLEND;
AnimateWindowAPI.AnimateWindow(this.Handle, 3000, flags);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanks a million. I would have taken a while to get to that thought process.
Now, if you have any insight as to why this doesn't work on child forms with the DockPanel library, I'm all ears.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|