|
there was a bug in my original test code.
you need to change this:
p[x * 3 + y * w * 3 + 0] = w % 256;
p[x * 3 + y * w * 3 + 1] = h % 256;
p[x * 3 + y * w * 3 + 2] = (w + h) % 256;
(w and h are constant so the image is a solid color)
to this:
p[x * 3 + y * w * 3 + 0] = x % 256;
p[x * 3 + y * w * 3 + 1] = y % 256;
p[x * 3 + y * w * 3 + 2] = (x + y) % 256;
Elapsed timing map: 1002 msec.
Elapsed timing hash_map: 1887 msec.
Elapsed timing C-Code: 120 msec.
Press any key to continue . . .
|
|
|
|
|
Chris Losinger wrote: Elapsed timing map: 1002 msec.
Elapsed timing hash_map: 1887 msec.
Elapsed timing C-Code: 120 msec.
Press any key to continue . . .
Here, its
Elapsed timing map: 455 msec.
Elapsed timing hash_map: 247 msec
Elapsed timing C-Code: 185 msec.
Are you still in Debug?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: Are you still in Debug?
nope.
VS05, Release. optimized for "Maximize Speed"
|
|
|
|
|
Hi
When I right click on a folder , I need to disable any of the Menu Option.
Any Suggestions would be helpful.
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
even iam eager to find answer for this.
thanks to the poster and the answerer.
|
|
|
|
|
When you use the CMenu class, you can disable menu options as follows:
CMenu * Menu = GetMenu (); // Gets the window's menu (if any)
if (Menu != (CMenu *)NULL) // make sure there is a menu
{
CMenu * SubMenu = Menu->GetSubMenu (nItem); // Gets the submenu at nItem (starts at 0)
if (SubMenu != (CMenu *)NULL) // make sure there is a submenu
{
SubMenu->EnableMenuItem (nMenuItemID, MF_GRAYED|MF_BYCOMMAND); // disables the menuitem
}
}
The itemID can be either the command id or the position in the menu. This is indicated by the MF_BYCOMMAND, which can be replaced by MF_BYPOSITION to use a sequence number rather that the command ID.
In stead of MF_GRAYED (which disables the command and grayes it), you can also use MF_DISABLED (which disables the command but does not gray it) and of course MF_ENABLED, which enables the command.
Goof luck
William
|
|
|
|
|
Thanks william.
What I did is, Iam getting the Handle of Windows Media Player Application.
and from it a pointer to the menu bar.Now I want to disable the File->Open menu Item . How Should I do it?
Iam doing as below...
CWnd *pWnd = CWnd::FindWindow(_T("WMPlayerApp"),NULL);
CMenu *pMenu = pWnd->GetMenu();
if (pMenu != NULL && pMenu->GetMenuItemCount() > 0)
{
CMenu * pSubMenu = pMenu->GetSubMenu (0);
if (pSubMenu != (CMenu *)NULL)
{
pSubMenu->EnableMenuItem (nMenuItemID, MF_GRAYED|MF_BYCOMMAND);
}
}
What is that I should specify in place of nMenuItemID?
How do I know the Id of a sub menu in another Appln?
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
I got it...
pSubMenu->EnableMenuItem (pSubMenu->GetMenuItemID(0), MF_GRAYED|MF_BYCOMMAND); // disables the menuitem
Thanks.
Today is a gift, that's why it is called the present.
|
|
|
|
|
Hello again,
Now, I have problem upon building an MFC project.
Error is: "unexpected end of file while looking for precompiled header directive"
This is due to insertion of an API. I added these files and when I build the project the error appears. Does someone knew of the cause of this problem?
Do I need to change the build properties?
Hope somebody can comment.
Thanks.
|
|
|
|
|
Either you have to include the stdafx.h in the newly added file or you can change the setting so that, the file is not using the precompiled hearder file. for this follows the below step.
project setting->c++->In the categaory combo select "precompiled header". select your file in the left tree view and change the settings to "Not using precompiled headers".
|
|
|
|
|
Thank you very much nave for your time.
I have also figured it out.
Till next post. God Bless.
|
|
|
|
|
For example, Inside a Dialog i have 3 edit controls. If i want to update all 3 controls, i will call UpdateData(True). If, i want to update only a particular contol value(i.e. i don't want to update remaining 2 controls value). how is it possible?
Sethuraman.K
|
|
|
|
|
|
Sethuraman.K wrote: For example, Inside a Dialog i have 3 edit controls. If i want to update all 3 controls, i will call UpdateData(True). If, i want to update only a particular contol value(i.e. i don't want to update remaining 2 controls value). how is it possible?
Sethuraman.K
Use Control's SetWindowText api!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks Alok & Naveen.
I Have another Method also. But I don't know is it correct method or not.
CButton *but = (Cbutton*) GetDlgItem(IDD_CNT1);
but->UpdateData(TRUE);
Sethuraman.K
|
|
|
|
|
|
hi sethuraman,
declare control varaible for each edit box in the classwizard member variable tab.
call that method updatedata(bool) for corresponding edit box variable. and up date to true. then u can acheive ur goal.
eg code:
m_ctrlEdtVar1.UpdateData(true);
here m_ctrlEdtVar1 is the control variable for edit box one.
i hope now u understood.
bye
|
|
|
|
|
hi,
this is the alternate way of implementing.it is some what better way becz you are getting dynamically.
GetDlgItem(ID_of_EditBox_control)->UpdateData(bool);
eg code :
GetDlgItem(IDC_EDIT1)->UpdateData(true);
bye
|
|
|
|
|
Sethuraman.K wrote: ...i will call UpdateData(True).
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am using SQL Server and VC++ 2005.
How to know programatically whether column type of a particular field is CHAR or VARCHAR using OLEDB or ODBC?
|
|
|
|
|
i believe that value you are retrieving from database in a "variant" variable
if so then you can differintiate using the variant type
types are:-
BSTR FAR* pbstrVal; // VT_BYREF|VT_BSTR. for varchar
char cVal; // VT_I1. for char
Regards,
Pankaj Sachdeva
"There is no future lies in any job"
"but"
"future lies in the person who holds the job"
|
|
|
|
|
With ODBC, you can use SQLColumns()
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm writing some code to traverse an Xml document generated by XmlWriter. The document is extremely simple. It consists of a single element with a list of sub-elements storing some values as strings. I am having a problem using XmlReader to traverse the file to retrieve the results though.
I am running Visual Studio 2005 with .NET Framework 2.0.
Effectively what I want to do is to read each element, check a lookup table to see where to store the value associated with the element and move onto the next one. The problem is that I get a compile error when I attempt to use the EOF property.
<br />
int iRead;<br />
XmlReader ^xtr;<br />
xtr = XmlReader::Create(strFullPath);<br />
<br />
xtr->Read();<br />
<br />
while (!xtr->EOF)
{<br />
if ((xtr->NodeType == XmlNodeType::Element) && (xtr->Name == "AdminVal"))<br />
{<br />
iRead = xtr->ReadElementContentAsInt();
}<br />
else<br />
xtr->Read();
}<br />
Now the xtr->EOF does not work at all. It will not compile with it in place but if I replace it with a while(1) then it works 100% fine (except detecting the end of the list is a problem!). I know I can tell the end of the file state from the xtr->Read() return val but if the if statement is traversed, I do not get the opportunity to read the state.
The error listing is
error C2059: syntax error : '('
error C2143: syntax error : missing ';' before '{'
error C2039: 'xtr' : is not a member of 'System::Xml::XmlReader'
c:\windows\microsoft.net\framework\v2.0.50727\system.xml.dll : see declaration of 'System::Xml::XmlReader'
Is this a bug?
Thanks for any assistance!
|
|
|
|
|
What is EOF defined as? I suspect it may be a function in c++ and a property in c# etc so you would need to call it like a function
while(!xtr->EOF())
If that doesnt work, right click on EOF and select "Go To definition". You should be able to see how its been defined
|
|
|
|
|
Go to definition gives the following:
System.Boolean EOF { get; }
Member of System.Xml.XmlReader
Summary:
When overridden in a derived class, gets a value indicating whether the reader is positioned at the end of the stream.
Return Values:
true if the reader is positioned at the end of the stream; otherwise, false.
So it is definitely a property - like .Name which I used successfully several times. I think it is some sort of compiler/framework bug because even trying to assign a bool variable to xtr->EOF gives a compiler error.
EDIT: I should add that when stepping through the debugger (with while(1) instead of while(!xtr->EOF)) and looking at the properties of xtr, the EOF property IS listed and carries the expected value.
|
|
|
|