|
Could you help me ?
I need that user can save a orders as RTF or DOC file without using the CRichEdit. ??
Wiizi
|
|
|
|
|
AFAIK, RTF is a text format, so it shouldn't be too hard to write. Check http://www.wotsit.org/, there's prolly a description there.
And if words were wisdom, I'd be talking even more. The Offspring, I Choose
|
|
|
|
|
|
Does Visual C++ have any support for regular expressions? Or do I need to find someone else's regex code? Any suggestions?
~Cam Desautels (BinaryUprising.com)
|
|
|
|
|
Try BOOST (www.boost.org).
From what I hear it has a good regex that is being considered for the new standard.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I trying to figure out how to suppress all user input for a certain period of time (while a function executes). What's happening now is: I'm using PreTranslateMessage() to ignore all mouse and keyboard commands, but the mouse and keyboard messages are stored in the queue and my trapping misses them because they get executed after my function stops. Any way to flush the message queue after my function stops so all those click messages are ignored?
|
|
|
|
|
You can directly dequeued all of messages by function GetMessage. You should call PeekMessage and GetMessage in iteration till queue will be empty IMHO. But may be some backside will occur, I don't know
|
|
|
|
|
I want to be able to have functionality like in VC++ 6.0 where the user can pick and choose which toolbars to display and which ones to hide. I have all of my toolbars created and added to a CReBar in the MainFrame class of my app. I can't figure out where to have the message handler for the WM_RBUTTONUP message to bring up the menu listing the toolbars to display/hide. Anyone know the answer to this? I tried deriving a ReBar class of my own from the CReBar class and adding the message handler to it, but it didn't enter the OnRButtonUp function of my new class.
Any help would be greatly appreciated.
|
|
|
|
|
Firstly, you should probably use WM_CONTEXTMENU for popup menus, as it supports using your keyboard's popup menu button (where applicable) as well. I don't know if either if these messages will be available to the Rebar class, you might need to use Spy++ to determine where these messages are handled. My guess is that you'll need to handle them in the MainFrame, and then determine whether or not the cursor is currently located over a toolbar.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hey guys
I want to create a simple program to generate a sound frequency to play through my speakers. I would ideally like to be able to be able to generate a different frequency in each speaker ie 3Khz in right speaker and 3Khz in left speaker. So my question is what is teh easiest and fastest way of doign this.
Peter
|
|
|
|
|
Can any one suggest me good book that overs the topic of "OCR" (optical character recognition). I've searched Amazon, where certain small number of books are present on the topic of image processing and OCR, but i can't figure out which is best. So please suggest me the book you think is best as far as the knowledge of OCR is concerned
Nida Ali
|
|
|
|
|
Hi,
I read the MSDN online and get the following sample of using AfxBeginThread:
UINT MyThreadProc( LPVOID pParam )
{
CMyObject* pObject = (CMyObject*)pParam;
if (pObject == NULL ||
!pObject->IsKindOf(RUNTIME_CLASS(CMyObject)))
return 1; // if pObject is not valid
// do something with 'pObject'
return 0; // thread completed successfully
}
// inside a different function in the program
.
.
.
pNewObject = new CMyObject;
AfxBeginThread(MyThreadProc, pNewObject);
.
.
.
I understand that.....but :
I need to create 50 separate threads (liked 50 different transactions). Since my program is going to simulate the DBMS behavior, in the MyThreadProc() there should be some algorithm to choose whether the current operation of this transaction is READ or WRITE. In this case, all 50 threads will use the same MyThreadProc() and i don't need to make 50 different MyThreadProc(). My question is,
1. Can i create these thread by:
for (i=0; i<50; i++)
{
pNewObject = new CMyObject;
AfxBeginThread(MyThreadProc, pNewObject);
}
2. How to identify Xth thread after creating 50 threads?
3. What parameter I need to put in order to suspend/resume/kill the 10th (or Xth) Thread? Because let say, one thread A (transaction) is READING a data object, and another thread B wants to WRITE the same data object. In this case, thread B needs to wait until thread A finish. So I have to suspend thread B......and wait....then resume.
So, should I call AfxGetThread()???? SuspendThread()??? ResumeThread()????
I need sample codes or examples for each of the above questions. Can anyone help me... please?????
Thanks!!!!
|
|
|
|
|
ChiYung wrote:
1. Can i create these thread by:
for (i=0; i<50; i++)
The for loop will work fine, although you will need to save the return value from AfxBeginThread(). It returns a pointer to the newly-created CWinThread which you will need later.
ChiYung wrote:
2. How to identify Xth thread after creating 50 threads?
Keep an array of CWinThread* and fill it with the return values from AfxBeginThread().
As for suspending/resuming, you should use the built-in thread sync objects, instead of suspending threads yourself. Look up critical sections and mutexes in MSDN.
--Mike--
Rollin' in my 5.0
With the rag-top down so my hair can blow.
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
There are many issuies when you're useing multithreading regarding of your question about simultaneous access to data and whether or not you may call SuspendThread(). You should read at least MSDN topics about CriticalSection usage, about functions WaitForSingleObject/WaitForMultipleObjects and some related topics.
Good luck
|
|
|
|
|
Hello,
how do i get a handle from the desktop, or how do i create a window like the desktop.
Need this Info for programming a secure password protection.
thanx.
|
|
|
|
|
Hi.
CryoGate wrote:
how do i get a handle from the desktop
You can call GetDesktopWindow(), which returns an HWND, or you can call CWnd::GetDesktopWindow(), which returns a CWnd*. If you do the latter, be aware that the pointer is tempoary and should not be stored for future use.
Hope that helps.
Chistopher Duncan
Author - The Career Programmer: Guerilla Tactics for an Imperfect World (Apress)
|
|
|
|
|
I'm trying to draw the caption (title bar) of a dialog myself, but I'm stuck.
I can draw to the non-client area, but I cannot prevent the painting of the ordinary caption bar.
I tried something with the WM_NCPAINT and WM_NCACTIVATE messages, but WM_NCPAINT seems only to have to do with the actual border, and WM_NCACTIVATE doesn't seem to have anything to do with painting at all...
Can somebody please tell me what I'm doing wrong?
Cheers
|
|
|
|
|
If you were in a regular window then you would return false in your handler for WM_NCACTIVATE and do not call the defWindowProc windows will not paint the caption for you.
Since you are in a dialog, you will still need to return true to indicate that you handled the message, but you will need to call SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); . This will set the return result of you message to false, and tell windows not to draw the caption. Then you will be responsible for it.
|
|
|
|
|
Thanks for your reply but I still can't get it to work...
When I boot the app no borders or caption are drawn. But when I click the caption, windows paints the system menu and a horizontal line that seperates the client and the non-client area. I couldn't find any messages that could be responsible for this with Spy++.
When NCPAINT messages are send I can override them, but this is quite confusing.
Also, I'm not quite sure where to put the SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); you mentioned.
Please help me out
|
|
|
|
|
Griffith Sutherns wrote:
Also, I'm not quite sure where to put the SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); you mentioned
This goes in your WM_NCACTIVATE message handler. Inside of your DLGProc, and dialog proc cannot return the result of the message the same way a window proc does, therefore you need to call set window long and set the result there instead.
|
|
|
|
|
How to change his display effect , and changes into XP's style when the mouse has been swept the Title of menu ?
How to show his shadow effect after the menu pop ?
|
|
|
|
|
http://msdn.microsoft.com/library/en-us/dnwxp/html/xptheming.asp
good luck VitSoft
http://www.development.efficientit.com
|
|
|
|
|
How to respond and heavily paints the push-button in VC++6 when the mouse has been drawn CTabCtrl's push-button ?
Whether takes an example ?
|
|
|
|
|
I know this is a simple question. i forgot how to use create my own copy constructor and operator= when i am using pointers... can anyone help me create one by giving a example? because i forgot that if u use pointers you cant use the default operator= and copy constructor because it would cause memory leaks and stuff. so can anyone help me???
John
|
|
|
|
|
Example class:
class array
{
private:
int n_MaxLength;
int n_array;
bool Clone (const array& rhs);
bool Destroy ();
public:
array ();
~array ();
array (const array& rhs);
array& operator=(const array& rhs);
...
};
Here is the constructor and destructor:
array ();
{
n_MaxLength = 10;
n_array = new int[10];
}
~array ();
{
delete[] n_array;
n_array = NULL;
}
Here is the copy constructor:
array (const array& rhs)
{
n_MaxLength = rhs.n_MaxLength;
n_array = new int[n_MaxLength];
if (NULL != n_array)
{
memcpy(n_array, rhs.n_array, sizeof(int) * n_MaxLength);
}
}
Here is the assignment operator:
array& operator= (const array& rhs)
{
if (this == &rhs)
{
return *this;
}
delete[] n_array;
n_array = NULL;
n_MaxLength = rhs.n_MaxLength;
n_array = new int[n_MaxLength];
if (NULL != n_array)
{
memcpy(n_array, rhs.n_array, sizeof(int) * n_MaxLength);
}
return *this;
}
Notice that the Delete code in the assignment operator is the same as the delete code in the destructor. And also that the copy code in the copy constructor is the same as the copy code in the assignment operator. When my class get larger, and there are alot of variables to manage, I usually organize my classes like this to help reduce redundant code:
void Destroy()
{
delete[] n_array;
n_array = NULL;
}
void Clone()
{
n_MaxLength = rhs.n_MaxLength;
n_array = new int[n_MaxLength];
if (NULL != n_array)
{
memcpy(n_array, rhs.n_array, sizeof(int) * n_MaxLength);
}
}
~array ();
{
Destroy ();
}
array (const array& rhs)
{
Clone();
}
array& operator= (const array& rhs)
{
if (this == &rhs)
{
return *this;
}
Destroy();
Clone();
return *this;
}
|
|
|
|