GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-May-2004, 08:46
vadharah vadharah is offline
Junior Member
 
Join Date: Apr 2004
Posts: 45
vadharah is on a distinguished road

Embedding a VRML Frame to an MFC Visual c++


i have a program in visual c++ which clusters numeric data and intend to show the results using VRML. any ideas of how i go about it?
  #2  
Old 13-May-2004, 02:11
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
I'm Sorry.This is something that I have no knowledge of. Maybe you could explain to me what is a VRML?? I want to help, but not knowing what exactly you want to do??
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #3  
Old 13-May-2004, 02:41
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
I did some search on VRML, here is what I got:

Search Result

I don't know if this what youre looking for, sorry that I lack knowledge and can't be of help to you!!
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #4  
Old 13-May-2004, 08:15
vadharah vadharah is offline
Junior Member
 
Join Date: Apr 2004
Posts: 45
vadharah is on a distinguished road
Quote:
Originally Posted by Max Payne
I did some search on VRML, here is what I got:

http://www.codeproject.com/info/search.asp?cats=2&cats=3&cats=4&cats=5&searchkw=vrml&author=&sd=11%2F15%2F1999&ed=5%2F13%2F2004

I don't know if this what youre looking for, sorry that I lack knowledge and can't be of help to you!!

i will keep on looking into that one. at the moment i have a problem. i want to tokenise CString in the MFC . i tried this code but it seems the program does not even realize the "token.h"
CPP / C++ / C Code:
#include "token.h"

void My_KDlg::Tokenise()
{
	vector <int> V;
int h;
	CString m_Specifc;
	CString newTok;
	CToken tok(m_Specifc);
	tok.SetToken(" ");
	while(tok.MoreTokens())
	{
	    h = atoi(tok.GetToken());
                 v.push_back(h);
	}

}


it is a string of integers and want to store them in a vector/array
  #5  
Old 13-May-2004, 22:26
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
What is the problem? Header file 'token.h' not found? what CToken do???

Here is some code to tokenize a string:
CPP / C++ / C Code:
vector <int> V;

char fileName[] = "t1/t2/t3/t4", *tok;
char delim[] = "/";

/* tok tokenized */
tok = strtok( fileName, delim );

while(tok != NULL){
printf( "%s\n", tok );
int h = atoi(tok);
V.push_back(h);

tok = strtok( NULL, delim );
}
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #6  
Old 13-May-2004, 22:51
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
tkenize a cstring:

CPP / C++ / C Code:
CString str="t1 t2 t3 t4";

CString tok;

int s=0,e=0;

while(e != str.GetLength ())
{
e=str.Find (" ",s);
tok=str.Mid (s,e-s);
s=e+1;
MessageBox(tok);
}
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #7  
Old 24-May-2004, 22:37
vadharah vadharah is offline
Junior Member
 
Join Date: Apr 2004
Posts: 45
vadharah is on a distinguished road
Quote:
Originally Posted by Max Payne
tkenize a cstring:

CPP / C++ / C Code:
CString str="t1 t2 t3 t4";

CString tok;

int s=0,e=0;

while(e != str.GetLength ())
{
e=str.Find (" ",s);
tok=str.Mid (s,e-s);
s=e+1;
MessageBox(tok);
}
max i have tried to implement the code u gave me but it doesnt seem to be working or am i making a mistake whenever i click the button to call the function the dialog freezes and stops. i enter several numbers into a text box and intend to tokenise the string and convert the values to double. this is what i have for now:
CPP / C++ / C Code:
void Key::Wrte(CString S)
{
	vector <int> A;
	ofstream resultFile;

	resultFile.open("result.txt");

	if (!resultFile)
	{
		MessageBox(NULL,"haibende result!!", NULL, NULL);
		exit(1);
	}
	
	CString tok;
	int x, j;
	int s=0,e=0;

	int i = 0;
	
	while(e <= S.GetLength ())
	{
		e = S.Find(",",s);
		tok = S.Mid(s,e-s);
		s=e+1;
		x = atoi(tok);           //converting to double
		resultFile<<x<<"	"<<endl;         //writting the double

	}
	
}
  #8  
Old 24-May-2004, 23:10
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
Sorry, I didn't realize this, its freeze cause it will enter an infinite loop...this is because the Find() funtion will keep looping the string and did not end when it reaches the end of the string..
so put a break in the end of while::
CPP / C++ / C Code:
void Key::Wrte(CString S)
{
  vector <int> A;
  ofstream resultFile;

  resultFile.open("result.txt");

  if (!resultFile)
  {
    MessageBox(NULL,"haibende result!!", NULL, NULL);
    exit(1);
  }
  
  CString tok;
  int x, j;
  int s=0,e=0;

  int i = 0;
  
  while(e <= S.GetLength ())
  {
    e = S.Find(",",s);
    tok = S.Mid(s,e-s);
    s=e+1;
    if (s<=0)//break when loop returns to the start
        break;
    x = atoi(tok);           //converting to double
    resultFile<<x<<"  "<<endl;         //writting the double


  }
  
}
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #9  
Old 26-May-2004, 04:53
vadharah vadharah is offline
Junior Member
 
Join Date: Apr 2004
Posts: 45
vadharah is on a distinguished road
Quote:
Originally Posted by Max Payne
Sorry, I didn't realize this, its freeze cause it will enter an infinite loop...this is because the Find() funtion will keep looping the string and did not end when it reaches the end of the string..
so put a break in the end of while::
CPP / C++ / C Code:
void Key::Wrte(CString S)
{
  vector <int> A;
  ofstream resultFile;

  resultFile.open("result.txt");

  if (!resultFile)
  {
    MessageBox(NULL,"haibende result!!", NULL, NULL);
    exit(1);
  }
  
  CString tok;
  int x, j;
  int s=0,e=0;

  int i = 0;
  
  while(e <= S.GetLength ())
  {
    e = S.Find(",",s);
    tok = S.Mid(s,e-s);
    s=e+1;
    if (s<=0)//break when loop returns to the start
        break;
    x = atoi(tok);           //converting to double
    resultFile<<x<<"  "<<endl;         //writting the double


  }
  
}
hi max, how have u been?. just a quicky .any idea how i can display data on the gray area on my single document interface. i mean the one which is clear when u run it. how do i write data on that big white space?
  #10  
Old 26-May-2004, 05:24
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
Quote:
Originally Posted by vadharah
hi max, how have u been?. just a quicky .any idea how i can display data on the gray area on my single document interface. i mean the one which is clear when u run it. how do i write data on that big white space?

Well, that big white space is called 'view' and you can choose the type of view you want when u create the new project, its in the last option of the wizard. By default, your view is CView, There are many other view class to chose from, like the CEditView or CRichEditView where u can type text in the view and thats the first step to make a notepad or wordpad like program. There is also CHTMLView which can be like a web browser, and using this view, you can meke your own web browser.... and there are many more.. check out MSDN.

So, after all the explanation on those different kinds of views, U still want to output text in your CView?? Then, use OutputText(...) and put it in the OnPaint message...

[\C]
void CYourSDIView::OnPaint()
{
CPaintDC dc(this); // device context for painting

// TODO: Add your message handler code here
CClientDC pDC(this);
OnPrepareDC(&pDC); // Get origin adjusted
TextOut(pDC.GetSafeHdc(),1, 2, "HELLO", 5);// and output text
}
[c]
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
 
 

Recent GIDBlogStupid Management Policies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual C++ Edge Detection surgio MS Visual C++ / MFC Forum 5 26-Mar-2005 02:46
Intel Compiler C++ for Embedded Visual C++ kiara C++ Forum 1 15-Jan-2004 10:56
Convertin C++ to eMbedded Visual C++ kiara C++ Forum 0 14-Jan-2004 02:05
Convertin C++ to eMbedded Visual C++ jbalart C++ Forum 0 23-Dec-2003 07:44
Side bar frame? Plz help! Coatesy Web Design Forum 3 06-Sep-2003 12:59

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:05.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.