|
Are you setting the Tabstop Style for the controls you want to Tab between?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
WS_TABSTOP! I didn't even know that style existed.
Thank you Michael and Neville, with your two suggestions together, it is now working like a charm
|
|
|
|
|
I have a problem. I see the text within a box on the screen in one font size, then when I look at the output, it wants to print it bigger than the area.
Can anyone give me a hint on how to set the printed size so if fits within the area?
|
|
|
|
|
I'm trying to create a small jukebox. Do the .wav files need to be placed in the "resources" folder or no? Also, can mp3's be used. Where are these type files normally stored?
Thanks
|
|
|
|
|
Firends i am having a problem and i like your advice in this regard. I would appreciate the non-MFC answer.
I've a thread. The purpose of this thread is to read string from somewhere and then display it on the console. Lets call it thread A. So simple, so easy.
I've two other threads. The purpose of these threads is to get some data from internet.
Now, what i want is that the two threads getting data from internet should "send" the string to thread A, so that it can be displayed. But i don't want those two threads to block. And this is the problem. Of course two threads should write string somewhere and then thread A get those strings periodically. As such critical section is necessary which i like to prevent because as such there is a blocking.
In order to overcome the problem i am using IO completion ports. But the problem is that IOCP is not available in Win9X family operating systems.
So what you like to advice me.
|
|
|
|
|
If it's simply a reader/writer paradigm, why not use a volatile string in the calling thread and write static Get/Set member functions that can be called via a pointer to the calling thread?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Nitron wrote:
If it's simply a reader/writer paradigm,
No, its not simply like that. I need to implement some sort of message queue just like IO completion port.
|
|
|
|
|
One solution is a queue STL container. Pop and insert new messages as string objects.
Kuphryn
|
|
|
|
|
kuphryn wrote:
One solution is a queue STL container.
But as such i need to make this queue thread safe using critical section; otherwise two different threads may want to read and write at this object the same time.
|
|
|
|
|
|
You can't avoid that...
Though the other cheap way, is to post messages to your own window. You can pass the strings by converting them to atom's (see GlobalAddAtom). If you don't have a window, then go back to plan A as mentioned above.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Read the docs for PostThreadMessage().
It will explain how to create a message queue for your thread A (dead easy).
Threads B, C can then call PostThreadMessage(thread_A, MY_STR_MSG, char*, length).
Thread A (even though it doesn't have a window) can use the normal window GetMessage() loop to pull the strings from the message queue.
Probably want to alloc memory for strings in threads B,C and delete in thread A.
...cmk
|
|
|
|
|
Can I set a ProgressBar's postion in a static CALLBACK function? For instance:
......
//{{AFX_DATA(CFormatNT)
enum { IDD = IDD_DIALOG_FORMAT };
CProgressCtrl m_progress;
//}}AFX_DATA
.....
static BOOL CALLBACK FormatDiskCallback( ...);
.......
BOOL CALLBACK CFormatNT::FormatDiskCallback(..)
{
......
m_progress.SetPos(10);
......
}
When I compile it, there is an error as below:
error C2228: left of '.SetPos' must have class/struct/union type
What is the problem? How to solve it?
Thank you in advance!
|
|
|
|
|
A static method can't access non-static member variables. You'll need to pass a pointer to either this or just the CProgressCtrl to the callback function.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
In the head file----------------
//{{AFX_DATA(CFormatNT)
enum { IDD = IDD_DIALOG_FORMAT };
CProgressCtrl m_progress;
//}}AFX_DATA
.....
-------------------------------------
static BOOL CALLBACK FormatDiskCallback( ...,CProgressCtrl progressBar);
static void PrintOut(...PFMIFSCALLBACK FormatExCallback,CProgressCtrl m_progress);
.......
In the implementation file-----------------------------------------
typedef BOOL (CALLBACK *PFMIFSCALLBACK)( ...,CProgressCtrl progressBar );
-------------------------
BOOL CALLBACK CFormatNT::FormatDiskCallback(...,CProgressCtrl progressBar)
{
......
m_progress.SetPos(10);
......
}
void CFormatNT::PrintOut(..., PFMIFSCALLBACK FormatExCallback,CProgressCtrl m_progress)
{
....
FormatExCallback(...,m_progress);
}
...
PrintOut(...,m_progress);
...
Compile it, and the result is:
error C2664: 'PrintOut' : cannot convert parameter 3 from 'class CProgressCtrl' to 'class CProgressCtrl'
What is the problem? And how to solve it?
|
|
|
|
|
Now I have completed the function by using another new thread.
Not handling the CProgressCtl varible in the static function.
|
|
|
|
|
how to play *.ani file in MFC?
I dont want to use the function "LoadCursorFromFile"
I want to use it as a resource.
How do i do!
|
|
|
|
|
Robert,
I am very interested in your code to change the static text and background colors. I have entered in the code to do that from your code, but the colors do not change. Could I send you the code and have you take a look and see what is wrong?
Thanks very much,
George
|
|
|
|
|
hi..
I create a subclassed MFC ActiveX control .. Subclassed from the Listbox control .. a have a method that should add an item :
the code causes an assertion .. can anyone help ?
void CSubCtrl::AddItem(BSTR FAR* strItem) <br />
{<br />
<br />
CString st(*strItem);<br />
CListBox lb;<br />
lb.Attach(COleControl::m_hWnd);<br />
lb.AddString(st);<br />
lb.Detach();<br />
<br />
}
|
|
|
|
|
When talking about assertion, it's needed to know what is its condition from the file it exists in.
However, I guess that the possible assertion that could occur in your code is the IsWindow() assertion (ASSERT(::IsWindow(hWnd)) which indicate the the HWND passed to the Attach() function is invalid.
When you get an assertion in debug mode, click retry to see the assertion condition.
|
|
|
|
|
Hi..
the asseion occures in Attach method .. when i step in the code i find that ASSERT(FromHandlePermanent(hWndNew) == NULL); causes an assetion..
any suggestion please ?
|
|
|
|
|
Hello!
I am an electronics hobyist, I am interested in writing programs for interfacing with my homebrew electronics projects. Is there a generic serial port driver for Win32 environment using open source for download?
|
|
|
|
|
|
Hello,
I am looking for a directive like #error, but one that doesn't stop the compiler. So something like #message...
Does such a directive exist?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Try #pragma message("My Message")
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|