|
SendMessage is used to send Windows messages to a specific window, given the handle of a window. When used with HWND_BROADCAST as the window handle, it sends the message to every window in the system. So if Winamp and Media Player are running, they would get the message too.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi to all. I am trying to provide a help file for the project I am developing. I have the test.hlp file but I have no idea how to open this file when the user click on a button. Is there any way to do this?
Thanks in advance.
|
|
|
|
|
|
Hello everyone, I'm back again...
I'm working on some printing dialog with integrated preview. The problem is how to determine corrent font size (height) for the preview.
Of course, the preview image size is measured in pixels, so for the A4 you have e.g 176x140 px large image. When I want to draw something on it with font of user-defined size in px, the preview size must be some N-times smaller. The key problem is how to get the N.
Images are printed correctly, because I can convert its sizes in some useful units, like inches or percents, so they can be drawn with knowledge of document size in hundreths-per-inch units correctly.
But with fonts, I can use only some Font.GetHeight(...) method, which returns (for my printer resolution) value of 186.8591 (inches or what ?) for the 10px font.
|
|
|
|
|
Specify the font size in points instead of pixels. One point is 1/72 of an inch.
---
b { font-weight: normal; }
|
|
|
|
|
You can use the Graphics.MeasureString( ... ) function to get the pixel height of a Font 's output.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hello gurus,
I'd like to know how to generate a GUID in C#? Can somebody show me a code snipet please?
Best regards.
Thanks.
Fred.
There is no spoon.
|
|
|
|
|
Easiest way:
textBox1.Text = Guid.NewGuid().ToString();
|
|
|
|
|
as simple as this
thanks
There is no spoon.
|
|
|
|
|
Damn, C# has everything onboard. Can it also wash my dirty clothes?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes, of course.
Create a WashingDay object using the System.Globalization.Calendar class. Then you add any cloth items to it's Items collection. Remember to associate each item with a WashingType object first, though, or you will end up with pink shirts. When you added all the clothes, subscribe to the OnComplete event and execute the WashingDay.Start method.
---
b { font-weight: normal; }
|
|
|
|
|
|
My C# Express IDE suddenly(?) doesn't let meswithc betweenn debug and release anymore.
Currently it builds the library project as release, and the test env as debug. Weird (but maybe poking aorund I changed it).
"Solution Configuration" is disabled, hunting the menus (or customizing the toolbar) doesn't reveal anything.
I already tried resetting the IDE config, but this didn't help
Any suggestions?
We say "get a life" to each other, disappointed or jokingly. What we forget, though, is that this is possibly the most destructive advice you can give to a geek.
boost your code || Fold With Us! || sighist
|
|
|
|
|
Had the same problem. THe following steps should work.
1. Go to Tools->Options and check the "Show All Settings" at the bottom of the dialog
2. Expand Projects/Solutions, click on General and check the "Show advanced build configurations" checkbox".
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thanks! that worked!
We say "get a life" to each other, disappointed or jokingly. What we forget, though, is that this is possibly the most destructive advice you can give to a geek.
boost your code || Fold With Us! || sighist
|
|
|
|
|
I found (without finding that checkbox mentioned below) that it would build the debug when you try to run it thru the debugger, and it would build the release if you clicked on "build solution" in the build toolbar.
|
|
|
|
|
Hi i made a Modal DIalog Box( showdialog() )
Its on top and everything, but the application who calls it( another enviroment ) steals back the focus, but with my modal dialog box on top still. This annoys me! meaning i cannot just press enter to move along, but need to get focus back to my dialog form, before i press enter.
How can i make sure that it(dialogbox) always have focus over other applications, that nothing takes it away.
is there some windows api i can call or something, i have been looking but with no luck.
Thx in advance
|
|
|
|
|
|
I have tried that, bu the application that called my Dialog window snatched focus back, and was hiding behind my dialog.
But i found a working solution through the User32.dll call.
[DllImport("user32.dll", SetLastError=true)]
static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
SwitchToThisWindow(this.Handle, false);
It activates my window/dialog.
Thx though for the answer
|
|
|
|
|
I am a newbie to delegates and events. I want an event to be raised when a variable has been changed. How exactly do i do that? Can someone show me the code (raising the event, and the handler)
thx thx
|
|
|
|
|
Create a delegate (I normally put it with [not in, delegates go outside the class] the EventArgs derived class):
public delegate void ValueUpdated(object sender, ValueUpdatedEventArgs e);
Then create an EventArgs derived class. Although this is not strictly necessary, it is good practice so that all events have a similar look and feel.:
public class ValueUpdatedEventArgs : System.EventArgs
{
private string newValue;
public ValueUpdatedEventArgs(string newValue)
{
this.newValue = newValue;
}
public string NewValue
{
get
{
return this.newValue;
}
}
} Of course, you can add more information in here if you need it, for example, you may wish to add a field and property for variable name if that is important.
In the class where the event will be raised add this line (I usually put it just after the field definitions):
public event ValueUpdated ValueUpdated; The first ValueUpdated refers to the delegate, the second is the name of the event that will be raised - If you are going to raise several different events, because, for example, you have several different variables changing that you want notified of, you may wish to change the name.
Now, when the value is updated you can call the observers (the objects that are subscribed to the event):
this.myVariable = "My New Value";
ValueUpdatedEventArgs valueArgs =
new ValueUpdatedEventArgs(this.myVariable);
ValueUpdated(this, valueArgs);
Does this help?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
I would add one more comment:
Make myVariable a property - that way you can refactor the call to ValueUpdated() in the property's set() method.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Yes, abosolutely!
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Is there a terribly convincing reason for the Framework rule to declare event delegates as (object sender, EventArgs e) ?
We say "get a life" to each other, disappointed or jokingly. What we forget, though, is that this is possibly the most destructive advice you can give to a geek.
boost your code || Fold With Us! || sighist
|
|
|
|
|
peterchen wrote: Is there a terribly convincing reason for the Framework rule to declare event delegates as (object sender, EventArgs e) ?
I believe that the reason is this:
Most framework controls store their events on an array-like structure when they are used, to decrease their memory size. Since those controls have *lots* of events, and tipically, only a few are actually used by an application, the framework can reduce the memory use by a few KB and even a few MB in a large application by not declaring fields for storing all of them.
Since the events are to be added/removed on an array for *each* event, someone probably needed to code some kind of generic code for dealing with this management.
This probably lead to creating a single delegate to ease things.
Not a pretty solution, but very efficient.
I don't see dead pixels anymore...
Yes, even I am blogging now!
|
|
|
|