|
Bookmarked/Favorited. Thanks!
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
|
I was too searching for the same
Thanks
|
|
|
|
|
|
I am wondering if anyone knows a reliable way using GDI to detect whether an HFONT has unicode support?
|
|
|
|
|
Does the GetFontUnicodeRanges() API help to determine Unicode support for a font?
CClientDC dc(this);
CFont font;
VERIFY(font.CreatePointFont(120, _T("Arial Unicode MS"), &dc));
CFont* def_font = dc.SelectObject(&font);
DWORD dwGlyphSetSize = ::GetFontUnicodeRanges(dc, 0);
GLYPHSET *pGlyphSet = (GLYPHSET *)new BYTE[dwGlyphSetSize];
::GetFontUnicodeRanges(dc, pGlyphSet);
delete[] (BYTE *)pGlyphSet;
dc.SelectObject(def_font);
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Thanks Mark
I looked into that API call, however the other stipulation that I forgot to mention is that it has to work with windows 98. Unfortunatly that call only works for 2000 and up.
If there is any other way that you know of?
Thanks again Mark
Dave
|
|
|
|
|
Hmmm, maybe this KB article will help: Unicode support in Windows 95 and Windows 98[^]
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
I have a DefWindowProc() function to catch unhandled messages. This function returns an LRESULT. I have a switch statement and in some cases I call CWnd::DefWindowProc(). So I simply return the result of the call to CWnd::DefWindowProc(). In other cases, I handle the message.
What should the value of LRESULT be when I handle the message?
|
|
|
|
|
Depends on the message. The documentation will tell you if the message needs a certain return value. If it does not then simply return zero.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Per MSDN:
The return value is the result of the message processing and depends on the message sent.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there a way to make the Save File Dialog have an uneditable directory path or do I have to create a dialog from scratch to do this?
|
|
|
|
|
What does the word "Uneditable" mean?
|
|
|
|
|
So that they can not change the directory that they are in
|
|
|
|
|
Is this[^] what you want?
If not, there articles on how to modify the file dialog found here[^]
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hi,
I've created an MDI application that has a tool bar with buttons which open dialog boxes when clicked.
One Dialog Box class in this application needs a timer.
After reading about CWnd::SetTimer():
UINT_PTR SetTimer(UINT_PTR nIDEvent,UINT uElapse,<br />
TIMERPROC lpTimerFunc);
I've done the following:
<br />
test.h:<br />
class test : public CDialog<br />
{<br />
...<br />
afx_msg void OnStart();<br />
...<br />
};<br />
void CALLBACK EXPORT TimerProc(<br />
HWND hWnd,
UINT nMsg,
UINT nIDEvent
DWORD dwTime
);<br />
=================================<br />
test.cpp<br />
BEGIN_MESSAGE_MAP(test, CDialog)<br />
ON_WM_TIMER()<br />
END_MESSAGE_MAP()<br />
<br />
void test::OnStart()<br />
{<br />
...<br />
int timer;<br />
...<br />
timer = SetTimer(1,1000,TimerProc);
int i = 0;<br />
while(i<999999999)<br />
{<br />
i++;
}<br />
KillTimer(timer);
...<br />
}<br />
<br />
void CALLBACK TimerProc(<br />
HWND hWnd,
UINT nMsg,
UINT nIDEvent
DWORD dwTime
)<br />
{<br />
MessageBeep(0xFFFFFFFF);
MSMPlaybackDlg* pbDlg = NULL;<br />
pbDlg->OnButtonHddPause();<br />
KillTimer(hWnd, pbDlg->timer);<br />
}<br />
the problem is that it doesn't call the TimerProc. It's as if it doesn't timeout after 1000miliseconds.
does anyone know what i'm doing wrong?
thanks,
Kitty5
|
|
|
|
|
It looks like your while loop does not give the main window thread any chance to process its message queue. And once the while loop is exit you also kill the timer immediately.
|
|
|
|
|
suhredayan® wrote: It looks like your while loop does not give the main window thread any chance to process its message queue.
Actually the code is and I also tried the following:
<br />
int timer;<br />
int i;<br />
MSG msg;<br />
HWND hwndTimer = (HWND)this;<br />
while(something)<br />
{<br />
timer = SetTimer(1,1000,TimerProc);<br />
i = 0;<br />
while(i<999999999)<br />
{<br />
GetMessage(&msg, NULL, 0, 0);<br />
if(msg.message == WM_TIMER)<br />
msg.hwnd = hwndTimer;
get to 1000<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
i++;<br />
}<br />
KillTimer(timer); <br />
}<br />
but it still doesn't execute the TimerProc()
Kitty5
|
|
|
|
|
kitty5 wrote: msg.hwnd = hwndTimer;
Why do you need above line ? The WM_TIMER message should have a NULL hWnd for DispatchMessage to invoke the callback.
|
|
|
|
|
unfortunatly i don't see the WM_TIMER invoke the callback with or without the
suhredayan® wrote: kitty5 wrote:
msg.hwnd = hwndTimer;
grrr....
This should be such a simple task...
call SetTimer(1, 1000, TimerProc); is 1000milliseconds pass before the task completes "Pause"
if it does complete then disable timer. until it loops back up to the top....
Kitty5
|
|
|
|
|
|
Yes, i've tried that also. but I get an Assert error in the wincore.h.
I wanted to start a timer before i started doing something. if 1sec has passed then PAUSE. if complete before 1sec then stop timer.
<br />
HANDLE m_TimerHandle = INVALID_HANDLE_VALUE;<br />
<br />
void test::OnButtonStart<br />
{<br />
...<br />
while(something)<br />
{<br />
int i = 0;<br />
...<br />
BOOL success = ::CreateTimerQueueTimer(&m_timerHandle, NULL, TimerProc,<br />
this, 0, 1000,<br />
WT_EXECUTEONLYONCE);<br />
while(i<999999)<br />
{<br />
i++;<br />
}<br />
DeleteTimerQueueTimer(NULL, m_timerHandle, NULL);<br />
...<br />
}<br />
}<br />
<br />
void test::QueueTimerHandler()<br />
{<br />
MessageBeep(0xFFFFFFFF);<br />
DeleteTimerQueueTimer(NULL, m_timerHandle, NULL);<br />
OnButtonPause();
changes colors on the button)<br />
}<br />
void CALLBACK TimerProc(void *lpParam, BOOLEAN timeFired)<br />
{<br />
test *obj = (test*) lpParam;<br />
obj->QueueTimerHandler();<br />
}<br />
Kitty5
|
|
|
|
|
kitty5 wrote: I get an Assert error in the wincore.h.
Probably because you need WINVER defined to be 5 or higher
here is a snippet from one of my files that uses that library
#if WINVER < 0x0500
#error TimerQueueTimer.h requires Win32 Kernel 5
#endif
led mike
|
|
|
|
|
See here[^] for a description of what you're doing wrong and some insight on how timers work.
The following code from your post is the cause of the problem and is wrong in a few levels:
int i = 0;
while(i<999999999)
{
i++;
}
Firstly, as the link I gave above explains, you're not dispatching messages so the timer process will not get called. Secondly, in a multitasking system busy waits should be avoided at all costs. Try code like this:
MSG m;
while (GetMessage(&m, NULL, 0, 0) )
{
DispatchMessage(&m);
}
You will have to implement some mechanism to break out of the message loop after 7 seconds for this code to be the same as your code however. Another timer would do the trick.
Steve
|
|
|
|
|