|
Weird.
My Program doesn't get a message when the window is hidden.
|
|
|
|
|
Seems to be a bug in System.Diagnostics.Process that the MainWindowHandle is 0 when the window is hidden. I wonder if the assumption they are making is that if the main window is hidden, it should be treated like a "daemon" or "service" kind of app (and thus it pretends that there is no main window). Anyway, I guess if you are hiding your window, then you could use FindWindow() or EnumWindows() to get the handle instead of System.Diagnostics.Process.GetProcesses() . There are other ways I can think of too...
Matt Gerrans
|
|
|
|
|
> What the hell... now it takes 1-2 seconds longer to start up. And btw. your code crashes. It seems to be that some proccess have a read protected process.MainModule Class. If I wrap around a try-catch it works.
Well, don't worry, there's a full money-back guarantee. Just send one proof-of-purchase and a self addressed, stamped envelope and you'll get refunded the full amount.
If your startup time increased, that's probably because of something else you did. It doesn't take that long to create a mutex. My app starts up in less than a second, so that couldn't be it. Post your profiler logs and I'll believe you.
Anyway, next time, I'll be sure and submit everything to a full QA cycle, running it through an exhaustive matrix of OS (including all service packs and languages, of course), hardware and environment configurations before posting any suggestions.
Did you miss the "you've got the gist of it and can proceed with the fine-tuning as you like" part? If you expect people to fully vet any suggestions, then you might perhaps state how much you are willing to pay for that work.
Matt Gerrans
|
|
|
|
|
I'm sorry if my comments sound to offensive/overacting. I alway speak a little bit to rough, I'll try better next time
|
|
|
|
|
Glad to hear it. And glad to hear (in your other post) that you got it all working smoothly.
Matt Gerrans
|
|
|
|
|
You mentioned that your previous attempt didn't work. Were you using a mutex?
string uniqueid = Application.ExecutablePath.Replace(@"\", @"_");
Mutex m = new Mutex(false, uniqueid);
if (m.WaitOne(1, true))
{
}
else
{
}
|
|
|
|
|
>You mentioned that your previous attempt didn't work. Were you using a mutex?
No, I didn't say that. But indeed I aint using one cause I don't now I which Namespace the Mutex Class is (and yet I was to lazy to serch for that).
|
|
|
|
|
After using Mutexes and also implementing FindFindow if hwnd is zero everything works fine, it's even way faster.
Thanks a lot!
|
|
|
|
|
I want to make a program that wil work with the arrow keys.
Now i got two questions. First of al what is the code of an arrow key in c# and second how can i use it properly.
The Underdog
|
|
|
|
|
Our campany is going toward using ES to develop applications in .Net. Our plan is to use ES to distribute applications across our intranet and have them auto-magically interact. The question I have is how (in ES) do you discover what resources are available throught your organization. In other words, if application A want to provide an service on the network how does application B discover its availability. Also what universal naming menthod is used. All I need is some search phrases that apply so that I can get started.
Chuck Knight
|
|
|
|
|
wow! this is one to add to your favourites if you want to call a win32 function but can't work out the c# signature...
http://pinvoke.net/[^]
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Yep! It's nice isn't it.
By the way there's a VS.net addin that makes life even easier Search for it.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi all,
I am doing my first setup project for the addin I wrote and can't solve following problem.
I want to deploy an addin for Visual studio. So I need to look in registry for the HKLM\SOFTWARE\Microsoft\VisualStudio\7.X\InstallDir (where 7.X is 7.0 or 7.1) and take it into MyPATH0 and MyPATH1 variables. For the installed version(s) I need to make TARGETDIR to MyPATH0\..\..\\Vc7\VCWizards.
I have no idea how to solve this. Setup wizard seems to have very simple logic, so how can I program in the wizard
"
1.TAKE REGISTRY KEY XX\7.0 into VAR
2. If success Make VAR+AAA to the TARGET DIR
3.Install
4.TAKE REGISTRY KEY XX\7.1 into VAR+AAA
5. If success Make VAR to the TARGET DIR
"
Thank you very much for your help,
Boni
|
|
|
|
|
Hi guys, I need help, DatagridTableStyle property AlternatingBackColor alternates ones per row (odd numbers), i need it the alternate every two rows, (ex: Blue, Blue, Red, Red, .....) any idea how to do this?
|
|
|
|
|
Make your own DataGridColumnStyle or just change an existing one:
<br />
public class AlternatingColumnStyle : DataGridTextBoxColumn <br />
{<br />
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)<br />
{ <br />
int i = rowNum % 4;<br />
Color c = Color.Blue;<br />
if (i > 1)<br />
c = Color.Red; <br />
base.Paint(g, bounds, source, rowNum, new SolidBrush(c), foreBrush, alignToRight);<br />
}<br />
}<br />
|
|
|
|
|
is there is any method to return web services values not from the net and web sites only but return it also from win apps on the web or the network or windows application that is connected to the net
ByMindOnlyYouCanDoIt
|
|
|
|
|
Web services run in the IIS process and can only be executed within this process. What you're looking to do is called Remoting but it does not use Web Services.
|
|
|
|
|
Hey
I am Working on a Server/Client application in Asynchronous mode. I am using simple Socket when Asynchronous dont simes to be suported by TcpClient och TcpListener.
I am using Serializable on some objects(in a DLL file) to be abled to send this objects easy between the Server and Client, by this i dont want to work with a byte buffer, insted i want somthing like this.
<br />
stream = socket.GetStream(); <br />
formatter.Serialize(stream,user);<br />
There i easely can get the objects(if there is any in the stream. Tha abow code is not with a regular socket but a TcpClient.
Right now my Program looks like this
<br />
private void SetupRecieveCallback(Socket server)<br />
{<br />
try<br />
{<br />
if(server != null)<br />
{<br />
AsyncCallback recieveData = new AsyncCallback(OnRecievedData);<br />
<br />
<br />
}<br />
}<br />
catch(Exception ex)<br />
{ MessageBox.Show("Error in ForumClient - Connection - SetupRecieveCallback : " + ex.Message);<br />
}<br />
}<br />
<br />
<br />
public void OnRecievedData(IAsyncResult ar)<br />
{<br />
Socket server = (Socket)ar.AsyncState;<br />
try<br />
{<br />
int nbyte<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show("Error in ForumClient - Connection - OnRecievedData : " + ex.Message);<br />
}<br />
}<br />
How do i get the stream from the socket? and how do i implement it in my program ?
//SnowJim
|
|
|
|
|
Have manage to get a stream no by using NetStream! ofcource =)
Now i have another question!
In the SetupRecieveCallback i am using server.BeginReceive(m_byBuffer,0,m_byBuffer.Length,SocketFlags.None,recieveData, server);
This will trigger so that OnRecievedData is thown if someone is sending data, but if i dont whant to use this buffert and insted use this
ForumPack.command user = (ForumPack.command)formatter.Deserialize(stream);
is there any way to do the same thing but with this stream? or do i have to use the buffert(and set the size) and then translate the byte in to the object?
BestRegards
SnowJim
|
|
|
|
|
I've a windows form, on which a picturebox is placed. I've loaded images into the picturebox. I've implemented the Zoom In and Zoom out functinality. Now my problem is when I zoom in, the picturebox is not spreading equally in the form. I mean the distance between picturebox and the container form should be equal, on four sides, as I zoom in and out ( the picturebox should be exactly centered). How can I achive this? Any help?
Here is the piece of code for Zoom In and Out
For Zooming In :
pictureBox1.Top= (int)(pictureBox1.Top - (pictureBox1.Height * 0.025));
pictureBox1.Left = (int)(pictureBox1.Left - (pictureBox1.Width * 0.025));
pictureBox1.Height = (int)(pictureBox1.Height + (pictureBox1.Height* 0.05));
pictureBox1.Width = (int)(pictureBox1.Width + (pictureBox1.Width * 0.05));
For Zooming Out :
pictureBox1.Top = (int)(pictureBox1.Top + (pictureBox1.Height * 0.025));
pictureBox1.Left = (int)(pictureBox1.Left + (pictureBox1.Width * 0.025));
pictureBox1.Height = (int)(pictureBox1.Height - (pictureBox1.Height* 0.05));
pictureBox1.Width = (int)(pictureBox1.Width - (pictureBox1.Width * 0.05));
Stay cool
|
|
|
|
|
I bet you can do a lot better than this with some custom drawing code.
To answer your question about centering... the standard way of center goes like this:
int newX = (form.Width - picBox.Width) / 2;
int newY = (form.Height - picBox.Height) / 2;
...
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
anyone knows the function for checking if the system had been idle for a specified amount of time, i.e., the user had not performed any action for n seconds. tnx for helping me out!
vicky
|
|
|
|
|
Have a look at http://www.codeproject.com/csharp/uim.asp.
|
|
|
|
|
Hi,
I had made one user control and i am adding this user control into one win form.Now problem is that whenever i am drawing any rectangle on the control which is on the form the images goes down side,which looks very bad.
if i will put autoscroll=false then when image is larger then required size then user will not able to see whole image.
so what is the way can any one help me?
thanks
regards.,
montu3377
|
|
|
|
|
how do u draw the image as abackgroung image
or at all write the code tthat u used to do it
ByMindOnlyYouCanDoIt
|
|
|
|