Is there any way to get the handle of a running executable ?
for e.g
long ll_hanlde
ll_handle = some_func("c:\test.exe") ....
Regards
Bikash
>Is there any way to get the handle of a running executable ?
>
>for e.g
>
>long ll_hanlde
>ll_handle = some_func("c:\test.exe") ....
>
Bikash,
From within the same executable or from another app?
Why?
--
Boris Gasin [TeamSybase]
mailto:bga...@dynamictechgroup.com
Vote for your favorite tools!
http://www.sys-con.com/java/readerschoice2000/
Mine are:
- Sybase Enterprise Application Server
- PowerJ
- Sybase Adaptive Server Anywhere
- Power Designer V7
From another application ?
TIA
Bikash
Boris Gasin [TeamSybase] <NOSPAM...@dynamictechgroup.com> wrote in
message news:gGLqOC2m8wZJsLW2=f+x3U...@4ax.com...
Once you have a handle to the main window of an application, you can use the
Send() function to send it messages. We use this technique for
inter-application communication btw PB apps, and it works fine.
Paul Horan
VCI www.twoplus.com
Springfield, MA
"Bikash" <bikashprasa...@ushacomm.co.in> wrote in message
news:Jjs4Mgnn$GA....@forums.sybase.com...
> Hi Everbody,
>
> Is there any way to get the handle of a running executable ?
>
> for e.g
>
> long ll_hanlde
> ll_handle = some_func("c:\test.exe") ....
>
> Regards
> Bikash
>
>
>Hi Boris,
>
>From another application ?
You can get a handle to the main window using the FindWindow API call:
Function ulong FindWindowA( ref string lpClassName, ref string
lpWindowName) Library "USER32.DLL"
And what if the App is a non-visual one (typically, an NT service) ?
FX LIAGRE
francois-xa...@lusis.fr
fxli...@hotmail.com
Boris Gasin [TeamSybase] a écrit dans le message ...
--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn
"FX Liagre" <francois-xa...@lusis.fr> wrote in message
news:XIEYEqsn$GA...@forums.sybase.com...
I am using WM_COMMAND but you it has an overhead.So how to define
user defined message and use it.
Thanks in advance
Bikash
Paul Horan <pa...@SpamBakedBeansandSpamTwoplus.com> wrote in message
news:dYcRO3pn$GA....@forums.sybase.com...
FX Liagre
--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn
"FX Liagre" <francois-xa...@lusis.fr> wrote in message
news:2RwcpH5n$GA....@forums.sybase.com...
And the html page does say that the kernel function are valid for win98 and
2000, but not for NT4...
Roy Kiesler [TeamSybase] a écrit dans le message ...
--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn
"FX Liagre" <francois-xa...@lusis.fr> wrote in message
news:w5AsKm9n$GA....@forums.sybase.com...
regards,
Bill
Bikash wrote:
--
Bill Green[TeamSybase]
-----------------------------------------------------------
Good Links to know, good places to go:
Sybase Developer Network (SDN) - http://www.sybase.com/sdn
Find things like:
-- Print to PDF component
-- Lotus Notes E-Mail component
-- Taking existing PB apps to the web white paper
PFC Guide - http://www.pfcguide.com
Power3 - Custom Training - http://www.power3.com
-----------------------------------------------------------
--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn
"Bill Green[TeamSybase]" <bill....@teamsybase.com> wrote in message
news:38ECB2F2...@teamsybase.com...
I used it to create a remote logging app - Can capture performance data
without including everything in the existing app.
Bill
// Global variable
uint gui_TaskbarRestart = RegisterWindowMessage( "TaskbarCreated" )
// Other event on window that implements tray icon functionality
IF Message.Number = gui_TaskbarRestart THEN
inv_shell.of_AddToSysTray( "ToolTip Text Here" )
END IF
--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn
"Bill Green[TeamSybase]" <bill....@teamsybase.com> wrote in message
news:38ECCE08...@teamsybase.com...
... but nothing about services ! Can you help me to understand what I
missed !
Thanks in advance
/* Source of the test window here */
$PBExportHeader$w_processes.srw
forward
global type w_processes from Window
end type
type lb_processes from listbox within w_processes
end type
type cb_ok from commandbutton within w_processes
end type
end forward
type processentry from structure
unsignedlong lpidprocess[500]
end type
type moduleentry from structure
unsignedlong lpidmodule[100]
end type
global type w_processes from Window
int X=1056
int Y=484
int Width=2043
int Height=856
boolean TitleBar=true
string Title="List of Current Processes:"
long BackColor=78682240
boolean ControlMenu=true
boolean MinBox=true
boolean MaxBox=true
boolean Resizable=true
lb_processes lb_processes
cb_ok cb_ok
end type
global w_processes w_processes
type prototypes
Function boolean CloseHandle (ref ulong hObject) Library "KERNEL32.DLL"
Function Boolean EnumProcesses(REF processEntry Process, long cb, REF long
cbNeeded ) Library "PSAPI.DLL"
Function long OpenProcess( long dwDesiredAccess, boolean bInheritHandle,
ulong dwProcessId) LIBRARY "KERNEL32.DLL"
Function boolean EnumProcessModules( ulong hProcess, REF ModuleEntry Module
, long cb, REF long lpcbNeeded ) LIBRARY "PSAPI.DLL"
Function long GetModuleBaseNameA(ulong hProcess, ulong hModule, REF string
lpBaseName,long nSize) LIBRARY "PSAPI.DLL"
Function long GetModuleFileNameExA(ulong hProcess, ulong hModule, REF string
lpBaseName,long nSize) LIBRARY "PSAPI.DLL"
end prototypes
type variables
constant ulong PROCESS_ALL_ACCESS = 2035711
end variables
on w_processes.create
this.lb_processes=create lb_processes
this.cb_ok=create cb_ok
this.Control[]={this.lb_processes,&
this.cb_ok}
end on
on w_processes.destroy
destroy(this.lb_processes)
destroy(this.cb_ok)
end on
event open;ProcessEntry Process // Window structure (array of 500 ulong)...
arbitrary value !
ModuleEntry Module // Window structure (array of 100 long)... idem
long tailleP=2000 // Size of Process
long TailleM=400 // Size of Module
long NeededP // returned size of Process
long NeededM // returned size of Module
long resName // size of returned name of the module
long ifx // for looping through processes
ulong HandleP // Handle of the process
boolean resultP, resultM // return codes for EnumProcesses and
EnumProcessModules
string name // Name of the module
resultP=EnumProcesses(Process,TailleP,NeededP)
if resultP=true then
for ifx=1 to integer(NeededP / 4)
HandleP = OpenProcess(PROCESS_ALL_ACCESS,false,Process.lpIdProcess[iFX])
resultM = EnumProcessModules(HandleP, Module, TailleM, NeededM)
if NeededM >= 4 then
Name=space(254)
resName=GetModuleFileNameExA(handleP, Module.lpidmodule[1], name ,254)
if resName>0 then
lb_processes.AddItem(name)
end if
end if
CloseHandle(HandleP)
next
else
lb_processes.AddItem ("Fail calling EnumProcesses")
end if
end event
type lb_processes from listbox within w_processes
int X=32
int Y=32
int Width=1641
int Height=680
int TabOrder=20
BorderStyle BorderStyle=StyleLowered!
boolean HScrollBar=true
boolean VScrollBar=true
long TextColor=33554432
int TextSize=-10
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type
type cb_ok from commandbutton within w_processes
int X=1714
int Y=32
int Width=247
int Height=108
int TabOrder=10
string Text="Ok"
boolean Default=true
int TextSize=-10
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type
event clicked;close(parent)
end event
/* End of the source */
fxli...@hotmail.com
francois-xa...@lusis.fr
Roy Kiesler [TeamSybase] a écrit dans le message ...
>I stand corrected -- the NT API would be EnumProcesses, exported out of
>psapi.dll. This function will populate an array of ulong as process IDs. To
>get the process handles, you will have to call OpenProcess for each pid in
>the array.
>
For a review of all service related API functions, go to
http://msdn.microsoft.com/library/psdk/winbase/services_2uwj.htm
--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn
"FX Liagre" <francois-xa...@lusis.fr> wrote in message
news:b9qtEhHp$GA....@forums.sybase.com...