Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Retrieving Program's window handle

Years of Service
User Offline
Joined: 8th Nov 2004
Posted: 9th Nov 2004 21:52
I've been trying to use the Windows Api with darkbasic pro. bu i noticed that many of them require for the current program's window handle to be passed as an argument.

To get the window handle i use the folloing code

This code requires for the program's window to be the one focused.
Althogh this might be true for most case it is not for certain.

Is there a better way to do this?.

It is logic to choose with your heart
Retired Moderator
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at
Posted: 9th Nov 2004 22:25
theres probably an api to get the hwnd from the window name/text.

DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
OSX Using Happy Dude
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Nov 2004 23:56 Edited at: 9th Nov 2004 23:56
You should always used the one in g_pGlob (g_pGlob->hWnd). Whilst GetActiveWindow works, it is slow (and why call a function to get a windows handle when its already present? Unless, your not doing a plug-in).

Walk softly... and carry a big gun...
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 10th Nov 2004 02:09
You can use FindWindow instead.

Quote: "this is not a quote"
Shadow Robert
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 10th Nov 2004 03:12 Edited at: 10th Nov 2004 03:12

so many ways to do one thing

Retired Moderator
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Nov 2004 04:31
Get it from DBPro:

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++

Login to post a reply

Server time is: 2023-09-30 10:47:14
Your offset time is: 2023-09-30 10:47:14