|
I want to exact installation root of my MFC application as a CString format.
Like str="D:\Program Files\Test\test.exe"
How can i do it? Or how can i can find root of my MFC EXE program.
Mehdi Hosseinpour
|
|
|
|
|
CString tmp;
TCHAR* ptr = tmp.GetBuffer(_MAX_PATH);
::GetModuleFileName(AfxGetApp()->m_hInstance, ptr, _MAX_PATH);
tmp.ReleaseBuffer();
should do it.
Steve S
|
|
|
|
|
Hello.
well i just want to ask if anyone of you knows the implementation of solving system of linear equations by using Gauss-Jordan elimination method ( or known as reduced row echelon form ) since i need some help for my assignment.
best regards.
|
|
|
|
|
You can find the implementation of solving a linear equation pair with the Gauss-Jordan method from this page: http://www.sks99.com/ch9/gauss/defg.htm
As for the actual implementation, take a piece of paper, and write down all the intermediate calculations, then take a moment to consider how you could represent it in the C/C++ -environment. For example, if you create a program that asks as an input on the equations, or more easily, their coefficients, you can instantly write a matrix. Then follow the implementation guide, and perform similar operations on the computer matrix, as you would into a real matrix.
Remember, that computer matrixes and real matrixes tend to handle direct operations differently. Consider writing a set of functions that allows you to do matrix addition, difference, multiplication and division operations. Do not do a direct addition, as it might lead into wrong results.
As this is an assignment, I cannot give you direct code, but I can help you on by saying that a number matrix in C++ can be represented by a declaration such as int matrix_1[col][row] . Use this as a base in creating the coefficient matrixes, then just do the same calculations as the page I posted earlier. Dynamic arrays cannot be used, so you either need to create a big matrix then designate by a number of how many rows/cols are valid, or leap over to the STL routines, from which I have no experience.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
There are a lot of linear algebra C++ libraries, for example BLAS. Try google "linear algebra c++ library".
Robert-Antonio
It's a good luck, when you meet a real fink. Then you get a respect to
normal, mid-honest people."
|
|
|
|
|
I have an MFC dialog which is built over a layout-engine.
This dialog also contains many owner-drawn controls.
When you popup the app and start resizing it quickly, everything looks good, responds fast, cleans-up, no window trails.
After 3-4 seconds of quick-resizing, the application begins to stall and leave-trails on the screen.
I've been trying to disable things to try and find out whay may eb causing this sudden performance-degrading... but to no avail.
Perhaps this could be a bad case of no releasing DCs ? or some other male-functioning with Graphic Objects ?
Does anybody have an idea ?
|
|
|
|
|
Hi dear gurus. I am using CListCtrl in Report view, and there is one thing I'd like to try out. Is it possible to enter multiple lines of text into one single cell? I mean, if the length of the text exceeds the length of the row it gets truncated and appended with "..." or the List Control gives you a hori scroll bar to play around with.
What i am thinking about is making the word appear in the next line, but stay in the same row...
Visual example
(without word wrap)
-------------------------------
| I got too much crap in my...|
-------------------------------
| Something else |
-------------------------------
(with word wrap)
-------------------------------
| I got too much crap in my |
| brains and I don't know |
| wat to do with it. |
-------------------------------
| Something else |
-------------------------------
Can this be done? Do i need to override the DrawItem fucntion?
|
|
|
|
|
Hi~ all.
I'm in the middle of writting a simple serial comm app but there's a Question I can't understand.
In my code, just simple data communication is OK. But when I wanna make more fast data exchange in short that make a little problem. Two program A, B can communicate well with a simple line, but to make fast and recursive data communication I made a thread that writes a data line to serial port. (Thread function In B that write 8 bytes string data expecting 14 bytes reply.) If time delay between two *sending* data string is long ( 3 secs ) send and reply is OK. However if I make the delay to be short ( 2 or 1 sec ) A works all right, and B doesn't. B cannot read any data.
Between A, B there's no difference except B has a recursive writing function in thread. So I wander whether writeing to port makes a effect to reading from that one or not.
Anybody can tell me a good solution?
Sorry for my poor English.
And Thanks in advance.
|
|
|
|
|
I have not done serial communication programming so i dont know the exact solution but here is a lead.
You cant wirte to the port as and when you want it. before writeing you need to cheack the port status wheather it is ready to send any data, then you should write any data to the port.
Using the method you can avoid the unwanted delay(sleep) in ur code.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Thanks.
But the delay I mean is my own setting one with Sleep(); and checked port status, too.
End of this, I'll include the code used. If I use 'Sleep(3000)' in thread function(StartThread) communication is looked OK. But if I use 'Sleep(1000)', communication is to be broken. B cant receive any data just because of shortened Sleep() time. Two programm A, B use normal serial communication routine, and B has one more thread function as following.
In StartThread 'm_Port' is CSerial Class obejct.
Again, Thanks a lot anyway.
UINT CNewParkDlg::StartThread(LPVOID param)
{
THREADSTRUCT* ts = (THREADSTRUCT*)param;
CString strPoll;
strPoll = (CString)STX + "N1PL" + (CString)ETX + "60";
int nSize = strPoll.GetLength();
while(true) {
// Display to ListBox
ts->_this->m_pListBox.InsertItem(0, strPoll);
ts->_this->m_pListBox.SetItemText(0, 1, "Send");
ts->_this->m_Port.WriteComm((BYTE*)(LPCTSTR)strPoll, nSize);
// Sleep(1000);
Sleep(3000);
}
return true;
}
typedef struct THREADSTRUCT {
CNewParkDlg* _this;
} THREADSTRUCT;
DWORD CSerialPort::WriteComm(BYTE *pBuff, DWORD nToWrite)
{
DWORD dwWritten, dwError, dwErrorFlags;
COMSTAT comstat;
int n;
n = WriteFile(m_hComm, pBuff, nToWrite, &dwWritten, &m_ovrWrite);
if (!n) {
if (GetLastError() == ERROR_IO_PENDING ) {
while ( !GetOverlappedResult(m_hComm, &m_ovrWrite, &dwWritten, TRUE) ) {
dwError = GetLastError();
if (dwError != ERROR_IO_INCOMPLETE ) {
ClearCommError(m_hComm, &dwErrorFlags, &comstat);
break;
}
}
}
else {
dwWritten = 0;
ClearCommError(m_hComm, &dwErrorFlags, &comstat);
}
}
return dwWritten;
}
|
|
|
|
|
Hi~
In ITU, it needs money to order the jpeg specification! So, do you know where
can I get the jpeg specification??
If you know or you have these specification? Please let me know!
thanks.....
Keven
|
|
|
|
|
|
Dear Ian:
I got it!
Thanks a lot~~~
keven
|
|
|
|
|
Here's another spot:
http://www.wotsit.org/
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Dear David:
It is useful to me! Thank you~~~
keven
|
|
|
|
|
Hi..
How can i applying video compression in AVI File. Any pre defined classes in VC++ or windows . Please help to slove the problem.
Thanks and Regards
Karthi
|
|
|
|
|
There is an API: Video Compression Manager, specifically see the example on Compressing Data. It shows a very brief example of compressing image data for AVI files.
You can also use other techniques to stream video into an avi encoder. A really good encoder can be found (with source) at http://www.xvid.org.
|
|
|
|
|
Hi guys,
I'm working on an email application similar to outlook express. I have problems converting the formated text in rich edit to the HTML format, I can convert it to RTF but I'm stuck there...
Should I use other controls like DHTML (which I Know Nothing About) instead of rich edit control. I think rich edit is perfect for my application but how am i going to convert it to HTML?????anyone knows a solution for this... would be a great help..
thanks...:
|
|
|
|
|
I belive there is no standard means of converting an rtf file to html, There are lot components available on the net to do the same.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hello all
I want to modify the open dialog box in the OnOpenDocument function. It is showing "All Files" by default. I want to know more about this function.
Thanks in advance.
|
|
|
|
|
If you're using MFC, the document templates which are part of your application and which are registered are used to build the filter in the open file dialog. The best way to learn about MFC is to dig here. You can also learn all about CDocument::OnOpenDocument there.
OnOpenDocument does not actually create the dialog box you're asking about. It is a result of MFC mapping the extension to one of your registered document templates after the user selects a file. To learn about the dialog, refer to CFileDialog.
You can learn about how the MFC document, view, and application classes relate by reading TN025: Document, View, and Frame Creation.
|
|
|
|
|
Check out CDocTemplate::GetDocString() , and the IDR_MAINFRAME resource in the string table.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Does anyone know how to programmatically obtain the number of bytes received and transmitted on a network (dial-up or lan) connection ?
I appreciate any help - thanks DW
|
|
|
|
|
|
Is there a simple function call that will do the following.
Say i have 3 edit boxes side by side for the purpose of a ticket number.
and i have my user enter one number at a time for instance 1 2 3.
How can i make it jump (tab) to the next box on input? Like if he/she enteres 5 it will jump to the next box waitin input then you enter 6 it goes to the last box. I know it can be done cause i see it on webpages alot. Just not sure how to do it. thanks
Win32newb
"Making windows programs worse than they already are"
|
|
|
|