|
Items in a treeview control are identified by a handle (HTREEITEM type).
You can navigate the tree (item handle) heirarchy with TVM_GETNEXTITEM. You can get an items
information with TVM_GETITEM.
Instead of a pointer to an item, you'll probably want to work with a HTREEITEM handle.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank you
--Star
|
|
|
|
|
I'm an odd newbie: I need to compile unmanaged c++ code in VS2005. I've only compiled managed c# in VS'03/'05. What switches do I need to set, and do I need to also do something with the linker.
Thx.
|
|
|
|
|
Just create a C++ Window Application Project.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
You don't need to do anything, the default for the C++ compiler is native.
|
|
|
|
|
#include < stdio.h>
#define N 10
#include < stdlib.h>
#include < math.h>
void insert_array ( long p[] , int nCount , long a ,long b);
double find_values( long p[] ,int nCount );
void print_array1( long p[] , int nCount);
void print_array2( long p[][2] , int fCount);
int main()
{
long n[N];
insert_array( n[ N ] ,N , 1 , 5);
return 0;
}
void insert_array (long p[] , int nCount , int a ,int b)
{
for ( int i = 0 ; i < nCount ; i++)
{
p[i] = a + (rand()%(b-1));
}
}
when i try to compile i have this error :
error C2664: 'insert_array' : cannot convert parameter 1 from 'long' to 'long []'
|
|
|
|
|
found my fault :P n[N] != array :/ its a number i had to use n
|
|
|
|
|
Hi
(Didnt find any discussion board plainly for C++. Found this the closest to send a message on.)
Im writing a code in C++ that reads a text file which is a list of words in the english language. The delimiter i use is a line feed. Being a dictionary, the text file is huge.The compiler i use is TURBO C
My code is to enter a substring from a user and its position(if its prevocalic, post vocalic or inter vocalic) and accordingly feed the words with the substring into an output file.My code works perfect with a small text input file.. i.e a dictioary with a very few entries. How do i make it work for a large size??
Pl help!!
|
|
|
|
|
So what's the problem? Shall I try to guess?
Reading small files is just like reading big files. Or is your dictionary file too big for the whole thing to fit into memory?
Lets say a dictionary has (at a guess) 100000 words. At an average of 10 characters, that's one meg. No problem. Even if you allocate a fixed array to store the words, each element will have to be the length of the longest word, which is ?what? (another guess) 50 characters. So you need 5 Meg of memory to store 100000 words, with a maximum length of 50 characters. Still no problem.
Maybe the problem is to do with your search algorithm.
I'd guess that prevocalic (if that means "the substring is at the start of the word) is straight-forward.
For post vocalic (if that means "the substring is at the end of the word) you might want to have a second copy of your list sorted alphabetically from right-to-left.
I have no idea how you'd search for inter vocalic (if that means "the substring is anywhere in the word.) I guess brute-force and pig-ignorance should do it, but it will be slow!
Did anything here help define your problem better?
|
|
|
|
|
I am trying to make a long number to double ( or that isn't possible? )
compiler throw me 2 errors on s variable (illegal , left operant has type 'double' )
What am I do wrong ? :/ as usually
my code :
double find_values( long p[] ,int nCount )
{
double mid ;
double s ;
for ( int i =0 ; i < nCount ; i++ )
{
mid = mid + p[i];
}
mid = mid/nCount;
for (int z = 0 ; z < nCount ; z++)
{
s = (double) (s + (p[z] - mid)^2);
}
s = (s/(nCount -1))^(1/2);
return (mid,s);
}
|
|
|
|
|
I think even writing double is also not necessary ,compiler will do it for you. error may be due to some different reason.
|| ART OF LIVING ||
|
|
|
|
|
oh yes :/ the error is '^' : illegal, left operand has type 'double'
so its illegal to make power ? ^
|
|
|
|
|
^ is not the raise-to-power operator. Use pow() and sqrt() instead.
|
|
|
|
|
yes thanks i just include math.h and used pow()
|
|
|
|
|
I developed simple print application. But I cannot even see preview as printer is not attached to my pc. If anybody know how to see print preview without printer.
|| ART OF LIVING ||
|
|
|
|
|
|
See I dont want to get out of doc/view arechetecture because my client will have printer attached. And there may be some way out of it. Because just now I came across one ocx which even allows print option without printer,and sends output to bitmap. But it is 199$ so I left it.
|| ART OF LIVING ||
|
|
|
|
|
Why don't you just install a printer driver? You usually don't need the physical printer for that, but it will allow print preview to work. Even better, you can install the same driver your client is using, so you can see how the output will look on their device.
Or am I missing something?
|
|
|
|
|
Thanks a lot your suggestion intutively promising.I will surely try, I think it should work.
|| ART OF LIVING ||
|
|
|
|
|
if there is more than one Mode in this program how to show all ( i mean if the mode like 2222 3333 44 the mode here is 3 and 2 how to make it ..
and the code below find one mode and i want the code find more than one mode
<br />
<br />
int Mode1(int a[],int mode,int freq)<br />
{<br />
int temp;<br />
<br />
mode=a[0];freq=1;temp=1;
for (int i=2;i<10;i++)<br />
{<br />
if (a[i]!=a[i-1])<br />
temp=1;<br />
else<br />
temp=temp +1;<br />
<br />
if (temp > freq)<br />
{<br />
freq=temp
mode=a[i];
}<br />
}<br />
}
<br />
THANK'S FOR ALL ...
To Be Or Not To Be
(KARFER)
|
|
|
|
|
Dear friend
It seems you need to write recursive function. I have written here small snippet
may not exactly match,but I feel it may be useful
for(int i = 2; i < 20;i++)
{
for(int k = i+1; k < 20;k++)
{
if(a[i] == a[i+1])
{
mode = a[i+1];
checkfornext(i+1);
}
}
}
checkfornext(int temp )
{
for(int l = temp+1; l < 20;l++)
{
if(a[temp+1] == a[temp+2])
{
mode = a[temp+2];
if((temp+1) < 20)
checkfornext(temp +1);
}
}
}
|| ART OF LIVING ||
|
|
|
|
|
THANL'S ALOOOT;)
To Be Or Not To Be
(KARFER)
|
|
|
|
|
Hi all:
Below is the codes I wrote:
void append(const char* inputString) {
realloc(ptr, strlen(ptr)+strlen(inputString)+1);
assert(ptr != NULL);
strncat(ptr, inputString, strlen(inputString));
ptr[strlen(ptr)] = '\0';
}
Where "ptr" is of type char*; inputString is merely a pointer pointing to a char string.
It does not seems to work properly. I am wondering why?
Thank you
|
|
|
|
|
Do you need to write it in C ? If not, try using the string class. In any case, never use realloc. Use delete and new, only, in C++. I am not sure if reallocating the memory, doesn't stomp the old values.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
i am trying to find out which column and row i hit, when i made a doubleclick on a cctrllist.
To get the row is no problem, i simply make a hit test with the coordinates of the message source.
DWORD dw = GetMessagePos();
CPoint p(GET_X_LPARAM(dw), GET_Y_LPARAM(dw));
list.ScreenToClient(&p);
int row = list.HitTest(p);
int col = ????
thanks
|
|
|
|