|
I'm sure you mean the client area of the MDI-Form. You have to use the Paint Event of the MDI-Form, get the rectangle of the Dark Grey Area and fill it with your Color.
Stefan
|
|
|
|
|
Hi,
does any one know the links to source code about audio or video chatting software developed in c#.
Thanks in advance
|
|
|
|
|
http://www.codeproject.com/useritems/direct_show_-_playa.asp
I hope that useful for you.
Mr Duc Linh Nguyen
|
|
|
|
|
here's the solution:
http://www.banasoft.net/AVPhone.htm
|
|
|
|
|
Is there any method of embedding VC++.NET code in VC#.NET Project and using the different functions declared in VC++ code in VC#.
CHEERS
|
|
|
|
|
Create a .NET assembly using Managed C++, wrapping any unmanged code into a managed class. In the C# project, reference the newly created assembly, and you'll be able to make full use of the MC++ managed classes.
Take a peek at Nick Parker's article[^] to get your started, or look through the list of Managed C++ articles here on CodeProject. There are some good examples there.
Hope that helps.
--Jesse
|
|
|
|
|
Using remoting, when an Image?Bitmap is transfered, it is recieved in "NativeImage" format, from which the Image cannot be got back.
Is there any other method of transfering Image using Remoting.
CHEERS
|
|
|
|
|
Typically, you serialize this to a byte[] array which marshals with no problems. This is also true for XML Web Services.
Another, much faster way (that doesn't require serialization, which will degrade performance) is to use DIME and the Web Service Enhancements (WSE), though you could implement DIME yourself pretty easily since the WSE isn't supported on Windows (only on Windows NT is it supported).
See DIME: Sending Files, Attachments, and SOAP Messages Via Direct Internet Message Encapsulation -- MSDN Magazine, December 2002[^] for a conceptual overview and links to many resources (including the DIME specs), as well as a link to the WSE[^] which already includes these extensions and can be integrated with .NET Remoting and XML Web Services rather easily (especially the latter).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a datagrid and a dataset...and naturally the source of the datagrid is a table in the dataset. When I type a value into one column, I would like to update the value of another column. For instance, if I was keeping track of items purchased in my table, and I enter the Quantity and Price in respective cells, I would like the next cell to calculate this value and show immediately. I have an expression string to do this in my dataset table, but the datagrid doesn't seem to add the row until I have physically scrolled through all of the columns in the row...so the Total cell doesn't get updated until I actually navigate through it and into the next row. Can I put an expression on the column in my datagrid somehow, or manually do the calculation and set the value into the correct cell? Thanks for the help on this.
|
|
|
|
|
Do you mean DataTable.DisplayExpression and DataColumn.Expression property?
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
Following is the VC++.NET code for the Hook Procedure passed as a parameter for the "SetWindowsHookEx" API call. This code was downloaded from http://msdn.microsoft.com/msdnmag/issues/02/09/CQA/default.aspx
Can some one give the equivalent code for the following in C#. I tried a lot to do so but all in vain.
LRESULT CALLBACK MyTaskKeyHookLL(int nCode, WPARAM wp, LPARAM lp)
{
KBDLLHOOKSTRUCT *pkh = (KBDLLHOOKSTRUCT *) lp;
if (nCode==HC_ACTION)
{
BOOL bCtrlKeyDown = GetAsyncKeyState(VK_CONTROL)>>((sizeof(SHORT) * 8) - 1);
if ((pkh->vkCode==VK_ESCAPE && bCtrlKeyDown) ||
(pkh->vkCode==VK_TAB && pkh->flags & LLKHF_ALTDOWN) ||
(pkh->vkCode==VK_ESCAPE && pkh->flags & LLKHF_ALTDOWN) ||
(pkh->vkCode==VK_LWIN || pkh->vkCode==VK_RWIN))
{
if (g_bBeep && (wp==WM_SYSKEYDOWN||wp==WM_KEYDOWN))
MessageBeep(0);
return 1;
}
}
return CallNextHookEx(g_hHookKbdLL, nCode, wp, lp);
}
Even a sample project which blocks all Task Keys that is Alt+Tab, Ctrl+Esc, Alt+Esc etc..
CHEERS
|
|
|
|
|
You need to P/Invoke the necessary native APIs, such as SetWindowsHookEx . There are several articles on this on CodeProject, including Using Hooks from C#[^]. The implementation is pretty much the same, although you'll need to find the values for the various consts which are defined in winuser.h in the Platform SDK. Just define these as const int in your code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have gone through all the articles in CodeProject reagrding hooks. I have understood quite something regarding hooks. The problems i have are:
1) What should the Delegate function should return so as to Block the keypress or not.
2) As given above, in VC++, the author has defined a structure called KBDLLHOOKSTRUCT which he is using to find which key was pressed by type casting LPARAM to this structure. I am not able to do that and hence forth not able to find which keys were pressed.
CHEERS
|
|
|
|
|
You don't need to cast it from the LPARAM parameter. Just include ref KBDLLHOOKSTRUCT paramName as the parameter, which automatically marshals the struct correctly. You can find more information about P/Invoke by reading Consuming Unmanaged DLL Functions[^] in the .NET Framework SDK. If you read the C# article and look at the sample source, the author would've implemented everything you need to know. See the Platform SDK for return values and other information in the documentation for the SetWindowsHookEx API and related documentation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I got a question:
Q: You use Visual Studio.net to create a windows form named Form1, you add a custom control named BarGraph, which displays numerical data. You create a second custom control named DataBar. Each instance of DataBar represent one data value in BarGraph.
BarGraph retrieves its data from a Microsoft SQL Server database. for each data value that it retrieves a new instance of DataBar is added to BarGraph. BarGrahp also includes a Label control named DataBarCount, which displays the number of DataBar controls currently contained by BarGraph.
You must add code to one of yor custome controls to ensure that DataBarCount is always updated with the correct value.
What are two possible ways to achieve this goal?(Each correct answer presents a complete solutins.Choose two).
And I got the so-called two correct answers:
A1:Add the following code segment to the ControlAdded event handler for BarGraph:
DataBarCount.Text=this.Controls.Count;
A2:Add the following code segment to the constructor for DataBar:
this.Parent.DataBarCount.Text=this.Controls.Count;
I don't understant why?
who can explain why they are right????
|
|
|
|
|
The only difference between the two really is from where they are called and what you're setting them on. The second code fragment won't work, however, since Parent returns a Control , which won't have a reference to the DataBarCount . You would nee dot cast it to the class you defined and then set the DataBarCount.Text .
The other thing you might consider is a property binding. Bind the DataBarCount.Text property to Controls.Count property like so:
DataBarCount.DataBindings.Add("Text", Controls, "Count"); Something like that should work and would keep everything up to date. You also only need to set this once, then. From where depends on your implementation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how to prohibit user enter the key char on key board except num key.
thanks
Mr Duc Linh Nguyen
|
|
|
|
|
Depends on what you want to do this. If you want to provide a numeric-only TextBox or something similar, extend the class and override IsInputKey (or a number of other methods that would do the same thing in effect):
public class NumericTextBox : TextBox
{
protected override bool IsInputKey(Keys keyData)
{
return ((keyData >= Keys.NumPad0 && keyData <= Keys.NumPad9) ||
(keyData >= Keys.D0 && keyData <= Keys.D9));
}
} Read the class member documentation for the TextBox for more information and other methods you can override if this isn't (for some odd reason) sufficient.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
When Windows shut down, my application running couldn't shut down. My application is the style staying on the
system tray.
So I tried to get Windows shut down event in my application, but I couldn't.
I don't know how to get it. If there are other ways,
please tell me.
regards,
yu-yu
|
|
|
|
|
Add an IMessageFilter implementation (such as on your main application form) and add that instance using Application.AddMessageFilter , or simply override WndProc in your main application form and watch for the WM_QUERYENDSESSION (0x0011) or WM_ENDSESSION (0x0016) depending on whether or not you want to cancel the Windows shutdown. In your handler, simply call Application.Exit or Environment.Exit (warning: the latter will unload the CLR - which unloads your application - without calling any further code for a clean shutdown).
The problem with the application not shutting down, however, is usually when an exception is thrown from the UI thread that goes uncaught while forms are loading, so that the message pump (the loop that translates and dispatches messages to the appropriate windows/controls (which are windows, technically)). Be sure to use effective exception handling in your application.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Mr.Stewart
Thank you for your advices.
So I used WndProc(), and I have another questions.
I don't know how to recognize whether action is shutdown or not(reboot).
I checked member variable (Msg and LParam and WParam) Message class,
so I understood logoff pattern.
But I could not recognize the difference of shutdown and reboot.
If I understand, I could set value in ExitWindowsEx().
regards,
yu-yu
|
|
|
|
|
Mr.Stewart
I'm sorry,
I resolve it.
thank you,
yu-yu
|
|
|
|
|
just a quick one i'm having a little difficulty with alt+f4 closing indevidual forms and not the entire app. so can i disable alt+f4 or redirect it to the correct actions?
|
|
|
|
|
Alt+F4 is a key sequence reserved by Windows for closing applications. Without using a system hook, I doubt very highly that you can override the default behavior.
IIRC, Alt+F4 will only close windows if they are owned by your main application window instead of the application itself. For more information on this, see the documentation for the Form.AddOwnedForm method and Form.Owner property in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
HI Michael,
1.
You can disable the Alt + F4 action by overriding WndProc.
Below is the code for the same.
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if(m.Msg != 0x0010)
{
base.WndProc(ref m);
}
else
{
}
}
2.
Below solution refers to how to disable only X button on the Windows form
In the using section type the following....
using System.Runtime.InteropServices;
declare the following functions and constants...
private const int MF_BYPOSITION = 0x400;
private const int MF_REMOVE = 0x1000;
private const int MF_DISABLED = 0x2;
[DllImport("user32.Dll")]
public static extern IntPtr RemoveMenu(int hMenu, int nPosition,long wFlags);
[DllImport("User32.Dll")]
public static extern IntPtr GetSystemMenu(int hWnd, bool bRevert);
[DllImport("User32.Dll")]
public static extern IntPtr GetMenuItemCount(int hMenu);
[DllImport("User32.Dll")]
public static extern IntPtr DrawMenuBar(int hwnd);
Write a method as mentioned below..
public void DisableCloseButton(int hWnd)
{
IntPtr hMenu;
IntPtr menuItemCount;
hMenu = GetSystemMenu(hWnd, false);
menuItemCount = GetMenuItemCount(hMenu.ToInt32());
RemoveMenu(hMenu.ToInt32(), menuItemCount.ToInt32() - 1,MF_DISABLED | MF_BYPOSITION);
RemoveMenu(hMenu.ToInt32(), menuItemCount.ToInt32() - 2,MF_DISABLED | MF_BYPOSITION);
DrawMenuBar(hWnd);
}
call the above method in the Form load event handler as follows
DisableCloseButton(this.Handle.ToInt32());
For further query do revert back.
Regards,
Jay
|
|
|
|