|
yes , and it also says:
.S.Rod. wrote:
one font of each available type family.
its working now... it was my textmetric struct that was incorrect...
|
|
|
|
|
I am currently working on an application that recieves an undefinite size of byte array from any source. I used the BeginRecievedFrom method of the socket class and used a size of 256 bytes for the buffer. At first there was no problem because all the data being recieved was less than 256 bytes, until I tried to recieved more. An error was thrown by at the EndRecieveFrom statement; it says SocketExceptionError: More data is Available. Is there a way to know if there is still data left? So that I could recieved the Bulk in small chunks of 256 bytes each?
Thnaks for any help...
|
|
|
|
|
Use BeginReceive instead of BeginReceiveFrom (it does a WIN32 Winsocks2 WSARecv call instead of WSARecvFrom, while WSARecvFrom should be used a connectionless socket only).
|
|
|
|
|
But you need to specify the address of the remote host in a call to BeginRecieive as oppose to the other.
I am required to use UDP and should recieve data from any computer without knowing their addresses in advance. My real problem is how to get all the data using a constant buffer size. For example, if a data of size 500 bytes is sent to me and I have a 256 byte buffer size then I need to recieved the data 1 chunk at a time. I'd look at the samples in MSDN and saw a possible solution but it did not work for me.
|
|
|
|
|
I need code/function that retrieve all the computers IP in the local domain/workgroup.
|
|
|
|
|
Does it have to be .NET? This is really easy using the Net API. You could P/Invoke all this, but there's a lot of structs and functions involved, as well as a lot of constants you'd have to dig through countless headers to find. Just another example where it's good to use the right tool for the right job.
In any case, start by checking MSDN or the Platform SDK for this method: NetServerEnum using SV_TYPE_ALL (or a combination of other flags depending on your requirements).
Hope that helps.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
It is not .NET i use the visual studio 6
|
|
|
|
|
Okay, this is the C# forum (a .NET-only language). Visual C++ is a better forum. My suggestion still applies, however. Start with the method I mentioned.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Try This CP Article[^].
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
hi,all
I am a newby to c#, there are two questions puzzled me:
1. supposing there are many windows on desktop, and I make a mouse click, is there a rapid way let me know which window is clicked(actived)?
2. how to activate a window by code?
thanks a lot
|
|
|
|
|
The target Form's OnActivated event handler is called.
|
|
|
|
|
I would like to be able to add to the View menu in Visual Studio. I am developing a add-in and want to be able to display my own ToolWindow as needed. I am able to add my menu to the top level menu with the code below, but as stated I want this menu Item added below the View menu. I don't want the menu item displayed until the add-in is loaded. The Wizard generated code shows how to add to the Tools menu, but when I try to do the same with the View menu it does not work (CommandBar commandBar = (CommandBar)commandBars["View"];)
// Add to the View menu
object []contextGUIDS = new object[] { };
Command viewCommand = commands.AddNamedCommand(addInInstance,
"ViewAutoReplace", "Auto Replace View",
"View the Auto Replace Tool Window",
true, 53, ref contextGUIDS,
(int)vsCommandStatus.vsCommandStatusSupported+
(int)vsCommandStatus.vsCommandStatusEnabled);
CommandBar barView = commandBars["MenuBar"];
CommandBarControl barControl =
viewCommand.AddControl(barView, 2);
I have tried commandBars["MenuBar.View"] and ["MenuBar.&View"] with no success.
|
|
|
|
|
Might help[^].
If you are lucky, you are only facing a proper use of MSO, not a VS.NET extension limitation (which I have faced a couple months ago about the claimed-to-be-programmable Resource view window).
|
|
|
|
|
looking for something like a code guidline....
i.e. that a TextBox should have the prefix: txt
TextBox --> txt i.e. txtCustomer
Label --> lbl i.e. lblCustomer
String --> str i.e. strCustomer
bool --> boo i.e. booIsValide
is something like that anywhere available?
gicio
|
|
|
|
|
|
|
I no longer use prefixes for tpyes (str, int, lng, etc...) but I do still prefix controls (txt, cmd, etc...). This helps me see the differences between a control reference and a variable.
The only prefixes I use on vars are scope level. I use m_ for module level vars.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Here is one for the experts. I have searched high and low for a solution, and only found one posting that said:
Sorry, this is a known issue with Owner Drawn Context Menus on Notify Icons. We are examining possible fixes for a future release.
This reply was posted by The Windows Forms Team at Microsoft on 12/12/2002.
I know my ContextMenu works, because it displays properly when I assign the ContextMenu object to the main form. When it is assigned to NotifyIcon's ContextMenu object, a blank menu is drawn.
<br />
<br />
XPMenuItem mnuShow = new XPMenuItem( ... );<br />
XPMenuItem mnuPreferences = new XPMenuItem( ... );<br />
XPMenuItem mnuSeperator = new XPMenuItem("-");<br />
XPMenuItem mnuExit = new XPMenuItem( ... );<br />
<br />
contextMenu.MenuItems.Add(mnuShow);<br />
contextMenu.MenuItems.Add(mnuPreferences);<br />
contextMenu.MenuItems.Add(mnuSeperator);<br />
contextMenu.MenuItems.Add(mnuExit);<br />
<br />
notifyIcon.ContextMenu = contextMenu;
this.ContextMenu = contextMenu;
<br />
Does anyone have any idea how to correct this or if a solution from Microsoft has been released?
Thanks for helping out the newbie,
Ethan
-------------------------------------------
One good thing about repeating your mistakes is that you know when to cringe.
|
|
|
|
|
Here is the code snippet again. Sorry the code font was so small :
<br />
XPMenuItem mnuShow = new XPMenuItem( ... );<br />
XPMenuItem mnuPreferences = new XPMenuItem( ... );<br />
XPMenuItem mnuSeperator = new XPMenuItem("-");<br />
XPMenuItem mnuExit = new XPMenuItem( ... );<br />
<br />
contextMenu.MenuItems.Add(mnuShow);<br />
contextMenu.MenuItems.Add(mnuPreferences);<br />
contextMenu.MenuItems.Add(mnuSeperator);<br />
contextMenu.MenuItems.Add(mnuExit);<br />
<br />
notifyIcon.ContextMenu = contextMenu;
this.ContextMenu = contextMenu;
-------------------------------------------
One good thing about repeating your mistakes is that you know when to cringe.
|
|
|
|
|
The NotifyIcon class has a WndProc method implementation which looks much like any standard WIN32 procedure. Reproduced here :
private void WndProc(ref System.Windows.Forms.Message msg) {
int local0;
local0 = msg.Msg;
if (local0 == 273)
goto i3;
if (local0 != 2048)
goto i4;
local0 = msg.LParam;
switch (local0 - 512) {
case 3:
this.WmMouseDown(msg, 1048576, 2);
return;
break;
case 1:
this.WmMouseDown(msg, 1048576, 1);
return;
break;
case 2:
this.WmMouseUp(msg, 1048576);
return;
break;
case 9:
this.WmMouseDown(msg, 4194304, 2);
return;
break;
case 7:
this.WmMouseDown(msg, 4194304, 1);
return;
break;
case 8:
this.WmMouseUp(msg, 4194304);
return;
break;
case 0:
this.WmMouseMove(msg);
return;
break;
case 6:
this.WmMouseDown(msg, 2097152, 2);
return;
break;
case 4:
this.WmMouseDown(msg, 2097152, 1);
return;
break;
case 5:
if (this.contextMenu != null)
this.ShowContextMenu();
this.WmMouseUp(msg, 2097152);
return;
i3: if (IntPtr.Zero == msg.LParam) {
if (!(Command.DispatchID(
msg.WParam & 65535)))
goto i5;
return;
}
this.window.DefWndProc(msg);
return;
i4: if (msg.Msg == NotifyIcon.WM_TASKBARCREATED)
this.WmTaskbarCreated(msg);
this.window.DefWndProc(msg);
return;
i5: return;
break;
default:
return;
}
}
Anytime it receives the windows message identified by 512+5 (WM_RBUTTONUP), it calls ShowContextMenu(), whose implementation is :
private void ShowContextMenu() {
POINT local0;
if (this.contextMenu != null) {
local0 = new POINT();
UnsafeNativeMethods.GetCursorPos(local0);
UnsafeNativeMethods.SetForegroundWindow(this.window.Handle);
this.contextMenu.OnPopup(EventArgs.Empty);
SafeNativeMethods.TrackPopupMenuEx(this.contextMenu.Handle, 64,
local0.x, local0.y, this.window.Handle, null);
UnsafeNativeMethods.PostMessage(
this.window.Handle, 0, IntPtr.Zero, IntPtr.Zero);
}
}
I guess you've figured out by now that, to attach an owner drawn menu, you just need to override the ShowContextMenu() method implementation.
Good luck!
|
|
|
|
|
in order to split a string into an array of lines, I do the following:
myString.split(new char[] { '\r', '\n'});
The problem is that I end up with empty lines. I would like to know if it is possible to avoid that, not having lines with \r or \n at the end, in one similar call. Also, if the user enters empty lines, i would like to preserve them.
|
|
|
|
|
Regex.Split(myString, Environment.NewLine);
Should do it, I think.
Or, probably more efficiently:
myString.Replace(Environment.NewLine, "\n").Split('\n');
Paul
Pleasently caving in, I come undone - Queens of the Stone Age, No One Knows
|
|
|
|
|
Paul Riley wrote:
myString.Replace(Environment.NewLine, "\n").Split('\n');
worked perfectly. tx
|
|
|
|
|
I'm having real trouble creating a Render Context from a C# user-control or a Graphics object. It should be just as easy as filling in a pixel format descriptor, choosing a simliar format, and setting it. However, although the pixel format gets chosen and set fine, when I call wglCreateContext it always fails, with the Invalid Pixel Format error.
Can anyone help??
Dave Kerr
focus_business@hotmail.com
www.focus.programmersnet.com
|
|
|
|
|
Could someone tell me how to get the short filename from a long filename using C#?
Thanks,
Matt
|
|
|
|