473,378 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

MainWindowHandle of an HTA

132 100+
Hello,

I'm currently working on a software where I need to get the windowhandle of an HTAwindow.

Currently I'm Using this code
Expand|Select|Wrap|Line Numbers
  1.  
  2. Process[] procs = Process.GetProcessesByName("MSHTA");
  3. IntPtr hWnd;
  4.  
  5. debug.print(procs.count()) // returns 1
  6.  
  7. hWnd = procs[0].MainWindowHandle;
  8.  
  9. debug.print(hWnd.ToString()); // returns 0
  10.  
At all times, I'm getting 0 as my handle.
But I don't understand why.

I even tried using the FindWindow but I'm getting the same results.

Anybody has an idea why?

Cheers,
Kenneth
Mar 16 '13 #1
1 1915
Cainnech
132 100+
Actually I just noticed that I made a typo in the FindWindow-code. I jut tried it again and it is working.

However still not using the ProcessByName-function.

But I can continue so that's ok.
Mar 16 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: | last post by:
Hi, In the Process class there is a CloseMainWindow, why is there not a BringMainWindowToForeground or similar method? What would be the best way to do this if we jsut have the process info...
0
by: Luke | last post by:
Question: why Process.MainWindowHandle is zero? -------------------------------------------------------------------------- From document of Process.MainWindowHandle Property: Property Value...
8
by: Mészáros Tamás | last post by:
Hi all, how can I set an app's main window to visible from an other application? My problem is, that I know only the handle of the other app's main process, because the application's main window...
2
by: Moty Michaely | last post by:
Hello all, I am enumerating vb6 process from c# application by name. I need to send message to all processes that has the specified name but for this purpose I need the handle of the main...
0
by: Michiel | last post by:
Hello, When I execute the following code Process* oProc; IntPtr ipMain; HWND hWnd; oProc=Process::GetProcessById(m_IProcId); ipMain=oProc->MainWindowHandle; hWnd=(HWND)ipMain.ToPointer();
1
by: codejunkie | last post by:
Hi, I am running a suite of tests of a WIN 32 application. Every test launches the same application, checks if the Application has a Main Window handle and then proceeds. However i am noticing...
2
by: blue_i | last post by:
Please tell me that how can i add the Triangle code in WM_PAINT i tried but failed. please this problem #include <windows.h> int APIENTRY WinMain(HINSTANCE hInstance, ...
1
by: Zytan | last post by:
I could use win32's FindWindowEx, but I need to know the window's title bar text, or the window's class name that was registered with win32's RegisterClass (does anyone know what that would be?). ...
0
by: siddharthkhare | last post by:
Hi all, I am trying to launch an process in .net as follows.I want to wait till mainwindow handle is initialized. fowlloing code works some times i.e i can read the value of mainwindow handle but...
4
by: ShadowLocke | last post by:
Hi all, Can anyone tell me what the unmanaged equivalent is to get the main window handle of a process?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.