|
Look for WM_SYSCOMMAND , SC_MOVE , SC_SIZE , and SC_CLOSE .
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Thanks!But i think is how return the menu ID, that is when you click the "move" or "Size" or "Close".How doing i know click which command?Thanks!
|
|
|
|
|
Those are the menu identifiers. When you interact with the system menu, the window receives a WM_SYSCOMMAND message. Depending on the menu option selected, one of the SC_xxx types will be in the wParam parameter. Check out MSDN for plenty of examples.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Thank you!
|
|
|
|
|
e.g.
int *pA = new int;
*pA = 10; //此时捕获事件?
SetAValue(10);
I don't want to overload the operator '='.
Can I do it?
or
What is the way the transaction of the database?
Best regards!
|
|
|
|
|
ummmmm
ur posting makes absolutely no sense whatsoever
please try to ask a meaningful question so all of chris's happy helpers (thats us btw) can answer you
"there is no spoon" biz stuff about me
|
|
|
|
|
Hi all, my app has a very time consuming function where all files on the computer are ennumerated, and ibe put a "cancel" button on the dialog so the user can cancel the ongoing operation, but (of course) the app doesnt process its messages while the ennumeration is running, so it never sees the user pressing the cancel button.
I know im supposed to implement some code inside the time consuming function so the app has a chance to get and process its messages, but i dont know exacly what functions to call. BTW, the app is a WTL - dialog based app (not MFC).
Any help would be much appreciated.
|
|
|
|
|
Ernesto D. wrote:
I know im supposed to implement some code inside the time consuming function so the app has a chance to get and process its messages, but i dont know exacly what functions to call.
You're supposed to do the work in a worker thread, which will leave your UI thread responsive.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
or ... worst case scenario (if ur allergic to multi-threading) you should use PeakMessage() etc to see if anythings waiting
but thats bad and we dont do lazy bad things here do we?
"there is no spoon" biz stuff about me
|
|
|
|
|
Multithreading isn't something you just flip a switch and now your application is multithreaded. If you haven't laid the groundwork for resource locking, it would be a VERY bad idea to try to make an application multithreaded when a message pump is such a simple and functional alternative.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks for your answers, i was hoping to avoid multple treads, since the app is just a very "basic" utility that searches for certain files, but if its the only way to go then, so be it.
why would it be considered "bad" to use PeakMessage() etc.?
thanks.
|
|
|
|
|
Try this in your while loop..
<br />
if(GetMessage(&msg,NULL,0,0))<br />
{<br />
DispatchMessage(&msg);<br />
if(msg.wParam==WM_DESTROY)<br />
{<br />
PostQuitMessage(0);<br />
return;<br />
}<br />
}<br />
greatest thing is to do wot others think you cant suhredayan@omniquad.com
|
|
|
|
|
Hiya I want to call my child dialog(a dialog for searching..) when F2 is pressed. But I keep getting:
Debug Assertion Failed! File: wincore.cpp Line: 880
I call the dialog in PreTranslateMessage i.e
BOOL CCreateCustomerInvoice::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if( pMsg->message == WM_KEYDOWN )
{
switch( pMsg->wParam )
{
case VK_F2: // if F2 key is pressed
CSearch search; // child dialog class
search.DoModal(); // call dialog
break;
} //end of switch
} //end of if
return CDialog::PreTranslateMessage(pMsg);
}
How do I do this?? Thanks.
|
|
|
|
|
ummmmm isnt ur child dialog being declared within the function and thereby it is a local variable that will disappear when the function exits?
make it class level and show it in the keypress handler
"there is no spoon" biz stuff about me
|
|
|
|
|
Well, i think u should handle it in the OnKeyDown handler.
afx_msg void OnKeyDown(
UINT nChar,
UINT nRepCnt,
UINT nFlags
); Then check the nChar value for VK_F2...
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
I know it sounds a little silly, but it's not. (or maybe it is ) I'm looking for a way to move awindow by dragging it not from the title bar (it doesn't have one), but by anywhere in the window.
I knew how this was done in Delphi, but with VisualC++, I'm still a litlle unconfortable.
Thanks a lot!
|
|
|
|
|
You have to catch WM_NCHITTEST and respond back HTCAPTION, not matter where you really are.
Look at the clock sample that came with MSVC (I think)
|
|
|
|
|
NOw I really don't understand a thing...
I've tried using the onMOuseMove event and moving the window (with MoveWindow() ), but my results were quite... unpredictible
|
|
|
|
|
|
Yes, but if I have no caption bar ata all? Anyway, it's fixed and works just fine!
10x!
|
|
|
|
|
I'm trying to run a program using CreateProcess, but I am unable to run the program due to getting a 998 error, or an "Invalid access to memory location." error. I know the reason for this is because of how CreateProcess handles path names. Here's my call to CreateProcess:
CreateProcess(appPath,cmdLineInfo,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
It should work like a charm, but the problem lies within the path specified in the appPath String. This is what is in the CString appPath:
"C:\Directory_1\Directory secion 2\executable.exe"
Create Process doesn't handle the seperated folder name properly. How can I correct this???
In addition:
How do you convert a CString to a LPTSTR???
Any help is GREATLY appreciated. Thanks!
|
|
|
|
|
will1383 wrote:
Create Process doesn't handle the seperated folder name properly. How can I correct this???
Just a guess, but how about enclosing the file name in quotes. If that don't work, how about converting the path to 8.3 format using GetShortPathName() .
will1383 wrote:
How do you convert a CString to a LPTSTR???
CString::GetBuffer() will return an LPTSTR . Just be sure to call ReleaseBuffer() when you are done.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
to convert the scstring just cast it:
(LPTSTR)(LPTCSTR)myString;
might be a klunk but it works
"there is no spoon" biz stuff about me
|
|
|
|
|
(LPTSTR)(LPTCSTR)myString;
Works but not recommended or safe.
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
i only use it when i know im not going to change anything
"there is no spoon" biz stuff about me
|
|
|
|