I have some code written in delphi that uses EnumWindows, I would like to
begin to translate this code to C#. Is there a built in EnumWindows call in
Csharp? or do I have to import the API and use it that way?
Thanks
Wayne 11 18357
You have to use DllImport
[DllImport("user32")]
public static extern int EnumWindows(EnumWindowsCB cb, int lparam);
--
Shak
(Houston)
"Wayne" <Me******@community.nospam> wrote in message
news:#V**************@tk2msftngp13.phx.gbl... I have some code written in delphi that uses EnumWindows, I would like to begin to translate this code to C#. Is there a built in EnumWindows call
in Csharp? or do I have to import the API and use it that way?
Thanks Wayne
I am sorry for the stupid question, but what does EnumWindows do? Gives you
a list of each MDI Child window? Each Form? Each Application?
Telmo Sampaio
"Wayne" <Me******@community.nospam> wrote in message
news:#V**************@tk2msftngp13.phx.gbl... I have some code written in delphi that uses EnumWindows, I would like to begin to translate this code to C#. Is there a built in EnumWindows call
in Csharp? or do I have to import the API and use it that way?
Thanks Wayne
It will give you a list of every top level window on the current desktop.
From there for each window you can call EnumChildWindow recursivly which
will give you a list of each of the child windows.
Thanks
Wayne
"Telmo Sampaio" <ts******@gmail.com> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl... I am sorry for the stupid question, but what does EnumWindows do? Gives
you a list of each MDI Child window? Each Form? Each Application?
Telmo Sampaio "Wayne" <Me******@community.nospam> wrote in message news:#V**************@tk2msftngp13.phx.gbl... I have some code written in delphi that uses EnumWindows, I would like
to begin to translate this code to C#. Is there a built in EnumWindows call in Csharp? or do I have to import the API and use it that way?
Thanks Wayne
No problem importing it, just wanted to make sure I had to, what about the
following:
EnumChildWindows
GetWindowtext
GetWindow
SendMessage
PostMessage
SetCursorPos
The Help in VS.net is great, just its VERY BIG and sometimes hard to find
exactly what you need.
Thanks
Wayne
"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:e5**************@TK2MSFTNGP12.phx.gbl... You have to use DllImport
[DllImport("user32")] public static extern int EnumWindows(EnumWindowsCB cb, int lparam);
-- Shak (Houston)
"Wayne" <Me******@community.nospam> wrote in message news:#V**************@tk2msftngp13.phx.gbl... I have some code written in delphi that uses EnumWindows, I would like
to begin to translate this code to C#. Is there a built in EnumWindows call in Csharp? or do I have to import the API and use it that way?
Thanks Wayne
a) SetCursorPos
Cursor.Position.X = 50;
Cursor.Position.Y = 50;
b)GetWindow
IntPtr handle = //set handle here
Form myForm = Form.FromHandle(handle );
c)GetWindowText
IntPtr handle = //set handle here
Form myForm = Form.FromHandle(handle );
string Title = myForm.Text;
d) EnumChildWindows, SendMessage and Postmessage can be used using DllImport
--
Shak
(Houston)
"Wayne" <Me******@community.nospam> wrote in message
news:ut**************@TK2MSFTNGP11.phx.gbl... No problem importing it, just wanted to make sure I had to, what about the following:
EnumChildWindows GetWindowtext GetWindow SendMessage PostMessage SetCursorPos
The Help in VS.net is great, just its VERY BIG and sometimes hard to find exactly what you need.
Thanks Wayne "Shakir Hussain" <sh**@fakedomain.com> wrote in message news:e5**************@TK2MSFTNGP12.phx.gbl... You have to use DllImport
[DllImport("user32")] public static extern int EnumWindows(EnumWindowsCB cb, int lparam);
-- Shak (Houston)
"Wayne" <Me******@community.nospam> wrote in message news:#V**************@tk2msftngp13.phx.gbl... I have some code written in delphi that uses EnumWindows, I would like to begin to translate this code to C#. Is there a built in EnumWindows
call in Csharp? or do I have to import the API and use it that way?
Thanks Wayne
Thanks Wayne! I am no good with Win32 APIs... I always cheated using (what's
his name? Petzold?)'s API book.
Telmo Sampaio
"Wayne" <Me******@community.nospam> wrote in message
news:#B**************@TK2MSFTNGP11.phx.gbl... It will give you a list of every top level window on the current desktop. From there for each window you can call EnumChildWindow recursivly which will give you a list of each of the child windows.
Thanks Wayne
"Telmo Sampaio" <ts******@gmail.com> wrote in message news:us**************@TK2MSFTNGP11.phx.gbl... I am sorry for the stupid question, but what does EnumWindows do? Gives you a list of each MDI Child window? Each Form? Each Application?
Telmo Sampaio "Wayne" <Me******@community.nospam> wrote in message news:#V**************@tk2msftngp13.phx.gbl... I have some code written in delphi that uses EnumWindows, I would like to begin to translate this code to C#. Is there a built in EnumWindows
call in Csharp? or do I have to import the API and use it that way?
Thanks Wayne
a) x,y are marked as read only so that won't work
b) the form may not be in my app, when I run this code using a handle that I
know exists I get back a null refferance.
c) see b
d) cool I'll get that converted
Any other ideas?
Thanks
Wayne
"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:e0*************@TK2MSFTNGP12.phx.gbl... a) SetCursorPos
Cursor.Position.X = 50; Cursor.Position.Y = 50;
b)GetWindow
IntPtr handle = //set handle here Form myForm = Form.FromHandle(handle );
c)GetWindowText
IntPtr handle = //set handle here Form myForm = Form.FromHandle(handle ); string Title = myForm.Text;
d) EnumChildWindows, SendMessage and Postmessage can be used using
DllImport
I played with the Cursor.Postion a bit more, turns out I have to create a
new Point and assign the postion property the point. So I am good there.
Just need to know how to find a window and get it's text if its not in my
app and possible that it's not a .net app.
Thanks
Wayne
"Wayne" <Me******@community.nospam> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl... a) x,y are marked as read only so that won't work b) the form may not be in my app, when I run this code using a handle that
I know exists I get back a null refferance. c) see b d) cool I'll get that converted
Any other ideas?
Thanks Wayne
"Shakir Hussain" <sh**@fakedomain.com> wrote in message news:e0*************@TK2MSFTNGP12.phx.gbl... a) SetCursorPos
Cursor.Position.X = 50; Cursor.Position.Y = 50;
b)GetWindow
IntPtr handle = //set handle here Form myForm = Form.FromHandle(handle );
c)GetWindowText
IntPtr handle = //set handle here Form myForm = Form.FromHandle(handle ); string Title = myForm.Text;
d) EnumChildWindows, SendMessage and Postmessage can be used using
DllImport
Thanks to everyone for their hints and help. I got Enumwindows working over
the weekend.
Thanks
Wayne
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:wq**************@cpmsftngxa06.phx.gbl... Hi Wayne,
As far as I know, there is no managed class in .NET framework equivalent
to EnumWindows API. However, you can use P/Invoke to call that API. Here I have found some sample codes that uses EnumWindows and GetWindowText in
C#. HTH.
http://www.codeproject.com/csharp/windowhider.asp http://www.vbaccelerator.com/home/NE...numerating_Win dows/EnumWindows_Code.asp
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Maybe a little late if you've already solved the problem, but you may find this site useful for figuring out the PInvoke: http://www.pinvoke.net/
--
Adam Clauss ca*****@tamu.edu
"Wayne" <Me******@community.nospam> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Thanks to everyone for their hints and help. I got Enumwindows working over the weekend.
Thanks Wayne
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message news:wq**************@cpmsftngxa06.phx.gbl... Hi Wayne,
As far as I know, there is no managed class in .NET framework equivalent to EnumWindows API. However, you can use P/Invoke to call that API. Here I have found some sample codes that uses EnumWindows and GetWindowText in C#. HTH.
http://www.codeproject.com/csharp/windowhider.asp http://www.vbaccelerator.com/home/NE...numerating_Win dows/EnumWindows_Code.asp
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sean Dudley |
last post by:
I am currently enumerating windows via the EnumWindows API.
I noticed that for some reason the very first time I call my enumwindows
routine (inside or outside of a thread) it seems to be very...
|
by: Tim Chase |
last post by:
I have found that EnumWindows works very quickly. In DotNet (I use
C#), I can enumerate the windows, narrow them down to just the windows
which are the main windows (i.e., windows which you can...
|
by: Paul Steele |
last post by:
I've written a callback function for use with EnumWindow that is intended to
return the URL of all open IE windows. The code seems to do almost exactly
what I want, but fails at the final step when...
|
by: Frederic_BD |
last post by:
Hello!
I am trying to get a list of all the process running on WinCE. I first
developed my code on NT (which is working fine) and now I am porting it to
WinCE 4.20. I am using embedded Visual...
|
by: Geoff |
last post by:
I need to reproduce functionality from a VB6 application
in VB .Net. In the VB6 app, I use FindWindow, EnumWindows
and other related functions. Is there a .Net NameSpace
that replaces these...
|
by: Geoff |
last post by:
Tom,
I am trying to find out if a specific app is already
running. And, in some cases, I will need to be able
to "click a button" in that other app if it IS running.
Using VS.Net 2003 and .Net...
|
by: SQACPP |
last post by:
Hi,
I try to figure out how to use Callback procedure in a C++ form
project
The following code *work* perfectly on a console project
#include "Windows.h"
BOOL CALLBACK...
|
by: =?Utf-8?B?VHJlY2l1cw==?= |
last post by:
Hello, Newsgroupians:
I've a question regarding the Win32 function EnumWindows. First, the
prototype for EnumWindows is as follows...
BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |