Click here to Skip to main content
16,009,469 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sharing a HBITMAP between 2 application Pin
Llasus22-Jun-08 20:12
Llasus22-Jun-08 20:12 
GeneralRe: Sharing a HBITMAP between 2 application Pin
SandipG 22-Jun-08 20:32
SandipG 22-Jun-08 20:32 
GeneralRe: Sharing a HBITMAP between 2 application Pin
Llasus22-Jun-08 20:47
Llasus22-Jun-08 20:47 
GeneralRe: Sharing a HBITMAP between 2 application Pin
SandipG 22-Jun-08 20:33
SandipG 22-Jun-08 20:33 
GeneralRe: Sharing a HBITMAP between 2 application Pin
Naveen22-Jun-08 20:55
Naveen22-Jun-08 20:55 
AnswerRe: Sharing a HBITMAP between 2 applications Pin
Hamid_RT23-Jun-08 18:21
Hamid_RT23-Jun-08 18:21 
GeneralRe: Sharing a HBITMAP between 2 applications Pin
Llasus24-Jun-08 20:25
Llasus24-Jun-08 20:25 
Questionbizarre problem with files Pin
lahom22-Jun-08 17:25
lahom22-Jun-08 17:25 
hi
i have aquestion i really need an answer for it because it frustrated me...
look at these two functions:

void CSecondDlg::OnButton1() 
{
	//**BROWSE DIALOG 1**//
	   FILE *fp;
	   FILE *file1 = fopen("file1.txt","w");   //Create txt file for saving editbox content
       int nFileLong;
	   //***********************************************//
       char strFilter[] = { "CPP Files (*.cpp)|*.cpp|All Files (*.*)|*.*||" };
	   CFileDialog m_ldFile(TRUE, ".cpp", NULL, 0, strFilter);
       if (m_ldFile.DoModal() == IDOK)        //Start File dlg box
	   {
       m_sFileName=m_ldFile.GetPathName();    //Get file name
       fp=fopen(m_sFileName,"rb");            //Open file for reading
       fseek(fp,0,SEEK_END);                  //Go to file end 
       nFileLong=ftell(fp);                   //Get length
       char* sText = new char[nFileLong+1];   //reserve string space
       fseek(fp,0,SEEK_SET);                  //Go to file start 
       int i=fread(sText,1,nFileLong,fp);     //Read the characters
       sText[i]=0;                            //Set string terminating null
       m_EDIT1=sText;                         //Put text in Edit box's variable
	   fprintf(file1,"%s\n",m_EDIT1);         //print the content of the editbox into the file 
       fclose(file1);                         //Close file2
	   fclose(fp);                            //Close file 
       UpdateData(FALSE);                     //Force data to go to Edit control
	   }
}

AND

void CSecondDlg::OnButton2() 
{
	//**BROWSE DIALOG 2**//
	   FILE *fp;
	   FILE *file2 = fopen("file2.txt","w");   //Create txt file for saving editbox content
       int nFileLong;
	   //***************************************************//
       char strFilter[] = { "CPP Files (*.cpp)|*.cpp|All Files (*.*)|*.*||" };
       CFileDialog m_ldFile(TRUE, ".cpp", NULL, 0, strFilter);
       if (m_ldFile.DoModal() == IDOK)        //Start File dlg box
	   {
       m_sFileName=m_ldFile.GetPathName();    //Get file name
       fp=fopen(m_sFileName,"rb");            //Open file for reading
       fseek(fp,0,SEEK_END);                  //Go to file end 
       nFileLong=ftell(fp);                   //Get length
       char* sText = new char[nFileLong+1];   //reserve string space
       fseek(fp,0,SEEK_SET);                  //Go to file start 
       int i=fread(sText,1,nFileLong,fp);     //Read the characters
       sText[i]=0;                            //Set string terminating null
       m_EDIT2=sText;                         //Put text in Edit box's variable
	   fprintf(file2,"%s\n",m_EDIT2);         //print the content of the editbox into the file 
       fclose(fp);                            //Close file
	   fclose(file2);                         //Close file2
       UpdateData(FALSE);                     //Force data to go to Edit control
   }
}

as u can see the two functions do the same thing :
open afile into an edit box ....then save the content of the edit box in another file (.txt)
what is bizzare??
well if i open browse1 and browse2 button ...i would find that the first file is created and the second not...(because i hit the button browse1 first).
if i try another time but with hitting browse2 first the opposite thing happend (the second file is changed but not the first )
what is wrong ????
i reaaaly dont know what to do ??
please help me with this
my project stopes on this....
thank u all
AnswerRe: bizarre problem with files [modified] Pin
Saurabh.Garg22-Jun-08 17:58
Saurabh.Garg22-Jun-08 17:58 
GeneralRe: bizarre problem with files Pin
lahom23-Jun-08 6:08
lahom23-Jun-08 6:08 
GeneralRe: bizarre problem with files Pin
Saurabh.Garg23-Jun-08 14:39
Saurabh.Garg23-Jun-08 14:39 
AnswerRe: bizarre problem with files Pin
CPallini23-Jun-08 0:24
mveCPallini23-Jun-08 0:24 
GeneralRe: bizarre problem with files Pin
lahom23-Jun-08 6:10
lahom23-Jun-08 6:10 
GeneralRe: bizarre problem with files Pin
CPallini23-Jun-08 6:42
mveCPallini23-Jun-08 6:42 
GeneralRe: bizarre problem with files Pin
lahom25-Jun-08 6:55
lahom25-Jun-08 6:55 
QuestionRe: bizarre problem with files Pin
CPallini25-Jun-08 11:07
mveCPallini25-Jun-08 11:07 
AnswerRe: bizarre problem with files Pin
lahom25-Jun-08 12:25
lahom25-Jun-08 12:25 
GeneralRe: bizarre problem with files Pin
CPallini25-Jun-08 21:00
mveCPallini25-Jun-08 21:00 
AnswerRe: bizarre problem with files Pin
Kwanalouie23-Jun-08 1:47
Kwanalouie23-Jun-08 1:47 
AnswerRe: bizarre problem with files [modified] Pin
Kwanalouie24-Jun-08 0:24
Kwanalouie24-Jun-08 0:24 
Questionthere is a questioin about function pointer and template Pin
CresShadow22-Jun-08 16:18
CresShadow22-Jun-08 16:18 
AnswerRe: there is a questioin about function pointer and template Pin
Saurabh.Garg22-Jun-08 17:31
Saurabh.Garg22-Jun-08 17:31 
QuestionVisual Studio: Where do I put my stuff? Pin
bkelly1322-Jun-08 16:06
bkelly1322-Jun-08 16:06 
AnswerRe: Visual Studio: Where do I put my stuff? Pin
Saurabh.Garg22-Jun-08 17:39
Saurabh.Garg22-Jun-08 17:39 
QuestionIs it safe to call GetPrivateProfileString in Serialize? Pin
followait22-Jun-08 14:04
followait22-Jun-08 14:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.