Window Handle
-
Hallo
Habe folgendes Problem. Ich muss einen Treiber öffnen. Fkt.:
extern HINSTANCE DLLAPI OpenDriverLINX (const HWND hWnd, LPCSTR name)Dem hWnd soll das Handle des aufrufendnen Fensters (bei mir: Form1) übergeben werden. Benutze Borland C++Builder6, Quellcode:
#include <vcl.h>
#pragma hdrstop#include "AIScanMain.h"
#include "drvlinx.h"
#include "dlcodes.h"HANDLE hInstance; // instance handle for the driver
HANDLE hWin; // handle to this application//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::cmdOpenClick(TObject *Sender)
{
// get the handle of this application's window
hWin = Form1->Handle; //auch schon mit hWin=GetActiveWindow(); probiert// call OpenDriverLINX()
hInstance = (HANDLE)OpenDriverLINX( hWin, "kpci3100" );
.
.
.
}
Wenn ich das Programm laufen lasse und den Treiber öffnen will, kommt die Message: 'invalid window handle'. was habe ich nicht begriffen?
Für Hilfe bin ich sehr dankbar
-
Probier's mal mit Application->Handle, alternativ einfach mit NULL.