|
Notepad is pretty much a wrapper on top of the edit control. Just use CEditView[^] and you have your Notepad.
|
|
|
|
|
Hi All,
I am working on a tabbed application for my current project.
In the process of development i have see that my application behaves differently if i minimize and maximize the application using the minimize/maximize application button of the window and if i minimize/maximize it by clicking the application icon on the task bar.
what happens:
In the tabbed dialog d1 for a special case i am overlaying another dialog d2 so that i can see d2 only.
if i minimize the application using the minimize button and again maximize using the button, i can see the d2 dialog.
if i click on the application icon on taskbar to minimize and again maximize, d2 dissapers and d1 shows up.
I will appreciate if any one have inputs on this issue.
Kasi
|
|
|
|
|
I hope you are calling SetActivePage( page index) and your code may need to remember which is current active page
HTH
abhi
|
|
|
|
|
Hi guys,
I'm creating a multi-threaded application using _beginthreadex() and _endthreadex() . If my thread executes correctly I call _endthreadex( 0 ) but if it doesn't I call _endthreadex( <some error code> ) . How can I capture the thread's exit code in the main thread?
Thanks.
|
|
|
|
|
|
masnu wrote: If my thread executes correctly I call _endthreadex( 0 )
Just return ing would be the best way to exit a thread.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi Rajesh,
I know that returning from a thread will call _endthreadex() but everything I have read says that "terminating a thread with a call to endthread or _endthreadex helps to ensure proper recovery of resources allocated for the thread". Is it safe to assume that returning will accomplish this?
Thanks,
Paul
|
|
|
|
|
Hi Paul,
masnu wrote: but everything I have read says that
The documentation is confusing (I presume you read the documentation? If there's some other source which recommends _endthreadex instead of just return ing the control, please ignore it. It's wrong). The documentation could have better been:
"Do not call _endthread() or ExitThread() or TerminateThread(), etc., on a thread that was created by a call to _beginthreadex(). That will lead to resource leak. If you have to explicitly "end" a thread that was created by _beginthreadex(), then you should only call _endthreadex(). But just returning from the function is a better alternative." (similarly, _endthread and _beginthread is a pair)
It's been explained very elaborately on the book Windows via C/C++ (and probably in a couple of other books too). I remember Dr. Joseph Newcomer had written on this too, which I'm lazy to search for now.
masnu wrote: Is it safe to assume that returning will accomplish this?
Yes! The resource cleanup will happen perfectly if you simply return the control. To conclude, there's simply no reason to call _endthreadex (or any of their akin functions that explicitly "ends" a thread) from your code. Returning the control is the best thing to do! Let me know if you need more information.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
OK, I just searched Dr. Joseph's article and it's here: http://www.flounder.com/badprogram.htm#AfxExitThread[^] (He's a man that has earned a lot of respect in the community, and he says "Doing this will result in erroneous programs").
Now it's 12.59 AM here and I better hit the bed or I'll wake up late. Good night (probably good day) to you!
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Thanks Rajesh. I appreciate the help.
Paul
|
|
|
|
|
I want to create a custom build configuration that creates an executable that is statically linked to all the run-time libraries. That way I do not need to worry about making sure all the necessary dll's are on the target machine. How do I do that in VS?
Thanks
|
|
|
|
|
Have you looked into project settings? In VS 2008, its' under Configuration properties -> General.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hello everybody !
I don't have this folder("E:\8186") on my computer , How can I solve this error ?
Deleting intermediate files and output files for project 'Test - Win32 Release'.
--------------------Configuration: Test - Win32 Release--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
Test.cpp
TestDlg.cpp
Generating Code...
D:\Project\Test\TestDlg.cpp(349) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'E:\8168\vc98\p2\src\P2\main.c', line 494)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
Test.exe - 1 error(s), 0 warning(s)
|
|
|
|
|
|
thanks !
I google is before,but still have no solution.
|
|
|
|
|
I got this error few days back (because of code base is complied from mapped network drive)
Once network was OK, Rebuilt and done.
.
HTH
Abhi
|
|
|
|
|
No prob, I just thought you might have not.
http://support.microsoft.com/kb/195738[^]
This was just the first hit that I got and I thought it might help.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
Remember facing this before, but can't recall how did it got resolved . Can you try cleaning up the temp files/folder using CCleaner?
-Suhredayan
|
|
|
|
|
I tried ,but failed too...
If I update the Platform SDK Windows Server 2003 R2 ,isn't again ?
|
|
|
|
|
Hi to All,
I have 4 rows of data has to be saved in a binary file system . I haven't use it before, Can anyone please help me with this
EG:
struct A
{
int a1;
int a2;
}
struct B
{
int b1;
int b2;
}
struct C
{
int c1;
int c2;
}
How do I write and read this values from the file system??
-----------------------------
I am a beginner
|
|
|
|
|
You may simply store the struct s as row, binary data. For instance (error checking left to the reader):
struct A
{
int a1;
int a2;
};
A a;
FILE * fp = fopen("data.raw", "wb");
fwrite(&a, sizeof(a), 1, fp);
fclose(fp);
For an object oriented approach see Object Serialization [^](for instance MFC framework supports it).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks for your reply.
But my problem is I have more then 2 structure and I need to search or write at runtime.
-----------------------------
I am a beginner
|
|
|
|
|
You may do a step toward serialization, storing type info just before actual data, for instance:
enum SER_TYPES
{
eTypeI,
eTypeD,
};
struct I
{
int i1, i2;
};
struct D
{
double d1, d2, d3;
};
void store(FILE *fp, I * pi)
{
int t = eTypeI;
fwrite( &t, sizeof(int), 1, fp);
fwrite( pi, sizeof(*pi), fp);
}
void store(FILE *fp, D * pd)
{
int t = eTypeD;
fwrite( &t, sizeof(int), 1, fp);
fwrite( pd, sizeof(*pd), fp);
}
int main()
{
FILE * fp = fopen("data.raw", "wb");
I i,j;
D d,f;
store(fp,i);
store(fp,d);
store(fp,j);
}
On reading, you've to first read the type of the stored data and then, according to the type, read the actual data.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks ,
that's the exact one i was looking for...In fact I dont have knowledge on serialization, But i have also reached t that point..Now I am having problem on reading...
just for ur information.....my incomplete code is given below
I have used class instead of struct
class tableSructureUnknown
{
};
class tableSructure1: public tableSructureUnknown
{
public:
int x;
int y;
};
class tableSructure2: public tableSructureUnknown
{
public:
int x2;
int y2;
};
class listTable
{
public:
int id;
int size;
char tName[20];
};
listTable ArrTableInfo[]=
{
{TFX_TABLE1,sizeof(tableSructure1), "first"},
{TFX_TABLE2,sizeof(tableSructure2),"Second"},
{TFX_UNKNOWN,0,"Unknown"}
};
FILE *ptr_myfile;
int writeToFileTable(int tableId,tableSructureUnknown *lpbaseTableClass)
{
ptr_myfile=fopen("test.bin","w");
if (!ptr_myfile)
{
printf("Unable to open file!");
return 1;
}
for(int i = 0; (ArrTableInfo[i].id != TFX_UNKNOWN) || (ArrTableInfo[i].id != tableId) ;i++)
{
fwrite(&ArrTableInfo[i], sizeof(listTable), 1, ptr_myfile);
ptr_myfile=fopen("test.bin","w");
if (!ptr_myfile)
{
printf("Unable to open file!");
return 0;
}
fwrite(&lpbaseTableClass, ArrTableInfo[i].size , 1, ptr_myfile);
break;
}
fclose(ptr_myfile);
return 1;
}
tableSructureUnknown* ReadFromFileTable(int tableId)
{
for(int i = 0; (ArrTableInfo[i].id != TFX_UNKNOWN) || (ArrTableInfo[i].id != tableId) ;i++)
{
}
tableSructureUnknown* temp = NULL;
return temp;
}
int main(int argc, char* argv[])
{
tableSructure1 Mytable1;
Mytable1.x = 1;
Mytable1.y = 11;
tableSructureUnknown *lpbaseTableClass = &Mytable1;
writeToFileTable(TFX_TABLE1,lpbaseTableClass);
tableSructure2 Mytable2;
Mytable2.x2 = 2;
Mytable2.y2 = 22;
lpbaseTableClass = &Mytable2;
writeToFileTable(TFX_TABLE1,lpbaseTableClass);
-----------------------------
I am a beginner
|
|
|
|
|
I have 2 classes.
Class A:
void CDbModReactor::objectModified(const AcDbDatabase* pDb,
const AcDbObject* pDbObj)
{
AcAxDocLock docLock(pDbObj->ownerId(), AcAxDocLock::kNormal);
if(docLock.lockStatus() != Acad::eOk)
return;
else
gpDlg->OnCopy2Excell("modified", pDbObj);
}
Class B:
void CSampDialog::function1()
{
FILE * pFile;
pFile = fopen ("C:myfile.csv","a");
if (pFile!=NULL)
{
CString x2 = Cent_X+","+Cent_Y+"\n";
fwrite(x2, x2.GetLength(), 1, pFile);
fclose (pFile);
}
}
Now i have to call the function void CDbModReactor::objectModified(const AcDbDatabase* pDb, const AcDbObject* pDbObj) from void CSampDialog::function1()
How can i call...
Please help me...
G.Paulraj
|
|
|
|
|