How to get the hanlde of the window that call a dl

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

How to get the hanlde of the window that call a dl

Post by BackupUser »

Code updated For 5.20+

Restored from previous forum. Originally posted by ricardo.

Marlov makes me a question about how to get the handle of the window that calls some dll.
Maybe there is an easier way, that mine:

Code: Select all

    Global Id

    Procedure EnumWindowsProc(hFind, lParam)
      Shared Id
      Hnd = GetCurrentProcessId_()
      Valor.i
      GetWindowThreadProcessId_(hFind,@Valor)
      If Valor = Hnd
        Id = hFind
      EndIf
      ProcedureReturn 1
    EndProcedure

    ProcedureDLL GetHandle()
      Shared Id
      Hnd = GetCurrentProcessId_()
      EnumWindows_(@EnumWindowsProc(), 0)
      MessageRequester("Handle of the calling window",Str(Id),0)
      ProcedureReturn 1
    EndProcedure

Just call the GetHandle procedure from an application.



Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by marlo.

Thx Ricardo.!!!!

south south america
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by marlo.

Thx Ricardo.!!!!

south south america
Post Reply