|
Thank you very much.
I've tried to fix my problem as you shown but the same error uccurs.
Can you have any ideals to help me?
Thanks again!
Hoang Quoc Dat
|
|
|
|
|
public struct ProStruct{int hProcess;int hThread;int dwProcessId;int dwThreadId;}
Thank you very much.
But I've tried it before but the same error occurs.
Could you have any other ways?
Thanks
Hoang Quoc Dat
|
|
|
|
|
Try this:
[StructLayout(LayoutKind.Sequential)]
public struct ProStruct{
IntPtr hProcess;
IntPtr hThread;
int dwProcessId;
int dwThreadId;
}
|
|
|
|
|
Hi,
I have a situation where I have a class which I would like to be visible within its assembly, but only to be able to be created by a single other class. Ideally I would make the constructor private and the other class a friend and this would solve the problem, but that's not possible in c#. I was hoping there may be some special property of a nested class to allow this but it doesn't seem so.
Can anyone think of another way to do this?
Thanks,
Matt
|
|
|
|
|
There is no clean way. C# sucks.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: There is no clean way. C# sucks.
Aww man...come on now. I come from a C++ and Java background; to me, C# rocks.
|
|
|
|
|
matt cole wrote: I have a situation where I have a class which I would like to be visible within its assembly, but only to be able to be created by a single other class.
Create an interface representing the functionality of the first class. Have the first class implement that functionality as a private class to the second class:
public interface ISomeInterface
{
void DoSomething();
}
public class MyClass
{
private class MyPrivateClass : ISomeInterface
{
public void DoSomething()
{
}
}
public ISomeInterface Create();
{
return new MyPrivateClass();
}
}
Maybe not exactly what you're looking for; you have the interface in your namespace which may not be implemented any where else, but that may not be a problem.
|
|
|
|
|
Hi is it possible to edit a DataRow on a dataset. I am reading an xml file and editing a certian row then exporting the xml file. I know how to delete the row and add a row at the end of the dataset with the updated information but i don't want to have to add it to the end of the dataset evertime i edit a row. Could someone help me out please?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
ds.Tables[0].Rows[intRow][intCol]= "test";
//or
ds.Tables[0].Rows[intRow]["ColumnName"]= "test";
Tamimi - Code
|
|
|
|
|
HI
i want to encrypt my data and save it to registry and decrypt it and retrieve.
how to do ??
|
|
|
|
|
The .NET framework has a bunch of encryption/decryption algorithms built in to the cryptography namespace. The registry stuff is easily found with google.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok . i know, but how to do ?? please help me
|
|
|
|
|
Well, you know where the info is, in the framework. Don't they have google where you live ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
With replies like that you can see why they made him an MVP :P
|
|
|
|
|
|
Hi there...
I am getting crazy with these ugly buttons from visual studio 2003... When i make my programs in C/C++ (allegro), GTK+ for linux and others i have a good support to choose the button style i want to use.
I just wanna know if can i change the style buttons on Visual Studio 2003, C#.
ahhh, not only buttons, radio, check, combo, all things...
thank you guys...
Lucas
|
|
|
|
|
You'll need to design or use someone elses custom controls. The VS03 controls are primarily the stock win32 ones that've been around since NT3.5. IIRC Vista offers a full set of newer shinier ones but you'll need C#3.0 for that.
|
|
|
|
|
dan neely wrote: IIRC Vista offers a full set of newer shinier ones but you'll need C#3.0 for that.
Hm? Isn't it framework 3.0 that is needed, i.e. the format WinFX? C# 3.0 doesn't add anything visual, does it?
---
b { font-weight: normal; }
|
|
|
|
|
you're right. Blame MS's lame naming system for winFX.net for the confusion.
|
|
|
|
|
The project i am currently working on is receiving data through a TCPClient from a server. The server is sending messages to the clients. I have this part working.
When the server sends an initalization message, the client form received this message on a seperate thread. I then use Invoke to pass this message to the thread of the client form.
<br />
public delegate void InvokeData(DataMessageClass d);<br />
<br />
private void Client_DataReceived(object sender, DataMessageEventArgs e)<br />
{<br />
this.Invoke(new InvokeData(this.Data), new object[] { e.DataMessage });<br />
}<br />
<br />
private void Data(DataMessageClass dataMessage)<br />
{<br />
switch(dataMessage.MessageType)<br />
{<br />
case INIT:<br />
{<br />
break;<br />
}<br />
}<br />
What i would like to do is open the child form using ShowDialog ( to prevent the user from hiding it and interacting with the parent until its close ), but receive the additional messages on this child form instead of the parent form. When the message is a COMPLETE message, the child form will close and the parent will again listen for the INIT message to start the process over again.
I know that ShowDialog is blocking as it will block all additional messages comming in from the server until the child form is closed.
I have tried to assign the event on the child form however the messages are not received on the child until the for is close.
I have been able to make this work with the parent reveiving all the message and then passing them on to the child form. In order to make it work this way, i have had to use Show() which allows the user to hide the form behind the parent form.
I am at a loss as to what to try next.
|
|
|
|
|
You don't need to use ShowDialog(). Create the child form with something like this:
ChildForm child = new ChildForm();
child.owner = this;
child.Show();
From the help files:
When a form is owned by another form, it is minimized and closed with the owner form. For example, if Form2 is owned by form Form1, if Form1 is closed or minimized, Form2 is also closed or minimized. Owned forms are also never displayed behind their owner form.
Hope that helps.
Cliff.
|
|
|
|
|
Cliff,
I had stumbled on to this solution just as you replyed. Thanks, this as somewhat the effect i am after.
However, this still allows interaction to the parent form while the child form is visible and does not have focus (ie. i can access menu items). Is there anyway to prevent the user from access items on the parent form?
With ShowDialog(), if you were to try and bring the parent form into focus, the parent never get focus and the user can not interact with it. I suspect that this may be because ShowDialog() is blocking the parent form. Is there a way to duplicate this behavior with Show()?
Jason
|
|
|
|
|
Handle the event of focus of your parent form and then check if the child form is still alive. If so then cancel the current event and focus child else call base function for default focus behaviour.
Regards
Khalid
|
|
|
|
|
Jason V wrote: However, this still allows interaction to the parent form while the child form is visible and does not have focus (ie. i can access menu items). Is there anyway to prevent the user from access items on the parent form?
I suppose you could disable the parent form.
Alternatively, you could receive the data in a separate thread that passes it on via a delegate. When you create the child form, you change the delegate to the child, setting it back in Form.Closed.
Cliff.
|
|
|
|
|
Hi,
I upgraded my C# Windows form application project to Visual Studio 2005 and now my Deployment project no longer works correctly. From the administrator account I can install my windows application w/ no errors and I can run the program from the desktop shortcut w/ no errors. However, when one of the normal users logs on and trys to start my application by double-clicking the desktop shortcut, the following error occurs:
An installation package for the product AMCAT cannot be found. Try the installation again using a valid copy of the installation package "SetupAndInstallAMCAT.msi".
Note: AMCAT is the name of my Windows application.
Any help would be greatly appreciated!
Thanks,
Terri
|
|
|
|