|
I think GetMenu()[^] is the function you are looking for.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
You are right, but my query is how I will get the parent menu (FILE, View,Help) using get menu. I am able to get the child menu and modifying it using ModifyMenu(); Here is my code:-
CMenu *pMenu = GetMenu();
pMenu->ModifyMenuW(ID_FILE_PRINT_REPORT,0,ID_FILE_PRINT_REPORT,"Open File");
Here "Open File" is inside file menu.
Now I want to change the name of "File" to "File report", for that I need to know the ID of file which is parent menu.
|
|
|
|
|
I think you are probably referring to GetSubMenu()[^]. Take a look at the class hierarchy in MSDN to see what other methods each class offers.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I think you might need to use "GetMenu()" in the CMainFrame" class.
|
|
|
|
|
Hi all ,
I view the code in file barstat.CPP in MFC's code . I see method CalcFixedLayout of it . If CalcFixedLayout haven't , status bar will invisible .
I search on MSDN and I see framework don't call to this method .
I don't see this barstat.CPP call to it .
I don't understand why I don't call it but if it haven't , status bar will invisible . Perhaps , the framework call it .
Thanks for helping .
|
|
|
|
|
Hi all,
I have two worker thread.
one thread is populating the list and second thread is doing operation on that list.
my problem is i want that after i have populated the list then only second thread should start.
How can i do it?
Thanks in advance
|
|
|
|
|
In the second thread you can use WaitForSingleObject() to wait for the first thread's handle to complete.
|
|
|
|
|
1. Start 1st thread.
2. Wait for it to finish.
3. Start 2nd thread.
learningvisualc wrote: my problem is
??
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
In addition to the previous answer: is there a particular reason why you want to use a second thread ? You have to wait until the first thread is finished, so why don't you simply execute that task in the same thread as the first one. I don't really see an added value of starting a second thread when the first one terminates.
|
|
|
|
|
|
#include "stdafx.h"
#include "iostream"
using namespace std;
HANDLE hThread1 = NULL;
HANDLE hThread2 = NULL;
HANDLE hEvt1 = NULL;
DWORD __stdcall ThreadProc_1( LPVOID lpParameter )
{
for(int i = 0; i<10; i++)
{
cout<<"populating the list -- "<<i<<endl;
}
::SetEvent(hEvt1);
return 0;
}
DWORD __stdcall ThreadProc_2( LPVOID lpParameter )
{
while(::WaitForSingleObject(hEvt1, 5) == WAIT_TIMEOUT)
{
Sleep(5);
continue;
}
for(int i = 0; i<10; i++)
{
cout<<"doing operation on that list -- "<<i<<endl;
}
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
hEvt1 = CreateEvent(NULL, TRUE, FALSE, NULL);
hThread1 = CreateThread(NULL, 0, ThreadProc_1, NULL, 0, NULL);
hThread2 = CreateThread(NULL, 0, ThreadProc_2, NULL, 0, NULL);
while(::WaitForSingleObject(hThread2, 5) == WAIT_TIMEOUT)
{
Sleep(5);
continue;
}
if(hThread1)
::CloseHandle(hThread1);
if(hThread2)
::CloseHandle(hThread2);
if(hEvt1)
::CloseHandle(hEvt1);
return 0;
}
|
|
|
|
|
Xie Jinghui wrote:
while(::WaitForSingleObject(hEvt1, 5) == WAIT_TIMEOUT)
{
Sleep(5);
continue;
}
This has the same effect than:
::WaitForSingleObject(hEvt1, INFINITE);
but is more complex and less efficient as the OS every 5 seconds schedule the thread to be runt again; using a wait timeout of INFINITE is better because the OS suspend the thread and resume it only when the eventis signeled.
- You don't really need to create an event: the second thread could simply wait for the first thread to terminate
::WaitForSingleObject(hThread1, INFINITE);
|
|
|
|
|
Thank you,
I always overlook the details,,,
the program will be more efficient,
|
|
|
|
|
Make it single threaded - threads are only useful when doing parallel operatations, they're only overhead otherwise.
Cheers,
Ash
|
|
|
|
|
Hi
How to change the radio button caption text color( MFC ).By default it is showing Black color.I want the radio button caption text color, other than default color.
Thanks
|
|
|
|
|
|
In WM_CtlColor Handler write following Code.
HBRUSH CTestProjectDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(pWnd->GetDlgCtrlID() == IDC_RADIO1)//For IDC_RADIO1
pDC->SetTextColor(RGB(255,0,0));
return hbr;
}
|
|
|
|
|
Hi all,
I have made a .txt file in a format that it contains data per line i.e. in the format
/*text1*/
/*text2abc*/
And its not defined that how much data it can contain per line.
I am reading this file in a per line format basis using this code
CStdioFile ptr;
CString str;
int i = 0;
ptr.Open(file_name, CFile::ReadWrite, NULL);
while(ptr.ReadString(str))
{
m_List.InsertItem(i,str);
i++;
}
ptr.Close();
My problem is if a list contains more data(5000 lines or above) its taking a lot of time to read it.
I also know that i can read particular number of bytes from buffer but the problem is how can i know that the line has been completely read or not.
Can anybody please help me in this?
Is there any other way to read thid file.
Thanks in advance
|
|
|
|
|
I think your application is slow because of the huge number of items in the list control.
You may consider using a virtual list, see, for instance, the following CodeProject article: Using virtual lists.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Read the file THEN populate the list. and as my colleague wrote, use a virtual list.
Watched code never compiles.
|
|
|
|
|
Hi,
I had written programs using TURBO C & C++ IDE. These were written for MS-DOS OS. When ever i talk about these programs i refer them as "16 bit programs (MS-DOS)". Is it right? cause MS-DOS is an os which could manipulate up to 16bits of information so a program written using its api should be 16bit programs besides DPMI(dos protected mode interface) or the TURBO C++ IDE.
I would like to have any kind of reply which could give more information about this and to conclude my doubt.
|
|
|
|
|
It depends on what you mean by MS-DOS, keep in mind since Windows XP MS-DOS is no longer part of the OS. I believe that is the first Windows version that ran a console rather then MS-DOS inside windows (or the other way around). And in Windows XP+ the console is a true 32bit application. In the 64bit version of Windows it depends on the program, but the default console is 64bit then.
A note on the 64bit Windows, I believe that if an application is 32bit it will start the WOW32 emulator.
|
|
|
|
|
Oh... So the virtual machine works like a 32 bit system isn't it?
What in Windows 98? I hope that virtual machine works as 16 bit.
I am using dosbox an emulator in windows xp because this xp 32bit version virtual machine does not render c graphics as expected.
I hope dosbox should run an emulator which is 16bit. Because i get all my outputs as expected. i have used EGAVGA.BGI Borland Graphics Library and i use lot of outport and inport function which interact with the keyboard and video card.
so can i still say that my programs are 16bit apps because they cannot access more memory than that unless we use memory managers which i have tried a lot but could not successfully use them. now we are far away form those concepts... i am documenting my old work . so is the reason for the flashback.
BESIDES I READ THIS AS FIRST REPLY AND I AM RESPONDING TO IT. I DID NOT READ THE OTHER REPLIES UNTILL I COMPLETED THIS REPLY. ANY WAY THANKS FOR ALL EXPERTS WHO HAD REPLIED TO ME.
http://vikku.info/ Today's Beautiful Moments are
Tomorrow's Beautiful Memories
modified on Saturday, October 30, 2010 4:39 AM
|
|
|
|
|
It depends which Turbo C++ you are using. If it is the ancient character-based one (looks like a DOS screen), then it generates 16-bit code. If, however, you use the more modern one (ca 2005, looks like a real Windows IDE), then it generates 32 bit code, even for console apps.
HTH
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|