Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Problem with windows hotkeys

  1. #11

    Problem with windows hotkeys

    Will this code work for Windows' Sticky Keys?

    I'm using SDL Input and one of my principle controls is the [Shift] key. But, on WindowsXP, prolonged use of the [Shift] key makes windows think I want to use Sticky Keys which seriously messes with the game. I get my rocket tanks flying off the top of the screen (Thanks Microsoft! :evil: )

    Will this code prevent that?

  2. #12

    Problem with windows hotkeys

    No, I think it doesn't prevent the Sticky Keys, the user must disable them. I hope Vista doesn't bring more of those tricks :?

  3. #13

    Problem with windows hotkeys

    Quote Originally Posted by cronodragon
    I hope Vista doesn't bring more of those tricks :?
    Beware! There comes sticky cursor
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  4. #14

    Problem with windows hotkeys

    yup, vcl tricks here Smile
    no VCL tricks... I did the following:

    [pascal]
    {Window proc}

    function WindowProc(hWnd,Msg,wParam,lParam:Integer):Integer ; stdcall;
    begin
    //Currentengine is a TBF_CustomEngine object.
    //so i just pass on the messages to a member of the TBF_CustomEngine class

    Result :=CurrentEngine.WndProc(hWnd,Msg,wParam,lParam);
    end;

    function TBF_CustomEngine.WndProc(hWnd,Msg,wParam,lParam:In teger): integer;
    begin
    case Msg of
    WM_ACTIVATEAPP : begin
    fFocus := Boolean(wParam);
    if fFocus then
    begin
    //has focus
    Log('>>>Application activated');
    ShowCursor(false);
    end else begin
    //has no focus
    Log('>>>Application deactivated');
    ShowCursor(true);
    end;
    end;

    WM_TIMER: begin
    //FPS update only when game has focus
    fUpdateFPS := true;
    end;

    WM_CLOSE: begin
    {WM_CLOSE quit's rendering loop
    all resources and devices will be destroyed in
    BF_Core's destructor wich is called when BF_Core.Run ended}
    PostQuitMessage(0);
    Exit;
    end;
    WM_SYSKEYDOWN: begin
    //ProcessKeyDown(wparam, lparam);
    Result := 0;
    Exit;
    end;
    WM_SYSKEYUP: begin
    //ProcessKeyUp(wparam, lparam);
    Result := 0;
    Exit;
    end;
    end;

    Result := DefWindowProc(hWnd,Msg,wParam,lParam);
    end;

    constructor TBF_CustomEngine.Create;
    begin
    inherited Create;

    fEngine := Self;
    fParent := Self;
    .....

    //Initalize the application
    wClass.lpszClassName:= 'CN';
    wClass.lpfnWndProc := @WindowProc; //assign the windowproc function

    .....

    //create window
    fHwnd := CreateWindow(wClass.lpszClassName,'bitFIST 3D',
    WS_OVERLAPPEDWINDOW or WS_VISIBLE,
    100,100,640,480,0,0,hInstance,nil);
    end;

    [/pascal]
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  5. #15

    Problem with windows hotkeys

    Ok, I did the same but using a heap of windowses.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •