|
Yes, for example:
case VK_RETURN:
return 0;
That's what I do for all my keys that I want to disable...Win32 rocks!
|
|
|
|
|
georgiek50 wrote:
Win32 rocks!
Yeah!
It does!!!!
Are you doing much Win32 programming?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I am doing as much at time permits. I am a beginner, have been doing this for about 7-8 months. I started with Win32 with hopes to get an understanding of Windows then move to MFC but I decided to stick to Win32 for a lot longer because I don't like how MFC pre-writes code because at my level of programming I won't understand the written code I think and I hate not knowing what's going on. I picked up Petzold's book which was the best programming book I've read to date and I just work on a single program that I have on the internet putting in all different kinds of features to cover as many different aspects of programming as possible. I would like to do this professionaly eventualy. I assume you are? How is the work and how is the pay in Sweden for programmers?
|
|
|
|
|
georgiek50 wrote:
Petzold's book
Very good one!
georgiek50 wrote:
I assume you are?
Well, I have programming as a hobby, but in future I will be a professional programmer!
georgiek50 wrote:
How is the work and how is the pay in Sweden for programmers?
Actually I don't know.
Do you have a homepage?
ICQ?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Homepage: www.movietrack.net
ICQ: No, but MSN id: georgiek50@hotmail.com if you have MSN messenger. So if it is not your work, what is it you do? Student/Other job?
|
|
|
|
|
I've got this working:
The Thread:
<br />
<small>UINT CheckMessages(LPVOID Param)<br />
{<br />
CString tekst = "This is a tekst or maybe a structure";<br />
::PostMessage((HWND)Param, WM_DATARECEIVED, (WPARAM)&tekst, 0);<br />
return 0;<br />
}</small><br />
The header:
<br />
<small>protected:<br />
afx_msg void OnDataReceived(WPARAM wParam, LPARAM lParam);<br />
DECLARE_MESSAGE_MAP()</small><br />
The Function:
<br />
<small>BEGIN_MESSAGE_MAP(CPLCClientView, CFormView)<br />
ON_MESSAGE(WM_DATARECEIVED, OnDataReceived)<br />
END_MESSAGE_MAP()<br />
<br />
...<br />
<br />
...<br />
<br />
void CMyClass::OnDataReceived(WPARAM wParam, LPARAM lParam)<br />
{<br />
CString tekst = (CString)wParam;
AfxMessageBox(tekst);<br />
}</small>
If i execute this i get a weird looking character(because i get a number with wParam), how can i send the CString towards my function?
me = Visual C++ n00b
|
|
|
|
|
willempipi wrote:
void CMyClass::OnDataReceived(WPARAM wParam, LPARAM lParam)
{
CString tekst = (CString)wParam; // or something like that....
AfxMessageBox(tekst);
}
Where you cast the wParam to a CString, I think you should cast it to a CString* instead. You will find however that this too will not work as you expect though. By the time you execute the message handler, OnDataReceived, the thread proc will have already finished and the instance of a CString on the stack will no longer exist. I would suggest that you 'new' a CString in the thread proc and then 'delete' the CString in the OnDataReceived method.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
Chris Meech wrote:
I would suggest that you 'new' a CString in the thread proc
can't i send the CString with the Message toward the function (like OnPaint sends a point value with it's message) so that it would look a little like this:
<small>void CPLCClientView::OnDataReceived(CString tekst)<br />
{<br />
AfxMessageBox(tekst);<br />
}</small>
The Visual C++ n00p
|
|
|
|
|
willempipi wrote:
can't i send the CString with the Message toward the function (like OnPaint sends a point value with it's message) so that it would look a little like this:
Since you're dealing with user defined messages, no. Sending your own message and handling it with ON_MESSAGE requires you to provide a function declarated like that you did before (with WPARAM and LPARAM as parameters). Only then the message is handled correctly. It's not comparable to messages like WM_PAINT. These are special messages handled by corresponding functions which for sure can have other parameter types.
In fact, you should do it the way described before by creating your CString on the heap (calling new) and passing it as WPARAM to your function.
|
|
|
|
|
Schlaubi wrote:
creating your CString on the heap (calling new)
how do you mean this precisly? like this:
CString tekst = new CString;
and,
after i created the tekst, do i have to delete it?
|
|
|
|
|
in your thread:
CString *tekst = new CString("blablabla");<br />
<br />
PostMessage(hWnd, WM_MYMESSAGE, (WPARAM)tekst, 0);
in MyFunc:
...
CString* pStr = (CString*)wParam;<br />
<br />
do_sth_with_string<br />
<br />
delete pStr;
|
|
|
|
|
|
No you can not pass parameters for user defined messages in that way.
I would suggest that you thoroughly read this article[^]. It is one of the best on this site explaining multi-threading and how to deal with the many issues.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
I was used ownerdraw for Menu Items.I was drawn many menu items with bmps.
But I want check only one item among the no of menuitems.How to change the state of the MenuItem from CHECKED to UNCHECKED?
|
|
|
|
|
Use OnCommandUpdate handler!
A. Riazi
|
|
|
|
|
Hi world
I'm looking for a function who tell me how many processor (mono or bi) there is inside a computer (mother board)...
Does somebody have an idea?
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
Raphaël Kindt wrote:
I'm looking for a function who tell me how many processor (mono or bi) there is inside a computer (mother board)...
With the introduction of "hyper threading" CPU's, good luck...
But to find out how many CPU's the system thinks are available, you can use GetSystemInfo.
|
|
|
|
|
Mike Nordell wrote:
With the introduction of "hyper threading" CPU's, good luck...
Yea, for now, but on Windows Server 2003 you can use GetLogicalProcessorInformation()
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
|
How can I execute an exe from my VC++ 6 application?
Thanks
|
|
|
|
|
Use ShellExecute.
A. Riazi
|
|
|
|
|
Could you give me an example?
Thanks
|
|
|
|
|
Do look at the link in my other post (point 6.4 in Michael Dunn's C++ FAQ). You have all the examples you need to achieve what you need.
~RaGE();
|
|
|
|
|
for example, if you want to execute notepad.exe from your dialog, use following statement:
<br />
ShellExecute(m_hWnd, "open", "c:\\WINNT\\notepad.exe", NULL, "c:\\WINNT", SW_SHOWNORMAL);<br />
A. Riazi
|
|
|
|
|
Thanks!
I appreciate it!
n
|
|
|
|