|
You're not inheriting from a class which defines WndProc.
Sig cops got me...
|
|
|
|
|
Console applications don't normally setup their own Window message pump, so there's no WndProc in the Console class to override.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks very much for your answer.
Is it possible whith consol to detect usb Key insert ?
how replace this code for consol ? :
protected override void WndProc(ref Message m)
{
if (m.Msg == Native.WM_DEVICECHANGE)
{
if (!_loading)
{
LoadItems();
}
}
base.WndProc(ref m);
}
thanks again
Vincent
|
|
|
|
|
Well, you could run a message pump in your console app by calling Application.Run[^]. You could either create a hidden windows form, override the WndProc and pass that instance to Application.Run, or you could create a message filter, add it using Application.AddMessageFilter[^] and then simply call Application.Run .
|
|
|
|
|
thanks,
I am sorry I dont understant all.
In my consol programm how link application and event.
this is a part of my code, but dont work ?
An idea ?
thanks
namespace SYS_SERVEUR
{
class RemoteMain
{
[STAThread]
static void Main(string[] args)
{
lines of code ....
// here my new code to detect device change ?!?
TestMessageFilter mytest = new TestMessageFilter();
Application.AddMessageFilter(mytest);
Application.Run();
}
}
//here the event that I would like dtect ???
public class TestMessageFilter : IMessageFilter
{
protected const UInt32 WM_DEVICECHANGE = 0x0219;
public bool PreFilterMessage(ref Message m)
{
// Blocks all the messages relating to the left mouse button.
if (m.Msg == WM_DEVICECHANGE)
{
//Console.WriteLine("Processing the messages : " + m.Msg);
Console.WriteLine("TOTO");
return true;
}
return false;
}
}
}
|
|
|
|
|
Can i demo above program?
|
|
|
|
|
hi..
I am using .net ver 1.1(VS 2003),i need to call a web method asynchrously can any body provide some help...
pls provide some link which i can follow
|
|
|
|
|
This article on Asynchronous Method Invocation[^] may help you.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I want to set a string variable and use that to call a method.
E.g: Instead of calling Example.Test1, Example.Test2 etc, I want to just say call Example.Varable, and depending on what the user has selected from the form, it calls that method.
Any ideas how i would do this?, as i dont want to use lots of different if/case conditions as there is ALOT of different methods i want to set which the user will enter.
Regards,
Gareth.
|
|
|
|
|
Hi,
Reflection is the answer. There are many articles about it on CP. This one[^] should be sufficient for you. The InvokeMember section should be what you are searching for.
Robert
|
|
|
|
|
Your a star Robert!
Regards,
Gareth.
|
|
|
|
|
The problem:
///////////////////////
Hi everyone.
I have to develop an MDI app and in the main window I want to put a sizable panel on the left (like Solution Explorer in VS).
So I created a SplitContainer (in which there is an other splitContainer) and set it vertical and "Dock = Left".
My problem is that while internal panels are sizable, the container itself isn't sizable (so it has the right border fixed) and it stands fixed in a portion of my main window.
How can i make the splitcontainer sizable? otherwise: is there a workaround (such as other controls instead of splitContainer)?
thanks!
///////////////////////
First suggestion - by salysle:
///////////////////////
Use two split container controls; drop one on the form and set its dock property to fill, then drop another one in the left hand panel of the first split container and set its dock property to fill also but set its orientation property to horizontal. The main container and the subordinate container will adjust to fill the window during use and in response to resizing the form. You can still adjust the size of the panels by moving the splitter bars up and down or left and right.
///////////////////////
Other suggestions?
///////////////////////
Hi, thanks for replying me.
I've already tried this way, but using 2 splitContainers and setting one with Dock = Fill, opening a child window of the MDI container this is not visible because it appears (hide) under the container.
the problem is that my application should have a left panel as described before, but the rest of the main window shoud not be tabbed (as VS), but free for child windows.
any other suggestions?
///////////////////////
|
|
|
|
|
If you want docking windows then google "docking windows +c#", there's an open source implementation used in #Develop which you could also use.
Sig cops got me...
|
|
|
|
|
thanks ed.poore
but i want to do something easy by myself.
any suggestions?
|
|
|
|
|
How about just using a panel as the container for your "docking" window and then add a splitter to the form. That way the rest of the form is available for the MDI windows.
Sig cops got me...
|
|
|
|
|
Great idea!!
in this days i will try!
thanks a lot!
|
|
|
|
|
hi,
suppose i have two forms. form1 and form2.
form1 have 5 text boxes with data and 1 button.
i want, when i click the button i get those data in the form 2 using Delegate.
xyz.
xzv
|
|
|
|
|
Explain?
Sig cops got me...
|
|
|
|
|
i can't get u..... i want the code. plz explain that.
xzv
|
|
|
|
|
onlybabla wrote: i can't get u
You didn't explain why you want to use a delegate very clearly (well that's being polite, unlike someone, you didn't actually explain at all).
onlybabla wrote: i want the code
Obviously. You might as well ask nicely for it, or be willing to pay for it.
onlybabla wrote: plz explain that.
You've been set a task / created a task yourself and you would like some code to accomplish a particular function, that is why you want the code. As you why you're being rude I cannot explain that.
Sig cops got me...
|
|
|
|
|
Why would you need a delegate? Why not simply call form2 with a query string, or use session variables?
|
|
|
|
|
i can't call session variables because i am telling about Windows applications. not web.
xzv
|
|
|
|
|
Why not just create a public method in form2 that will return the values you need? You can then create a delegate on your main form (or even an anonymous delegate).
|
|
|
|
|
Hi
I am developing Windows Mobile Application using VS2005.
I am requesting File Details(XML output) from server, but the response is very slow.
FileDetails Consist of File info and its Chunks Info.
Can anybody suggests improvements in the below code to speedup the server response.
public static void httpRequest(string uri, bool isGetMethod)
{
try
{
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create(uri);
Console.WriteLine(uri);
// We use POST ( we can also use GET )
if (isGetMethod)
myRequest.Method = "GET";
else
{
myRequest.Method = "POST";
// Set the content type to a FORM
myRequest.ContentType = "application/x-www-form-urlencoded";
Stream newStream = myRequest.GetRequestStream();
newStream.Close();
}
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myRequest.GetResponse();
// Display the contents of the page to the console.
Stream streamResponse = myHttpWebResponse.GetResponseStream();
// Get stream object
StreamReader streamRead = new StreamReader(streamResponse);
Char[] readBuffer = new Char[256];
// Read from buffer
int count = streamRead.Read(readBuffer, 0, 256);
while (count > 0)
{
//get string
string resultData = new String(readBuffer, 0, count);
HTTPClass.resultData = resultData;
// Write the data
Console.WriteLine(resultData);
// Read from buffer
count = streamRead.Read(readBuffer, 0, 256);
}
// Release the response object resources.
streamRead.Close();
streamResponse.Close();
//Close response
myHttpWebResponse.Close();
}
|
|
|
|
|
Hello,
Fews days that I try to resolve difficult code.
I nead really your help.
A windows service launch a server programm.
When the server detect an usb key whit bad number, the key is eject by CM_Request_Device_Eject
automaticaly. ( this is that I would like !)
sad reality :
If I run directly the server (whitout windows service, server launch by user ), when the user insert bad usb key, the server eject automaticaly the key. All is ok
If windows service launch server, the server cannot remote CM_Request_Device_Eject !!!
I dont know why, certainly securtity, How to give the right of the user to the server ??
Thanks
Vincent
|
|
|
|