|
If you're sending a left mouse button message to the view, that handler should catch it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Wow, you were right. Thanks a lot man.... The only problem the Point coordinates are coming back (0,0). I thought I am sending the Point correctly as WPARAM. pView->SendMessage(WM_LBUTTONDOWN,MAKELPARAM(pView->m_MousePos.x,pView->m_MousePos.y), (LPARAM)0);
Any Ideas?
Thanks
sft
modified on Friday, February 27, 2009 4:25 PM
|
|
|
|
|
The same one...WM_LBUTTONDOWN messages sent by the OS are treated exactly the same as the ones you send yourself!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello Everybody,
I am facing a strange problem.
Requirement: Get the length of contents of a file and modify the header present in the file to represent the length in Hexadecimal format.
Existing Code:
if( cFilePointer.Open(strFileName ,CFile::modeRead) )
{
strContents.Empty();
dwRead = 0;
do
{
dwRead = cFilePointer.Read(cBuffer,100);
if ( dwRead > 0)
strContents.operator +=(cBuffer);
}while(dwRead > 0 );
int iTotalLength = strContents.GetLength();
sprintf(cLengthOfString,"%4x",iTotalLength);
for ( int iIndex = 0;iIndex<4;iIndex++)
{
if ( cLengthOfString[iIndex] == 32 )
cLengthOfString[iIndex] = 48;
strContents.SetAt(iIndex+6,cLengthOfString[iIndex]);
}
cFilePointer.Close();
int iTemp = 0;
int iIndexOfChar = 0;
int iFileNameLength = strFileName.GetLength();
CString strSlash("\\");
while ( iTemp < iFileNameLength)
{
iIndexOfChar = strFileName.Find(strSlash,iTemp);
if ( iIndexOfChar == -1 )
break;
strFileName.Insert(iIndexOfChar,strSlash);
iTemp = iIndexOfChar + 2;
}
hFile = CreateFile(strFileName,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if ( hFile )
cFilePointer.m_hFile = hFile;
if(cFilePointer)
{
cFilePointer.Write(strContents,iTotalLength);
cFilePointer.Close();
}
}
Problem:
When I executing the above code, the file is having every alternative character as NULL.
Please help in the above.
Thanks in advance,
Neelesh K J Jain.
|
|
|
|
|
Your project is a Unicode project, isn't it. That means you are writing Unicode (well, UTF-16) characters out to your file. Then, when you read with an ASCII file reader, you are reading the file as 8-bit characters, so you see the most significant byte of the UTF-16 characters as NULLs.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you Stuart,
Can you please help in converting from ASCII to Unicode and vice versa, so that I don't face this problem in either of the conversion.
Neelesh K J Jain.
|
|
|
|
|
|
If you're using VC++2003, 2005 or 2008, it's very easy. If you #include <atlconv.h>, you have various string conversion macros[^] available.
If you're using Visual C++ 6, you have similar macros[^] available.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have a print method here. I'm trying to print lets say 3 numbers per line ( print(2);). If I had 7 elements, my output would be.
10 12 13
11 15
17 12
How do I get that first line to only print two? Is it going to be something with i % num?
public void print( int num )
{
if( num < 1 )
num = 1;
for(int i = 0; i < size; i++)
{
System.out.print(list[i] + " ");
if( i != 0 && i % num == 0)
System.out.println();
}
}
|
|
|
|
|
Hmmmm - that's not C++, is it - that's C#. Wrong forum, me bucko!
But anyway - the reason is because your test is wrong. Should be if(i % num == (num-1)) .
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I tried that, but it will print something like
10 12
14 13 15
and that still isn't right.
I figured it out, it's actually my System.out.println(list[i]) has to come after the if statement.
Java too btw. Thanks for the idea though.
|
|
|
|
|
This worked OK when I translated it to C++:
public void print( int num )
{
if( num < 1 )
num = 1;
for(int i = 0; i < size; i++)
{
System.out.print(list[i] + " ");
if( i % num == (num-1) || i==size-1)
System.out.println();
}
}
in roughly comparable idiomatic C++, this is:
void print(std::vector<int> const& list, int num )
{
if( num < 1 )
num = 1;
for(int i = 0; i < list.size(); i++)
{
std::cout << list[i] << " ";
if( i % num == (num-1) || i==list.size()-1)
std::cout << std::endl;
}
}
jonig19 wrote: Java too btw
Java, C# - I wasn't a million miles away Maybe I ought to add C# to my sig!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello!
When opening the Property Pages of a project in Visual Studio 2005/2008, the configuration and platform are set by default to the Active ones. For example: Active(Release) and Active(Win32).
Is there any possibility to set the All Configurations and All Platforms options by default in those two combo-boxes? What I mean is that I would like not the set them manually to All Configurations and All Platforms everytime I open the Property Pages of a project, but have them instead set by default.
Thanks in advance!
|
|
|
|
|
I don't think there is.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have created a MFC dialog based application.
I tried to use shared pointer, but it not geting compiled.
std::tr1::shared_ptr<CSharedpointerDlg> sharedpointer;
How to rectify this error
: error C2039: 'tr1' : is not a member of 'std'
: error C2065: 'shared_ptr' : undeclared identifier
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
VC++6 doesn't include TR1 - how could it? It shipped before the original C++ standard came out, never mind TR1!!!!
To get TR1 features, use VC++2008 or Boost's[^] implementation[^].
Oh and by the way - VC++6 is no longer supported in much of Boost, so you may have problems there.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
tr1 is not a part of the STL that ships with VC6.
try boost.
(heh... too late)
|
|
|
|
|
Hey guys,
I got a linker problem.. I have written some .h files and .cpp files for being used in any project, and put them to a folder named "common".
Now I have a project and I set up the vc directories. I add include and source file folders to there. And I include the main .h header file. Compiling is ok but when it comes to linking linker says unresolved external symbol ... So it couldn't find the body in the cpp file.
So how can I tell the linker to use the cpp file?
Thank you...
|
|
|
|
|
You don't tell the linker to use the cpp file - the cpp file's source code, but the linker wants object code...
What you need to do is give the linker a command line that tells it all the object files that are produced by the compiler, plus any import libraries for system libraries (DLLs) that you reference.
BTW - just suggesting here, but we might be able to help even more if you gave an exact error message.
|
|
|
|
|
Error 1 error LNK2019: unresolved external symbol "public: __thiscall CXControl::~CXControl(void)" (??1CXControl@@QAE@XZ) referenced in function "public: __thiscall CXDesktop::~CXDesktop(void)" (??1CXDesktop@@QAE@XZ) DX.obj
This is one of the errors...
SO how can I tell Linker/Compiler to do that
|
|
|
|
|
I should have read your original message more closely - anyway - what Code-o-mat said, add the cpp files to your VC++ project. It'll compile them and link their object files into the final executable.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You need to add your cpp files to your project otherwise it won't know where it should look for the actual implementations of the methods and rest declared in the header files.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Actually this is exacly I am trying to avoid... I do not want to add .cpp files.
But if I have to then I will..
So any other suggestions?
|
|
|
|
|
Well, you could build libraries of your implementations and link to these using #import or such. I never did this so i don't know how it works but i believe that is one way of doing it.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Create a separate static library project for the CPP files and get that to build a static library from the cpp files for you. Then, tell the project that uses that functionality to link against the static library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|