|
You can use ClistCtrl i think its better but for image in listbox seeHere[^]
whitesky
|
|
|
|
|
hello sir
thanx for replying but not getting how to make the multicolum listcntrl.
& how can i add both string and image simultaneously.
plz tell me thanx
|
|
|
|
|
SeeInsertItem and InsertColumn in CListCtrl
whitesky
|
|
|
|
|
aavesh wrote: thanx for replying but not getting how to make the multicolum listcntrl.
Use the LVS_REPORT style.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi there,
as you can see i'm new to these forums so go easy on me
I've been programming in C for a couple of years now and have recently moved onto C++. I am now undertaking a project to design control software for pipeline inspection tractors / vehicles where by i am now teaching my self Visual C++ (Using Microsoft Visual C++ 2005 express). Now i am far from an expert in C++, so VC++ is prooving to be rather difficult.
One thing i am trying to do is set a routine at the beginning of the programme to read a set of data from a collection of objects from a header file.
#include <string>
using namespace std;
class TRACTOR
{
public :
char name[40];
int bristles, pistons;
TRACTOR();
TRACTOR( char _name[40], int _bristles, int _pistons);
};
TRACTOR::TRACTOR (char _name[40], int _bristles, int_pistons)
{
strcopy(name, _name);
bristles = _bristles;
pistons = _pistons ;
}
TRACTOR DPT_1("8 inch", 3, 2);
TRACTOR DPT_2("10 inch", 4, 3);
I am trying to set a routine to read the name value of each object into a combo list at the start of the programme (so that the tractor_types.h file can be quickly edited to add / remove / alter tractor properties).
I would also like to be able to display the chosen type of tractor in a label, but i keep getting errors telling me that the compiler is unable to convert char* to System::string... or something like that.
Finally... and my apologies for such a long first post.
parallel port access in Visual C++... how? i have had the entire process working in C++ compiled with Dev, using inout32.dll but have been unable to port this across to the visual c++ standard.
Any help in this would be greatly appreciated!
Mark
-- modified at 7:59 Friday 7th July, 2006
|
|
|
|
|
markwalker84 wrote: ...pipeline inspection tractors / vehicles...
I worked for a company once that called these things "pigs."
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yeah - thats the slang term for them here - but i thought if i started talking about hooking PIGs up to comuters and writing programmes to control them people might start thinking i was a bit weird and get the RSPCA involved! hehe
|
|
|
|
|
Hi Mark,
First, you'll get *much* more out of C++ if you don't just use it as a fancy C. For instance, most people wouldn't make member variables public. There is also, at least among people who grew up with win32, a naming standard that prefixes C to class names and m_ to member variables. It just helps other people reading your code to see what's what.
In any case, I would personally do something like this:
if you have, say, 30 saved tractors:
unsigned int nTractors = 30;
std::string tractorNames[ 30 ];
int bristles[ 30 ];
int pistons[ 30 ];
CTractor* tractors = new CTractor[ nTractors ];
for(unsigned int x=0; x< nTractors; x++)
tractors[x].setData( tractorNames[ x ], bristles[ x ], pistons[ x ]);
delete [] tractors;
Then for win32 stuff that takes LPCTSTR, you can use std::string.c_str() (assuming that the windows function copies your string into internal storage).
As for your dll, what exactly is the problem?
earl
|
|
|
|
|
Thanks for the reply there!
I see what you mean about C++ not just being a fancy C...
Thanks for the pointers there as well - I will have another crack at it today.
As for the dll stuff... i am trying to enable read / write access to the parallel port. I had a console application working (with DEV (Bloodshed) C++ editor) which required inout32.dll to be placed in the system32 folder, and then with the use of a couple of special function calls the enitre process of parallel port access was very straight forward.
The problem was that when i ported that application across to VC++ it stopeed working. i more or less copied and pasted my entire code into the 'action' of a button press. The programme compiled and ran, but clicking the button (which should have simply sent 0x255 to the parallel port) crashed the programme.
Once again, thanks for the help so far - very much appreciated!
Mark
|
|
|
|
|
First, dlls will also be loaded from the working directory. Be aware, however, that in Visual Studio projects are typically organized as a directory and that while <projname>\debug and < progname >\release are the two directories containing the debug and release builds, respectively, the working directory is set to just <projname> . So you should just be able to put that dll into the project directory.
As for the code you pasted, how are you loading the dll? Run time via a lib or run time via LoadLibrary / GetProcAddress? Are you getting valid function pointers? What exactly is crashing? What line? Do you get errors beforehand?
earl
|
|
|
|
|
hi
i made a dialob box now i wnat to put a wallpaper on it from drive d
but i also want that when i put wallpaper then the buttons or other controls which i put on dialog box remain same and they appear over the wallpaper but
only with there value on it as in widows xp
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
for load image use CImage and use Load for darw picture you can use WM_PAINT or WM_WM_ERASEBKGND dc.BitBlt(...);
<br />
CImage m_Image;<br />
m_Image.Load(filename);<br />
in Onpaint use <br />
Bitblt(dc.m_hdc,0,0,800,600,m_Image.GetDC(),0,0,SRCCOPY);<br />
i dont test this code
whitesky
|
|
|
|
|
thanks for your reply
i put this code in oninitdialog()
CImage m_Image;
m_Image.Load(filename)//can i put filename as path of that wallpaper or wallpapers name);
and put this in onpaint
Bitblt(dc.m_hdc,0,0,800,600,m_Image.GetDC(),0,0,SRCCOPY);
but this gives errors as Bitblt undeclared identifier
and CImage as undeclared identifier
Ashish Dogra
MCA
Noida
|
|
|
|
|
BitBlt and include AtlImage.h
whitesky
|
|
|
|
|
plz tell me how to handle this problem
thanks but by including #include "AtlImage.h"
there is an error that is
fatal error C1083: Cannot open include file: 'AtlImage.h': No such file or directory
and plz tell me on filename i use thats path or simply wallpaper name
Ashish Dogra
MCA
Noida
-- modified at 8:44 Friday 7th July, 2006
|
|
|
|
|
if you get this error maybe you dont have this file in your computer and use AtlImage with <> but if you using <> if your file is Bmp you can use LoadImage but your file is jpg you can use Graphics::DrawImage and Image::FromFile or you can use OleLoadPicture
whitesky
|
|
|
|
|
ashish dogra wrote: but this gives errors as Bitblt undeclared identifier
and CImage as undeclared identifier
This should come as no surprise since Bitblt() is different than BitBlt() . m_Image is local to the OnInitDialog() method so there is no way that it can be used on the OnPaint() method.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello Mr DavidCrow,
I think his problem is AtlImage.h
whitesky
|
|
|
|
|
yar dont argue with each other
and if you can solve my problem then do it plz
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
I said you in previous message and you can choose one way from they
whitesky
|
|
|
|
|
Hello, anyone knows what this message means? warning C4996: 'fopen' was declared deprecated
|
|
|
|
|
deprecated = something that is planned to be removed in the future
usually when you see that message, the compiler suggests am alternative call. (fopen_s is the replacement for fopen, i think)
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
is there a way to count words in a string the same as .GetLenght(hello) = 5 i need a way to count the words in a string = 11.
|
|
|
|
|
Words in a string means? Distinct number of words, separated by spaces? You can find out the number of spaces in your string and then add one to this count. It will be the number of words.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
loop through every character in the string and count the characters which separate words (white-space, punctuation, etc) . actually, it's probably easier if you just count the number of times a letter (or number?) comes after whitespace or punctuation.
Cleek | Image Toolkits | Thumbnail maker
-- modified at 7:49 Friday 7th July, 2006
|
|
|
|