Type: Posts; User: MasterDucky
Search took 0.02 seconds; generated 6 minute(s) ago.
July 12th, 2014, 03:15 PM
It worked. :) Thank you.
First I put it in the case that called the play() in the menu not on the button that's why it didn't work.
July 12th, 2014, 12:34 PM
Yes but I need to push that button to start the application. After that on the other hand I want to handle WM_KEYDOWN messages.
But since the focus stays on the button I dont get the WM_KEYDOWN...
July 12th, 2014, 04:47 AM
If I click on a button then it will keep the focus and I won't get any WM_KEYDOWN messages any more as long as I dont click outside and then back on the window.
What is the cause of this behaviour...
July 11th, 2014, 08:57 AM
July 11th, 2014, 08:06 AM
In the Charles Petzold C++ book examples the cases in the switch (message) are returning return 0;
But if I create a project in Visual Studio 2010 it puts breaks; instead of return 0;
That was it! Thanks a lot, you made my day! :wave:
Its apparently not defined there and even if I change the function name I get the same error.
// stdafx.h : include file for standard system include files,
// or project specific include...
I created a very simple c++ win32 project in MSVC 2010.
I added a .cpp file with the function definition and a .h file with the function prototype and I get this "function already defined" error....
It's a pity it's in MFC but Im gonna check it out nevertheless, thank you Arjay.
Thanks, that's a good tip!
Interesting that PostMessage can take a string* directly but SendMessage cannot.
Mea culpa, I forgot a 'delete pItem;' at the end of another thread, that was it! :)
Yes I definitely need to learn to debug first.
No, I havent. I use codeblocks with MSVC 2010 and single file debugging is not supported. I know its lame but I dont like to create a project for every little program I use. :)
while (getline(ss, str, '?'))
TCHAR* pItem = new TCHAR[MAX_PATH];
Thanks, I did, it compiles but crashing.
This is what you meant?
TCHAR * pItem = (TCHAR*)wParam;
SendMessage(hListBox, LB_ADDSTRING, (WPARAM)0,...
June 30th, 2014, 02:30 PM
Thanks for pointing this out.
I changed my code accordingly but since I cannot declare the pointer inside 'case WM_USERDEFINED:' I have to declare it outside of the 'switch (Msg)' and it's...
June 30th, 2014, 02:31 AM
It works with SendMessage but I was advised to use PostMessage from a thread instead.
It works also with declaring and deleting the string buffer in every loop but I thought it was an overkill.
June 27th, 2014, 12:44 PM
I found a very strange behaviour.
Im sending a message from a worker thread to the main window.
If I uncomment the 'cout' line its working properly main window gets all the strings Im sending.
June 26th, 2014, 01:17 AM
Thanks Victor, that's working perfectly. :thumb:
June 25th, 2014, 10:04 AM
That was it, thank you for the explanation.
But on the other hand Vitor, if I replace SendMessage with PostMessage as you told me, nothing will be printed in the ListBox.
Any idea why?
June 25th, 2014, 03:55 AM
#define UNICODE 1
using namespace std;
June 24th, 2014, 07:47 AM
Yes, that was it, thanks.
June 24th, 2014, 07:37 AM
If I change it to PostMessage it wont draw any text.
June 21st, 2014, 06:33 AM
This is how I set focus:
if (pdis->itemState & ODS_FOCUS)
but when I want to set focus...
June 20th, 2014, 08:10 AM
Why cant I use LB_ADDSTRING with the LBS_OWNERDRAWFIXED style?
If I remove it it works.
#define ID_LISTBOX 162
HWND hListBox = NULL;
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.