|
Did you call RecalcLayout() ?
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I'm a student. I'm learning windows programming. Now I want to write a wordpad in API and without using edit control. I find there are too much things I must deal with. I'm puzzled.
Would you have something like this. Please give me the sample or source code.
Thank you very much.
Email : goldwing1024@hotmail.com
I want to know
|
|
|
|
|
I have seen a tutorial on how to write a text editor but the whole thing is in Win32 asm. However, the concepts and functions are the same as in API so have a look at this link [^].
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
coolhair wrote:
I want to write a wordpad in API and without using edit control. I find there are too much things I must deal with. I'm puzzled.
I'm not surprised. Why would you consider writing a text editor without using an edit control?
|
|
|
|
|
DavidCrow wrote:
Why would you consider writing a text editor without using an edit control?
Good point. Although I've done it . Edit controls and rich edit controls weren't enough for what I needed, so I wrote my own. Works beautifully
I certainly wouldn't recommend it without a few years Windows programming experience though. It was a substantial project
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi! I am new to C++. I want to implement the any size integer class. But I got link error, the vs.net 2003 show this error message:
MyLargeInt error LNK2019: unresolved external symbol "public: __thiscall LargeInt<60>::~LargeInt<60>(void)" (??1?$LargeInt@$0DM@@@QAE@XZ) referenced in function _main
Please help me! Thank you!
here is my code,I haven't complete the code yet
//LargeInt.h My any size integer class header file
#pragma once
#include <iostream>
using namespace std;
template<int i_size>
class LargeInt
{
friend ostream & operator << (ostream &,const LargeInt&);
friend istream & operator >> (istream &,LargeInt&);
public:
LargeInt(int number);
~LargeInt(void);
private:
int size;
int *data;
bool negative;
};
//LargeInt.cpp My any size integer class implement file
#include "StdAfx.h"
#include ".\largeint.h"
template<int i_size>
ostream &operator << (ostream& output,const LargeInt<i_size>& temp)
{
//int counter;
if (temp.negative)
output<<"-";
for (int i=temp.size;i!=0;i--)
output<<temp.data[i];
return output;
}
template<int i_size>
istream &operator >> (istream& input,LargeInt<i_size>& temp)
{
char ch;
int counter = 0;
int *buffer;
buffer=new int[temp.size];
memset(temp.data,0,temp.size);
memset(buffer,0,temp.size);
while((ch = input.get()) != '\n')
{ //loop while they have not entered a RETURN
if( (counter == 0) && (ch == '-') )
{
temp.negative = true;
}
else
{
if((ch >= 48) && (ch <= 57))
buffer[counter] = ch - 48;
counter++;
}
}
temp.size = counter;
i = 0;
for (int i=0;i<counter;i++)
{
temp.data[i]=buffer[counter-i]
}
delete[] buffer;
return input;
}
template<int i_size>
LargeInt< i_size >::LargeInt(int number)
{
int temp;
data=new int[i_size];
memset(data,0,i_size);
negative=(number>0?false:true);
negative=true?number=-number:;
temp=number;
if (number == 0)
{
data[0] = 0;
size = 1;
}
else
{
for(size = 1; ; size++)
{
data[size-1] = temp % 10;
temp = int(temp) / int(10);
if(temp == 0)
break;
}
}
}
template<int i_size>
LargeInt< i_size >::~LargeInt(void)
{
delete[] data;
}
// MyLargeInt.cpp : Defines the entry point for the console application.
// Main test file
#include "stdafx.h"
#include "iostream"
#include "LargeInt.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
LargeInt<60> myi=120;//I want a integer that can hold 60 digit length
return 0;
}
Let's roll!
|
|
|
|
|
Eastdragon wrote:
LargeInt<60> myi=120;//I want a integer that can hold 60 digit length
I didn't really go through your code but I don't think you can assign a number to myi, because LargeInt class doesn't have an assignment operator. LargeInt<60> myi(120) would be the correct syntax (I can't exactly remember how templates work).
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Unfortunately that is the right syntax. In C++ "=" operator cannot be override, and LargeInt<60> myi=120 should call
LargeInt< i_size >::LargeInt(int number)
so that i_size=60 and number=120
My code can be compiled, but has link errors.
Let's roll!
|
|
|
|
|
Eastdragon wrote:
In C++ "=" operator cannot be override
No offense, but where did you hear that?
Eastdragon wrote:
LargeInt<60> myi=120 should call
LargeInt< i_size >::LargeInt(int number)
Sorry, you are right about that (but only in you case). You must provide copy constructors for more complicated classes.
Your code compiles just fine and I don't have any errors. Actually, this line negative=true?number=-number:; gives errors. But then again, you say that you have no errors. Since I don't have a problem compiling your code I don't know what your problem could be. Try to put everything in one file (remove the include directives that are not needed) and see if it works. If it does work then there something wrong with your header declarations.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Toni78 wrote:
In C++ "=" operator cannot be override
No offense, but where did you hear that?
Well,I got to know that "=" cannot be override in MSDN April 2003 CDs.
It's table says:
=, ., ?:, ->, new, is, sizeof, typeof These operators cannot be overloaded.
and the artical's title is "operator overloading, overloadable operators"
Please take a look!
I said vs.net 2003 can compile my code, but have link errors.
Let's roll!
|
|
|
|
|
const CString& operator =(
const CString& stringSrc );
const CString& operator =(
TCHAR ch );
const CString& operator =(
char ch );
const CString& operator = (
LPCWSTR lpsz );
const CString& operator =(
LPCSTR lpsz );
const CString& operator =(
const unsigned char* psz );
No operator= overloading you say? this was taken directly from the msdn online help...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Bob Stanneveld wrote:
No operator= overloading you say? this was taken directly from the msdn online help...
Thank you! For a moment I started to believe that the C++ I learned a few years ago, is not the same anymore.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Thank you very much for your correction.
I just got the wrong link of MSDN article,it's "C# Programmer's Reference" not C++.
Thanks again!
----------
Let's roll!
|
|
|
|
|
|
Thank you! That works. But how could I do if I do want my implement code saved into the .cpp file?
And
negative=true?number=-number:;
is error, do I have to change it to
if (negative)
number=-number;
I think there is a way to use "? :" instead of "if"
Thank you!
--Thomas Wang---
Let's roll!
|
|
|
|
|
|
Thanks!
But does it mean that I have to ship out all my code to the template class user?
Is there any way to hide the implementation code?
Thank you!
Let's roll!
|
|
|
|
|
Eastdragon wrote:
But does it mean that I have to ship out all my code to the template class user?
Yes, you do if they are to use any of your templates. You can have templates in your cpp file no one uses the template outside of the .cpp file.
John
|
|
|
|
|
hi guys
anyone knows how to add new text(string) on a jpeg file without using any image program?
|
|
|
|
|
nobody konws such thing??
i want to add some text in a jpg file in command prompt.
just like this
addtext2jpg jpgfilename textstring positionx positiony
any suggestion?
thanks
|
|
|
|
|
Hi!
I have a lot of files to manange.
I once use a toolbar provided in codeproject to switch cpp and h in vc6.
Is there any method to do it in vc7?
|
|
|
|
|
hi. can anyone tell me how I can get the IP Address and Subnet Mask from within a program?
Basically, I want to get the same info that is returned when I do an "ipconfig" at the DOS prompt.
Much thanks!
Johnny
|
|
|
|
|
GetAdaptersInfo , from the IP Helper API.
If you want IPv6 information (XP and above), look at GetAdaptersAddresses .
|
|
|
|
|
Is there any API function in Unix plateform's C/C++ which can give IP Address of the machine?
|
|
|
|
|
Quite possibly, but I don't know what. Sorry.
|
|
|
|