none
my winCE application got a message says that "encounter serious problem needs shut dow" RRS feed

  • Question

  • I am trying to call the funcation store on the keyboard driver, here is my code.  I am keep getting error message says that my application encountering a serious problem needs to shut dow.  please help me!

    HANDLE hDriver;

    HMODULE hlib = LoadLibrary(TEXT(

    "kdbhid.dll"));

    typedef DWORD (WINAPI *CreateFn)(LPVOID lpParameter);

    typedef void *(__stdcall *CreateKbdFn)(UINT vk, UINT sc, DWORD dwFlags);

    CreateFn pfnCreate =

      (CreateFn) GetProcAddress(hlib, TEXT(

    "KeyboardThreadProc"));

    CreateKbdFn pfnkbd =

          (CreateKbdFn) GetProcAddress(hlib, TEXT(

    "KeyboardEvent"));

    GUID InterfaceClassGuid = {0xcbe6ddf2, 0xf5d4, 0x4e16, { 0x9f, 0x61, 0x4c, 0xcc, 0xb, 0x66, 0x95, 0xf3}};

        DeviceSearchType deviceSearch = DeviceSearchByLegacyName;

    DEVMGR_DEVICE_INFORMATION DeviceInfo;

    DeviceInfo.dwSize =

    sizeof(DEVMGR_DEVICE_INFORMATION);

    //hDriver = FindFirstDevice(DeviceSearch, L"*", &DeviceInfo);  //list of the usb device


    hDriver = FindFirstDevice(DeviceSearchByGuid, &InterfaceClassGuid, &DeviceInfo); 

    //list all the device assiciated with guid



    if ((hDriver == INVALID_HANDLE_VALUE)|| (DeviceInfo.hDevice == NULL))

    {

    printf(

    "unable to find the device\n");

    }

    else


    {

    printf(

    "legency name %s\n", DeviceInfo.szLegacyName);

    pfnCreate( DeviceInfo.szLegacyName);

    pfnkbd(71, 2, 0);

      

    }

        FindClose(hDriver);

    }


    • Edited by Liang1 Friday, December 21, 2012 2:03 PM
    Friday, December 21, 2012 1:39 PM

All replies

  • Where do you check to see if you have valid function pointers for pfnCreate and pfnkbd?  I cannot seem to find that very important code.

    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com

    Friday, December 21, 2012 1:53 PM
    Moderator
  • Bruce,

    Thank you for the reply!

    I just checked the pointer to the functions are not valid! Thank you for pointing that out.   Does WinCE6.0 allow me include the .h which is inside of the kbdhid.dll like to #pragma comment(lib, "kbdhid.dll").   Also when I passing the parameters pHidFuncs and phidpPreparsedData to function FlashLEDs of the Microsoft sample keyboard code, can I just set time to NULL?  I really do not know what else to set them

        pHidKbd->pHidFuncs = NULL;

        pHidKbd->phidpPreparsedData =NULL;

    Thank you

    Liang


    • Edited by Liang1 Friday, December 21, 2012 3:01 PM
    Friday, December 21, 2012 2:20 PM