|
thanks for your help
i have one more problem and that is
please read that code and solve mine problem
tmpProcess = new Process();
tmpProcess.WaitForInputIdle();
tmpProcess.StartInfo.FileName="f:\\mirc59t";
try{
tmpProcess.Start();
while(! tmpProcess.Responding)System.Windows.Forms.Application.DoEvents();
}catch{}
tmpProcess.WaitForInputIdle();
IntPtr hWnd=tmpProcess.MainWindowHandle;
///////////////////////////////////////////////////////////
Control parent = Control.FromHandle(hWnd);
//////////////////////////////////////////////////////////
//Control parent = Control.FromChildHandle(hWnd);
if(parent!=null)
MessageBox.Show("parant not null");
/*foreach(Control child in parent.Controls)
{
IntPtr childHandle = child.Handle;
}*/
///////////////////////////////////////////////////////////
parent variable recive null that's why remaining code could not run.
it should not recive null because the process main window
contain two button and four Static members.
can any body tell why it recive null?
and what i have to do that it should not recive null?
i will be very thank full to u.
r00d0034@yahoo.com
|
|
|
|
|
Looks obvious to me, you are starting a process and assume that you get the handle of the main window of the attached process, first error, and then you assume you can get your hands on the main Form instance of a process, second error.
First error : do not assume a process has a window attached it. A process is anything like a .exe, and does not necessarily have a window attached. You must do something like if (!hWnd.Equals(IntPtr.zero)) { ... }
Second error : window handles can be manipulated by any process running on the OS, there is no security problem here because a window handle is nothing. But the instance of the control attached to it is something which lives in the address space of the process, something you don't have your hands on. You have to do some form of messaging (such like the typical WIN32 ::SendMessage, or the more .Net-like Windows.Messaging) to get it between your process, and the one you have started.
And I swallow a small raisin.
|
|
|
|
|
hi there,
subject says it all. i have a listview with LabelEdit set to True - so clicking a label when it is already selected lets the user edit the label's text within the listview.
now i want to start the labeledit-thing by a key (F2) - so i wrote a KeyUp-handler, made the usual switch (e.KeyCode) and now i'm stuck. how should i tell the listview that the user wants to edit the currently selected label? maybe i raise a BeginLabelEdit-event by hand, but how is that done? other ideas?
thx in advance.
:wq
|
|
|
|
|
i have a form app and i put a background image on my form. then set the TransparencyKey to white and select 'None' for FormBorderStyle in order to see a transparent view when app starts.
Everything seems Ok, But my problem is that i can't move my transparent form anywhere. What should i do to move my form without a border?
Any help will be appreciated...
Thanks,
Atilla Selem
just listening to you...
|
|
|
|
|
I am afraid you have to provide the same feature than the one from a standard full-fledged windows app : in the system menu in the caption, there is a "move" command for this purpose,
And I swallow a small raisin.
|
|
|
|
|
Alternatively, capture the MouseDown event when clicked on the whole surface of the form (a picture in your case), then capture the MouseMove event to relocate and finally the MouseUp event to set the new position.
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
You know what, just as I finish my nice Winamp 2.xx Control class, they go and release Winamp 3 which works totally different other than that and the still uncompleted Download class, its still pretty much the same....
BUT, to solve the Winamp (sound really) , I have started working on a managed sound library wrapper for an existing multipurpose soundlib dll. It supports various sound formats including mp3, wav, mod, xm, s3m and CD and more! The existing soundlib is actually more orientated for game development (and includes 3D sound positioning as well as 3D listener positioning) than just a player, so it has many possibilities. In fact it is the same sound library used in EA's F1 2002 . It is based on the DirectSound interface.
At the moment it is about 80% complete and all the C++ is driving me nuts .
I will up it as soon as I'm done as it shows (well, according to me anyways) how to wrap an unmanaged dll in a managed assembly. My goal is though to implement it fully and not just what I need.
BTW, did u sort out your problem?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
BTW, did u sort out your problem?
no - ill get back to it though - its on my TODO list.
i just thought of another thing to have a crack at, so im gonna do that now.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Hi Guys,
How to Access the Registry of Remote System? Code snippets or links would be of great help.
Thanks in advance,
sarith sutha
|
|
|
|
|
is it possible to open MS Word in MDI form as a child with limited functionalities (probably no menus and toolbar)and C# controls all file opening, printing, editing and close option in word?
any help will be appriciated.
thanks
|
|
|
|
|
How can i get the Pixel color in a Graphic ?
Thanks
|
|
|
|
|
Bitmap myPicture;
.
.
.
System.Drawing.Color pixelColor = myPicture.GetPixel(x, y);
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hi all,
im making a status bar that can host any type on control inside it. i wanted to make the status bar class itself handle the sizing of the controls to fit in the panels, but am having a little difficulty, as the actual visible size of the control will vary, depending on whether or not it has a border, but i cannt check this, because not all controls allow to change the border style.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
I think i had a similar problem a while back.
My solution:
As mycontrol was derived from control it had the Size property. So instead of Drawing the border on the outside, I drew it in the inside so the Size property stays constant. That is what I needed.
In your case, you might want to override the Size property. eg.
public override Size Size
{
get
{
if (bordertype =! BorderType.None)
{
return new Size(base.Size.X + borderwidth*2, base.Size.Y + borderwidth*2);
} else return base.Size;
}
set {....same as get, just in reverse...}
}
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Hi all
I am in the process for creating an in house WEB control that can bind to a DataSource - but I can't work out how to. I've deduced that it must be something to do with the TypeConvertor attribute.
I've found this http://morganskinner.dnsalias.net/Articles/DataSource_DataMember.htm [^]which sort of shows what to do but it sort of works but my property doesn't persist properly - but I think that is to do with the example being for a Windows Form control rather than a web control.
Anybody point me in the right direction.
thanks
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
I'll also need to bind to the DataMember and the DataFields (5 of em) once I have managed to do the above.
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Hi,
Can anyone point me to an example of this as there is none in MSDN and I cant find any others
Without going into many details, I presume I need to create an event foreach type (maybe different event args) as the param gets intrepeted differently in each case. I also assume some kind of In/Out system for receiving it from the unmanaged function and sending it forward as an event trigger.
API:
HSYNC WINAPI SetSync(<br />
DWORD handle,<br />
DWORD type,<br />
QWORD param,<br />
SYNCPROC *proc,<br />
DWORD user<br />
);<br />
<br />
BOOL WINAPI RemoveSync(<br />
DWORD handle,<br />
HSYNC sync<br />
);<br />
<br />
void CALLBACK YourSyncProc(<br />
HSYNC handle,<br />
DWORD channel,
DWORD data<br />
DWORD user<br />
);
If anyone can help, it would be greatly appreciated.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Each callback becomes a delegate, let's take the example is if we were dealing with EnumThreadProc(HWND hwnd, int lParam), in C# it is :
public delegate bool EnumThreadProc(IntPtr hwnd, IntPtr lParam);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern bool EnumThreadWindows(int threadId, EnumThreadProc pfnEnum, IntPtr lParam);
EnumThreadProc callbackProc = new EnumThreadProc(MyEnumThreadWindowsProc);
EnumThreadWindows(threadId, callbackProc, IntPtr.Zero );
bool MyEnumThreadWindowsProc(IntPtr hwnd, IntPtr lParam)
{
...
}
And I swallow a small raisin.
|
|
|
|
|
Thx Stephane,
That part I think I have understood. The problem is with (un)registering the event from within C# then from within my class I need to activate the unmanaged callback to return to my delegate where some processing gets done, and lastly passing it to C# as an event. Hope it makes sense . Read C# as the class implementing my class.
This is what i have so far, well my logic, but compiler complains
delegate void GetSyncCallBack(IntPtr handle, int channel, int data, int user);
void OnGetSyncCallBack(IntPtr handle, int channel, int data, int user)
{
OnStreamEnd();
}
IntPtr HSYNC;
GetSyncCallBack getSync;
public event EventHandler StreamEnd
{
add
{
getSync += new GetSyncCallBack( OnGetSyncCallBack );
HSYNC = _SetSync(base.Handle, 0, 0, getSync , 0);
}
remove
{
getSync -= new GetSyncCallBack(OnGetSyncCallBack);
_RemoveSync(base.Handle, HSYNC);
}
}
protected virtual void OnStreamEnd()
{
if (StreamEnd != null)
{
StreamEnd(this, null);
}
}
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
I got it, my logic and persistance served my well.
Solution: bold is changes : had to wait 3 min for event to be raised, but it happened when it should
delegate void GetSyncCallBack(IntPtr handle, int channel, int data, int user);
void OnGetSyncCallBack(IntPtr handle, int channel, int data, int user)
{
OnStreamEnd();
}
IntPtr HSYNC;
GetSyncCallBack getSync;
EventHandler streamendstore;
public event EventHandler StreamEnd
{
add
{
streamendstore += value;
getSync += new GetSyncCallBack( OnGetSyncCallBack );
HSYNC = _SetSync(base.Handle, 2, 0, getSync , 0);
}
remove
{
streamendstore -= value;
getSync -= new GetSyncCallBack(OnGetSyncCallBack);
_RemoveSync(base.Handle, HSYNC);
}
}
protected virtual void OnStreamEnd()
{
if( streamendstore != null)streamendstore(this, null);
}
Hope this helps someone in the future
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Great of you lepp I still don't get it but eh that's great
And I swallow a small raisin.
|
|
|
|
|
heheh, I'm not too sure either.....it just looked right and I found an example how to do Event Properties (add/remove) and it showed you had to implement "delegate storage" (what ever thats mean to do, sounds fancy though). The example was actually for implementing multiple events with the same name from different interfaces.
From what I can process (catch StupidyException me) , it works like a normal Property. That's why the compiler originally moaned. So the Event property adds/removes the events to the "store" (any old delegate, my case EventHandler, "store" is actually confusing and is actually THE eventhandler for firing event, not the Property). Now this "store" delegate can be initiated like you would for any event, like i tried.
I think I got it now too , the keyword being Event Property and using that to set/unset the underlying EventHandler for the Event. Unfortunately, I have no clue about C++, so its a bit difficult for me, but I find the 2 languages "similar" in operation.
Hope this provides some more insight
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
plz give me the link for that example i need that one ?
i will be very thank full to u?
r00d0034@yahoo.com
|
|
|
|
|
|