Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
F

ffazly

@ffazly
About
Posts
6
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Processing messages
    F ffazly

    Hi. I have a question with regards to processing windows messages. I have a block of pseudo code below: while (TRUE) { //play a tone // get user response (keyboard input) responded = get_response() ; // if no response, increase by 5 dB, go to "play tone" if (responded == FALSE) // else process the response else { //process response threshold_found = process_success(); //if threshold not found, decrease by 10 dB, go to "play tone" if (threshold_found == FALSE) // else record threshold and go to next frequency, // restore familiarization_level, go to "play tone" else { record_threshold() ; // restart the test at the next frequency restart = restartTest() ; // if finished with test get out of while loop if(restart == FALSE) break ; } } } I want to be able to receive keyboard messages while this while loop is executing and also to be able to detect any other messages like button clicks, etc... I've tried to use PeekMessage : while(iCheck == BST_CHECKED) { gen_sound(0, 0.02, 1, current_frequency, duration) ; // play tone while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; if(msg.message == WM_COMMAND) { if(msg.wParam == IDC_START) //check if start button has been pressed iCheck = (int) SendMessage(hCtrl, BM_GETCHECK, 0, 0) ; break ; } } } but I can't seem to get it to retrieve any messages. I've implemented this code in a callback function that is subclassed from the main window so that it can intercept the window messages. Any insight on what I maybe doing wrong or any kind of advice on the matter would be greatly appreciated. Fazly

    C / C++ / MFC database question

  • Push Buttons
    F ffazly

    Thanks for the reply. I got it to work

    C / C++ / MFC help question

  • Push Buttons
    F ffazly

    I'm trying to create a push button such that when it's clicked on the text on the button changes and the button is depressed. If the button is clicked on again then it gets back to its original state. Here's the code that I've written: if(BM_CLICK) { //if button depressed return to original state if(SendMessage(hwnd[ID_BUTTON_START], BM_GETSTATE, 0, 0) == BST_PUSHED) { SendMessage(hwnd[ID_BUTTON_START], BM_SETSTATE, 0, 0); SetWindowText(hwnd[ID_BUTTON_START], TEXT("start")); } //else depress button and change button text else { SendMessage(hwnd[ID_BUTTON_START], BM_SETSTATE,1 , 0); SetWindowText(hwnd[ID_BUTTON_START], TEXT("Pause")); } } My problem is that I can't get the button to get to it's original state. What am I doing wrong here?

    C / C++ / MFC help question

  • ANSI C compliance
    F ffazly

    Is Visual C++.Net ANSI C compliant?

    C / C++ / MFC c++ csharp question

  • source file path
    F ffazly

    Hi. How do you set the path for your source files if they are in a different directory then the project directory in Visual C++.Net. I tried to go to Tools/Options/Projects and added the path to the list of VC++ source file directories but when I compile my code I still get link errors.

    C / C++ / MFC c++ csharp tools

  • Generating tones using MCI
    F ffazly

    Is there a way to generate a tone using MCI by using time an amplitude of sinusoidal wave form as its input?

    C / C++ / MFC question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups