|
I work on a dialog box. I want that when you press VK_RETURN or VK_TAB or VK_DOWN, you will go to the next control. I use accelerator. When one of this key is pressed a relating command arrived and then I launch NextDlgCtrl to go the next. It works well. Normally when a button has the focus, a dotted rectangle appears on it, but in this case with W2k it never appear (with NT it works well). More strange, if you press ALT+TAB go to another application and come back, it begins to work. I do not understand. Is Somebody have an explanation.
|
|
|
|
|
what is the difference between those two functions?
|
|
|
|
|
Is there anyway to make an window that shows the content while moving(dragging), the toolbars don't have this also if i disable that option on the main window setting i won't see the content, so i want to make something to this, could anybody help me?
|
|
|
|
|
Yaw.
Does anybody familiar with some API that can calculate bounding rect of a windows text (Considering the font) ???
Appreciated...
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
You need a DC and the font to correctly do this:
CDC *pDC = GetDC(NULL) ;
pDC->SaveDC() ;
CFont *pFont = GetDlgItem(IDC_CONTROL)->GetFont() ;
if (pFont != NULL)
pDC->SelectObject(pFont) ;
CSize size = pDC->GetTextExtent("Some text") ;
pDC->RestoreDC(-1) ;
pDC->ReleaseDC() ;
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
You can also use DrawText() with the DT_CALCRECT flag.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
named, message-oriented, blocked pipe
Server: one thread, ReadFile, then processes it, then WriteFile.
Client: two threads:
ThreadSend: WriteFile, the content is from console.
ThreadRecv: blocked ReadFile, then processes what is read;
It is found that when ThreadRecv is blocked reading (nothing read), the write operation in ThreadRecv will also be blocked, nothing is written to the pipe and the server gets nothing from it.
When I put the WriteFile and ReadFile into one thread on the client side, everything works well (one thread, ReadFile, then processes it, then WriteFile). It seems that the blocked ReadFile blocks the WriteFile. Is there anyone who knows why this happens and how it can be solved?
Thanks a lot.
Tiny Flying Elephant loves flying...
|
|
|
|
|
Use PeekNamedPipe() to see if there is anything in the pipe to be read and call ReadFile() only if there is.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
also watch out with console apps - they are blocking calls
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hi i have a function called
<br />
writetofile(const char* filename)<br />
{<br />
FILE *stream;<br />
stream = fopen(filename,"a+");<br />
fprintf( stream,"%s",strptr);
fprintf(stream," ");<br />
fclose(stream);<br />
}<br />
when I call the function first time, i got no proglem.. but when i calll next time, I got run time error.... why is that?
|
|
|
|
|
The code makes sense to me, the only reason for failure I can make out is the strptr variable. fprintf may fail horribly if strptr is NULL or pointing to some weird memory location...
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
strptr is not NULL..
strptr get set to some string... right before that function got called.. strptr was fine... even i put some string fori know, that is like "hello" i
oh.. would it be because the function is in different program???
I have two dos-based applications.. but the both have the same function...writefile()....
so please also so tell me...
|
|
|
|
|
What is strptr declared as?
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
Win wrote:
when I call the function first time, i got no proglem.. but when i calll next time, I got run time error.... why is that?
Does the file even open the second time (i.e. does "stream" really get assigned to a real FILE*)?
|
|
|
|
|
Does the file even open the second time (i.e. does "stream" really get assigned to a real FILE*)?
that's i don't know.. I'm calling from the different program.
I have program 1 and program two.
they both have the function that does the same job. i named it writefile(). program1 call the function within itself first.. then program2 call it later within itself..
eventhoguh both writefile() in both program1 and program2 do the same job, act the same, have the same name, but they are in different program so they are different. oh.. the error message is saying expression : str!=NULL
<br />
class program1<br />
{<br />
.<br />
.<br />
.<br />
void writefile();<br />
.<br />
.<br />
<br />
};<br />
<br />
<br />
class program2<br />
{<br />
.<br />
.<br />
.<br />
void writefile();<br />
.<br />
.<br />
<br />
};<br />
|
|
|
|
|
my bad.. coz of typo.. couldn't open the file..
thanks guys
|
|
|
|
|
Hi !
I added a combo box to a toolbar in my FrameWnd. I can add items and everything but I miss 2 things:
1) If I manually type somwthing in the edit box of the combo box, and press enter, I cant find a handler to detect it.
2) how can I read the string value of waht I just entered ?
In a dialog it was much easier I did UpdateData and I was all set....
Thank you
|
|
|
|
|
1) You could use the ON_CBN_SELENDOK notification.
2) just use GetWindowText()
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
The second one worked great, I wasted the whole morning on that.
The first one I already tried and I have it in my message map, the funny thing is that it will not trigger from some reason, is there anything I have to do when I create the combobox so it will sense the ENTER ?
Thanks !!!
Shay
|
|
|
|
|
The edit control portion of a combo box usually does not receive ENTER notifications since all edit controls do not support this behaviour. ENTER usually means "default button pressed", as in dialogs.
What is the parent window of the combo box? Is it a CFrameWnd? You could also search CP for some of those special toolbars that contain combo boxes to get a hint...
good luck
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
yes, the parent is a FrameWnd, I will look in CP for demoes.
Thank you
|
|
|
|
|
I have to work with time functions. Time and date values have to be stored in string representation and have to be in UTC. Format is yyyymmddhhmmss. Now I use time() to get the current time and gmtime() to break it down into single values for formatting. When converting the string back into a struct tm I cannot use mktime() because that function takes the time zone into account, i.e. the resulting time value is not the same as before. I know that localtime() and mktime() are counterparts, is there any counterpart for gmtime()?
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
If you're using MFC, I would use CTime or COleDateTime instead.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Unfortunately I have to use plain C/C++ for portability reasons...
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
I think you can use _ftime() to get the current timezone.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|