Toon posts:

[VB] Afkomst van Clipboard inhoud

Pagina: 1
Acties:

Verwijderd

Topicstarter
Wie weet hoe je de afkomst van het clipboard kan traceren. Met de WinApi32 functie GetClipboardOwner krijg ik alleen een handle terug (long). Deze is echter niet constant.

Mijn doel is om te bepalen of de gekopieerde data afkomstig zijn uit een ander programma dan wat ik nu ontwikkel.

Uitdaging voor iemand ?!

  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 18:04

Creepy

Tactical Espionage Splatterer

aan de hand van die handle die je terugkrijgt, kan je weer procesinformatie opvragen. Doe dat, en check dan bijv. de exe naam, of titel van het form o.i.d.
Heb ff geen zin/tijd om de betreffende calls op te zoeken.

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


Verwijderd

Topicstarter
Ja okey....

Zoiets had ik wel verwacht. Evenzogoed bedankt. Je begrijpt dat het mij met name gaat om deze 'calls'. Ik ben al met van alles bezig geweest. Ik heb de hele ApiViewer al zo'n beetje gehad.

  • mulder
  • Registratie: Augustus 2001
  • Laatst online: 23:21

mulder

ik spuug op het trottoir

(Edit: verkeerde API...)
code:
1
2
3
4
5
6
7
8
GetWindowText
The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application.

int GetWindowText(
  HWND hWnd,      // handle to window or control
  LPTSTR lpString,  // text buffer
  int nMaxCount     // maximum number of characters to copy
);

oogjes open, snaveltjes dicht


Verwijderd

Topicstarter
Ja, het spijt me hoor... Ik snap hier helemaal nix van. Ik krijg alleen maar Long waardes terug. Deze bovenstaande functie is niet bekend in VB en dit ziet er ook niet uit als VB.

Wanneer is dus een waarde > 0 terug krijg gaat het goed. Dat is duidelijk, maar hoe nu verder. Hoe vertaal je die WinApi zaken nu naar klare taal?

  • mulder
  • Registratie: Augustus 2001
  • Laatst online: 23:21

mulder

ik spuug op het trottoir

code:
1
2
3
4
5
6
7
8
9
10
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Dim lLen As Long
Dim sBuffer As String
Dim ret As Long

  lLen = GetWindowTextLength(hndl)
  sBuffer = String(vbNullChar, lLen)
  ret = GetWindowText(hndl, sBuffer, lLen)

Dit doe ik uit m'n hoofd en ik heb al een tijdje niet geprogrammeerd, maar volgens mij is het zoiets.

oogjes open, snaveltjes dicht


Verwijderd

Topicstarter
Te gek... Bedankt.. Dit ga ik metteen proberen.

Verwijderd

Topicstarter
De volgende regel levert nog steeds 0 op:

lLen = GetWindowTextLength(hndl)

Terwijl hndl wel een waarde heeft...

  • mulder
  • Registratie: Augustus 2001
  • Laatst online: 23:21

mulder

ik spuug op het trottoir

Probeer eens GetLastError API. Check Google. www.vbapi.com.

oogjes open, snaveltjes dicht

Pagina: 1