How to get the current process handle Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
james.chengguangwang
Knows some wx things
Knows some wx things
Posts: 38
Joined: Wed Aug 02, 2006 4:59 am

How to get the current process handle

Post by james.chengguangwang » Thu Aug 31, 2006 3:07 am

Hi All,

I have a DllCaller and a Dialog Dll, when the DllCaller module loads the dialog from the dll, I want to let the dialog itself to get the current process handle and set it as its process handle to implement a Modal dialog(but I don't want to pass in the DllCaller process handle), how can I do it? could you give me some suggestions? thanks in advance.

thanks
James

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Thu Aug 31, 2006 8:34 am

Hi!
I suppose you mean the window handle of the main window, not the process handle.
The most simple way would be to use FindWindow() and pass it the class name of the main window if you know it and its title. The resulting HWND could be use to create a dialog modal to it.
Another option would be enumerating all windows of the process and trying to determine the main window that way.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

james.chengguangwang
Knows some wx things
Knows some wx things
Posts: 38
Joined: Wed Aug 02, 2006 4:59 am

Post by james.chengguangwang » Thu Aug 31, 2006 8:37 am

Hi upCASE,

I know the two strategies, but I don't want to use them, are there other methods which can be used to get the main window handle?

thanks
James

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Thu Aug 31, 2006 8:55 am

I'm sorry, but I guess not...
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

james.chengguangwang
Knows some wx things
Knows some wx things
Posts: 38
Joined: Wed Aug 02, 2006 4:59 am

Post by james.chengguangwang » Thu Aug 31, 2006 8:57 am

Get it, I also think so, thank you very much!

Post Reply