|
Hey Buck,
I have not got around to doing this with the .NET TreeView yet but I had to deal with it in MFC years ago so it should translate.
In my OnContextMenu handler I used the tree control HitTest() to discover the node that was clicked on. I see in the BCL TreeView documentation it has a HitTest() method. I don't know if translating the point would still apply in the .NET environment in that it might already be done.
void CEdTree::OnContextMenu(CWnd*, CPoint point)
{
CPoint pt(point);
ScreenToClient(&pt);
_nmRClickItem = tree().HitTest(pt);
|
|
|
|
|
Yes, I looked up the HitTest() doc and implemented it and it worked wonderfully.
Thanks Mike,
Buck
|
|
|
|
|
Hi All
I have developed a snapIn.at run time I have an object of class CSnapInItem.
I need to extract the classname of that object that inherit CSnapInItem class at run time.
I have tried CSnapInItem* pItem
typeid(*pItem).name();
but its not wrking....throwing an exception..at run time,...plzz help me..hoe to get the class name at run time.
thanks in advance.
Rashmi
|
|
|
|
|
as you're using .NET, try using reflection.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello all,
I am making client server application in c++.
I am using following lines of code.
int m_sock = socket(AF_INET, SOCK_STREAM, 0 );
but m_sock contains -1 and it is not creating socket for me.
Any body know how can i solve this problem?
Thanks in advance
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
seeing as you're using .NET, use the .NET classes to handle this, I'm sure they are easier to manage.
Or, if you're not using .NET, try asking in the right forum.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi, I want to connect PIC16F877A with LM35 to measure temperature ,please tell me how?
and how can i display it on 7segment?
thank you alot.
noooon
|
|
|
|
|
Sounds cool. I'm not sure what part of this applies to Managed C++/CLR...
You may want to post on a more appropriate board.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm using VS2008 Team Suite Trial edition, and when i compile my program without any changes, the performance of the .exe is poorer compared to VS2005. My program is a mixed /clr program with native and managed portions in the same assembly. It does some image processing.
With VS2005, the execution time per frame is 0.003sec / frame. On VS2008, the execution time is 0.020sec / frame. Thats nearly 7 times slower. Is there any compiler switches which are causing this? (In my VS2008, even after setting the WINVER to 0x600 does not make any difference).
My compiler switches are (VS2005)
/O2 /GL /D "WIN32" /D "NDEBUG" /D "_MBCS" /FD /EHa /MD /Yu"stdafx.h" /Fp"Release\Scene Configurator.pch" /Fo"Release\\" /Fd"Release\vc80.pdb" /W3 /nologo /c /Zi /clr /TP /errorReportStick out tonguerompt /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.XML.dll"
Switches (VS2008)
/O2 /GL /D "WIN32" /D "NDEBUG" /D "_MBCS" /FD /EHa /MD /Yu"stdafx.h" /Fp"Release\Scene Configurator.pch" /Fo"Release\\" /Fd"Release\vc90.pdb" /W3 /nologo /c /Zi /clr /TP /errorReportStick out tonguerompt /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.XML.dll"
Linker (VS2005)
/OUT:"C:\Users\Usman\Desktop\Scene Configurator 7.6.8\Release\Scene Configurator.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"Release\Scene Configurator.exe.intermediate.manifest" /DEBUG /PDB:"c:\Users\Usman\Desktop\Scene Configurator 7.6.8\release\Scene Configurator.pdb" /SUBSYSTEM:WINDOWS /LTCG /ENTRY:"WinMainCRTStartup" /MACHINE:X86 /FIXED:No /ERRORREPORTStick out tongueROMPT
Linker(VS2008)
/OUT:"C:\Users\Usman\Desktop\Scene Configurator 7.6.8-08\Release\Scene Configurator.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"Release\Scene Configurator.exe.intermediate.manifest" /MANIFESTUAC:NO /DEBUG /PDB:"c:\Users\Usman\Desktop\Scene Configurator 7.6.8-08\Release\Scene Configurator.pdb" /SUBSYSTEM:WINDOWS /LTCG /ENTRY:"WinMainCRTStartup" /DYNAMICBASE:NO /FIXED:No /MACHINE:X86 /ERRORREPORTStick out tongueROMPT
How can i get back my performance?
Also, another Image Processing app (Pure console based C++), the execution time on VS2005 is 44 sec, while on VS2008 is 34 sec (An improvement!).
All performance measurement in my app is done using QueryPerfCounter. My system is Vista Business x86 on Core Duo 1.66Ghz, 2GB RAM.
|
|
|
|
|
Not sure. Only suggestion I have is to look closer at the compiler switches and experiment.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Ok lets assume i know nothing at all about programing. Wait I dont know anything at all. Where would someone like me start. Now be nice. I wouldnt weant to damage my fragile ego.
shokme277
|
|
|
|
|
Go to the book store.
Browse 100 books.
Buy two.
Now go to the beach.
Enjoy.
Then decide yourself.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Find a good book, and of course, ask questions here when stumped
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi, I am learning managed c++ in visual c++ 2005 express, the code below will find files starting on letter x, my question is how can I copy them to some directory ex. C:\\XXX\\y ?. Thx
DirectoryInfo^ directory = gcnew DirectoryInfo("C:\\Documents and Settings");
array^files=directory->GetFiles("x*.txt",
System::IO::SearchOption::AllDirectories);
for (System::Int16 i=0; iLength; i++)
textBox1->AppendText(files[i]->Name + "- " + files[i]->Length + System::Environment::NewLine);
|
|
|
|
|
|
Thanks for reply I am trying to do something with tis but it's not so simple for beginner .
|
|
|
|
|
Which part are you having trouble with?
Here's an example, using System.IO.Path.Combine() to build the pathnames and
System.IO.File.Copy() to do the copying...
using namespace System::IO;
...
String ^SourcePath = "C:\\SourceFolder";
String ^DestinationPath = "C:\\DestFolder";
DirectoryInfo ^directory = gcnew DirectoryInfo(SourcePath);
array<FileInfo^> ^files = directory->GetFiles("x*.txt", SearchOption::AllDirectories);
for (System::Int32 i = 0; i < files->Length; i++)
{
File::Copy(Path::Combine(SourcePath, files[i]->Name),
Path::Combine(DestinationPath, files[i]->Name));
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you, I have changed Name in:
File::Copy(Path::Combine(SourcePath, files[i]->Name), for FullName and is working
|
|
|
|
|
Hmm...Name worked for me.
Glad you got it working!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
C++ finally has a "for each" statement, and I still never remember to use it.
Maybe typing it out here will help me remember
Here's a modified version...
<font>using namespace System::IO;
...
String ^SourcePath = "C:\\SourceFolder";
String ^DestinationPath = "C:\\DestFolder";
DirectoryInfo ^directory = gcnew DirectoryInfo(SourcePath);
array<FileInfo^> ^files = directory->GetFiles("x*.txt", SearchOption::AllDirectories);
for each (FileInfo ^fileinfo in files)
{
File::Copy(Path::Combine(SourcePath, fileinfo->Name),
Path::Combine(DestinationPath, fileinfo->Name));
}</font> Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Nice, thanks for help, I have just bought some books: vc++.net, Vc++2005,
Vc++2005 examples, c++ in 24 hours, programming with c++ and art of assembly, I have a lot to learn
|
|
|
|
|
Houston, I have a problem!
I'm trying to convert a decimal number (31 digits)
9876543210987654321098765432101
to binary form. Problem is I can't store the decimal as an integer, because it won't fit. It's too large!
Any ideas how I can get started?
I know how to convert a decimal to bin, but one of this size...??
I'm writing this as a c-program.
Thank you!
Over and out...
|
|
|
|
|
All it takes to convert an integer number to binary is testing for odd/even, dividing by 2,
and testing for zero; so how would the size of things matter?
You normally get the lowest bit first, so each new bit needs to be prefixed to whatever
you already have. That should be no problem.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks for your reply Luc!
I know how to convert an integer to binary (dividing by 2). But I can't find a way to divide the number: 9876543210987654321098765432101 by 2? The decimal is way too big to store in an integer!
|
|
|
|
|
How are you holding the large decimal?
- in a string? then devise a function to divide a string by 2, resulting in a new string;
the algorithm should mimic how you do it by hand (that would be left-to-right!).
- in a special type? if so, that type should know how to perform the standard operations.
Some languages, such as C#, have a Decimal type; and there are "big integer" or "multi-precision"
packages that offer the same functionality. Chances are they also know how to show a number
in binary...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|