|
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
|
|
|
|
|
before i knew about getbuffer i have used this kind of type casting to modify the data also, never gave me any problem but not doing it now.
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
*coughs and shuffles feet nervously*
i sometimesam too lazy to do the GetBufferSetLength() thing
"there is no spoon" biz stuff about me
|
|
|
|
|
Well that is a BAD thing. However, casting to (LPTSTR) to deal with some MS API routines that can not or do not have the arguments defined as (LPCTSTR) works just find AS LONG AS you know the API will not write to the string. Many API's have arguments that have double duties and thus can not be defined as (LPCTSTR).
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Its very simple to convert a CString to LPTSTR, Just use
CString str;
str.operator LPCTSTR ( );
The "operator LPCTSTR ( )" will return a char pointer to the string data.
Best Regards,
Jijo.
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Hi,
I am looking for an easy way to change text color in CListCtrl header.
Thank you in advance.
csgogogo
|
|
|
|
|
If you use MFC, you will probably have to created your own class derived from CHeaderCtrl.
This article[^] will indicate you how to use the Header Control.
HTH,
K.
And all the girlies say I'm pretty fly for a white guy
|
|
|
|
|
|
Hi:
Q1: How do I remove all breakpoints in project at once.
I used to be able to do that in older VC++ versions, but I can't figure out how to do it in VC7.0.
Q2: In older VC++ versions, when I open new window of same source file and if cursor is in middle of it, the newely opened file will also open up with cursor pointing to same location. In VC7.0 it opens up pointing to first line. I don't like that, how can I change that.
Thanks.
|
|
|
|