|
Cause, if I delete the corresponding array item, all others will keep their index for the array, not like the listbox. If it would change its index just like the listbox does, there wouldnt be any problem! And I dont think that you can simply change the indizes of a structure array! Correct me if I am wrong.
DKT
|
|
|
|
|
Yes, you have to take the pain of removing the corresponding structure from the array and shift all the below structures up and update the array count variable.
MFC provide collection class to do this for you CArray, CMap etc.
A better solution will be to use CMap and map the structure with the listbox text. But for this to work nicely there should be no repetations in listbox contents.
There is no spoon.
suhredayan
|
|
|
|
|
What excatly do you mean by mapping the structure with the listbox text?
I will work on that CMap class, and hope to find some useful information.
Thanks for pushing me in the right direction, and it would be nice if you could explain me the question above!
EDIT: If I am right, this class will connect an ID with another, chosable, ID. That seems to be like the SetItemData function for listbox entries, is that correct? What is more useful? I am using this function right now, and its eehm, yeah, like a little, not that fine, workaround for the problem...
DKT
|
|
|
|
|
what I do is create each structure on the heap, and store its pointer for the itemdata. I also put the pointers in a vector container. this way, I can cast the itemdata of an item back to a pointer of my type of struct or class, and delete items whenever I need to. The only thing is making sure that you have some type of cleanup routine in the class that's using the vector, to iterate through the collection and call 'delete' on each element.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
BlackDice wrote:
what I do is create each structure on the heap, and store its pointer for the itemdata.
I concur. This is just the natural way of dealing with listbox data.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
you need to manually synchronize your "internal array" with the listbox.
I would suggest that you change your "internal array" to something else, like a vector or a list ( either plain MFC or STL ); those will "compact" themselves if you remove an element; if you remove element 5, there will not be an empty space between 4 and 6 ( something like that ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
If this is true for vectors, then i will give it a try with vectors!
I hope this will work better.
Thank you.
DKT
|
|
|
|
|
hai,
i am developing a chat application in turbo c.i used bioscom function to set the port settings and to transmit the data,but iam unable to transmit the data.
the prog is :
bioscom(0,settings,com1);
bioscom(1,n,com1);
'n' is the data which i am transmitting.
but the data is not getting displayed in the hyperterminal of another system.
plz guide me regarding this .
plz reply as soon as possible.
from
narasimha varma p
|
|
|
|
|
What are you using to transmit the data?.. serial cable, modems? Have you confirmed that the hardware is configured correctly by opening a hyperterminal session on the transmitting PC and sending test data to the receiving PC using the same settings as you use in your program? You must make sure that the ports and hardware (serial cable or modems) are properly configured first. Then, if your program still does not work, start looking at the code for errors.
Roger
|
|
|
|
|
i am using null modem cable for the transmission of data.through hyper terminal the data is getting transferred and recieved.but not happening through my program any way i am writing my code down to this matter if possible plz help me to solve this problem
my program is as follows:#include<conio.h>
#include<bios.h>
#include<stdio.h>
#include<dos.h>
#define COM1 1
#define SETTINGS (0x80 | 0x02 | 0x00 | 0x00)
void transmit();
void display();
void main()
{
clrscr();
transmit();
}
void transmit()
{
char msg,msg_in;
int status,out,in,count=0,count_in=0,i,extra;
int x,y,n;
x=bioscom(0, SETTINGS, COM1);
bioscom(3,0,COM1);
n=x;
printf("\n the status in binary is:");
while(n!=0)
{
printf("%d",(n%2));
n=n/2;
}
msg=getche();
bioscom(1,msg,COM1);
printf("\n %d",x);
window(10,10,40,11);
/* while (1)
{
if (kbhit())
{
gotoxy(count+1,1);
if ((in = getche()) == 27)//if esc is pressed then exit
break;
if(in==0)
{
in= getch();
continue;
}
if(in==8 && count>0) { count-=2;cprintf(" \b");}
else msg[count]=in;
if(count==70) {in=13; msg[70]=13;}
count++;
if(in==13 )
{
i=0;
display(msg,14);
for(i=0;i
|
|
|
|
|
Hey, been awful busy this week and didn't notice that you replied.
Check your parameter to bioscom. I think COM1 should be defined as 0 and COM2 would be 1. Your library implementation may be different.
You should be passing 3 for the first argument to obtain the status, not 0.
Take a look at this page for a complete discussion on bisocom...
http://www.funducode.com/freec/Hardware/new_hi_c02/Article02.htm[^]
Roger
|
|
|
|
|
Hi all,
I am in embedded vc++. How to draw a line with line caps like Circle end, Arrow end, Diamond end and so on. I am trying to do in an GDI application.Can anyone help me to do.
Warmly
Darwin S.
DARWIN PAUL RAJ
|
|
|
|
|
Hi all,
Still I didn't get any solutions for the problem. can anyone help to find out the solution for this.
DARWIN PAUL RAJ
|
|
|
|
|
Would you please explain it briefly?
A Journey of thousand miles must begin with a single step.
|
|
|
|
|
FYI I've ONLY written 6 programs in my WHOLE life
So this is what is going on.
function is ln(x^2)=.07
Lower x is .5, Upper x is 1
Gotta find the root...here is the program
#include <iostream>
#include <iomanip>
#include <cmath>
void bisection (double, double, double);
double f(double);
int main()
{
double xl=0.;
double xu=0.;
double xr=0.;
cout<<"Enter a lower number and an upper number:"<<endl;
cin>>xl>>xu;
bisection (xl, xu, xr);
return 0;
}
void bisection (double xl, double xu, double xr)
{
int i=0;
double func1=0.;
double func2=0.;
double func3=0.;
func1= f(xl);
func2= f(xu);
xr=(xl+xu)/2.;
if (func1*func2>0.)
{
cout << "Warning: No root exist"<< endl;
}
else
{
for (i=1; i<7; i++)
{
func3= f(xu);
}
if (func1*func3<0.)
{
cout<<"root lies in lower subinterval"<
|
|
|
|
|
(Hi shorty02br, next time please check the "Do not treat <'s as HTML tags" checkbox before submitting your post so that angle brackets show properly.)
Starting from the '98 C++ standard, cout (and most other runtime library identifiers) are into namespace std . Write std::cout instead and things should be fine. If you don't know what namespaces are, I suggest you goggle for some tutorial, the concept is very simple anyway.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Thank You.
I'm so stupid. i KNOW what name space is. The whole using namespace std;....i don't know what i was thinking. Thank you so much.;)
|
|
|
|
|
Hi,
We are using pervsive database.To run our application we have have to map that server and from that location only we can able to run our application.Initially to run our application we have to register all necessary ocx controls.
But the problem is to archive or some other reason they are changing the servers.At that time again we have register our application.
Can't we register ocx controls in common locations i.e independent of servers.
If anybody know please help me..
Thanks
Kumar
|
|
|
|
|
i'd think not, i would have thought that the ocx file needs to be registered on the computer thats using it
Unless you have one pc with ocx's and write some sort of remote accessing software. - dcom corba or the like.
bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
Hi All,
I trying to create temporary storage using the following code:
LPSTORAGE lpTempStorage;
sc = ::StgCreateDocfile(NULL, STGM_DELETEONRELEASE|STGM_READWRITE|STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_CREATE, 0, &lpTempStorage);
However, it always return STG_E_MEDIUMFULL. From documentation STG_E_MEDIUMFULL means that there is insufficient space to complete operation. I am just wondering, what I did wrong?
It was working before and just suddenly throws an error. The free diskspace is still plenty (about 4Gigabytes). Any idea what goes wrong?
Thanks...
Samin Thomas
|
|
|
|
|
I am develoing one application which is fully depend on system time. But as i cannot restrict the system users from editing the system time, it will cause problem to me.
Is there any way from the application to trap the reseting the system time.
Ranjish
|
|
|
|
|
check for WM_TIMECHANGE message in msdn.
There is no spoon.
mail
|
|
|
|
|
Suhredayan,
But my question is how I can monitor when ever another application or user updates the sytem time
|
|
|
|
|
Ranjish,
WM_TIMECHANGE message is broadcasted to all top-level windows by any application which updates the system time. So if you write an application which can recieve top-level window messages and handle WM_TIMECHANGE message out there, then you will also get notified on system time update.
There is no spoon.
suhredayan
|
|
|
|
|
If the users PC has a Internet connection you could query Internet Time Server (NNTP I think this is). You can also get time info from HTTP requests.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|