|
Hey guys,
I need a class in C++ that represents matrices of floating point numbers and supports addition, subtracion, multiplication and division.
Anthing would help
Thanks
|
|
|
|
|
You know, I don't know if you have access to Google, but if you did, you could type "C++ MATRIX CLASS" into the search box, click the "I'm feeling lucky" button, and get directed to The C++ Matrix class library page.
On that page you can find links to a PostScript file containing some really well-written documentation for the library and to a tgz archive of the library.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Its an MPC application that I've attempted to #include <tlhelp32.h>
Then I basically I want to run this little chunk of code
BOOL ProcessRunning(char* procname)
{
HANDLE hProcessSnap;
HANDLE hProcess;
::PROCESSENTRY32 pe32;
DWORD dwPriorityClass;
// Take a snapshot of all processes in the system.
hProcessSnap = ::CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
if( hProcessSnap == INVALID_HANDLE_VALUE )
{
return( FALSE );
}
// Set the size of the structure before using it.
pe32.dwSize = sizeof( PROCESSENTRY32 );
// Retrieve information about the first process,
// and exit if unsuccessful
if( !::Process32First( hProcessSnap, &pe32 ) )
{
::CloseHandle( hProcessSnap ); // Must clean up the snapshot object!
return( FALSE );
}
// Now walk the snapshot of processes, and
// check each one
do
{
if(strstr(pe32.szExeFile, procname) != NULL){
return( TRUE );
}
} while( ::Process32Next( hProcessSnap, &pe32 ) );
::CloseHandle( hProcessSnap );
return( TRUE );
}
I get the error: "error C2065: 'PROCESSENTRY32' : undeclared identifier" amoung others. I believe this is related to name spaces but what should the name space be and how to I use it? Thanks!
|
|
|
|
|
|
Ok so I've added
#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
so my headers so sit at
#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <direct.h>
#include <windows.h>
#include <tlhelp32.h>
#include "stdafx.h"
plus app specific stuff
but still I get the error C2065: 'PROCESSENTRY32' : undeclared identifier
|
|
|
|
|
Try a complete rebuild, or rebuild after deleting your precompiled header file (*.pch in the output dir)
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
well I moved #include "stdafx.h" to the top of the includes and now it works. How odd. Thank you very much for your advice and patience.
|
|
|
|
|
I am using Visual 2005 C++. I have a data-bound combo-box(using DataSource) and I would like to add one static value to the top list(First Line) before the bound data is loaded in. How can I do this?
I tried it like this.
private: System::Void CComboBoxDlg_Load(System::Object^ sender, System::EventArgs^ e)
{
this->ManufacturerTableAdapter->Insert("All");
this->ManufacturerTableAdapter->Fill(this->brntblManufacturer->Manufacturer);
}
But it dont work bec of Items collection cannot be modified when the DataSource property is set.
I need a solution for this. Thank you
|
|
|
|
|
I am trying to implement some radio buttons in Visual Studio.NET 2003 MFC VC++ 7.1.3088.
On a blank Dialog box I have:-
1. Placed 3 radio buttons and a group box around them.
2. Set tab order button 1, 2, 3 then group box.
3. Set Group property True for button 1 and group box, and False on the other two buttons.
4. Right clicked on button 1 and selected Add Variable
5. Set Category to value.
6. At this point I expected to be able to create a variable of type integer to get which button in the group was selected but can only create a BOOL type variable.
So the question is how do I read the state of my Radio Buttons?
RAL
|
|
|
|
|
ralawrence wrote: So the question is how do I read the state of my Radio Buttons?
Create a control variable for each of the buttons. Trying to fit into the mold that ClassWizard creates can cause headaches.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Create a control variable for each of the buttons.
Thank you for you help. I seem to only be able to create a variable for each button by setting all of them to Group=true and then they do not behave as group buttons. They turn on when you click on them but never go off.
RAL
|
|
|
|
|
You don't need to mess with grouping. Make sure you're creating control variables (should result in a DDX_Control() line in your DoDataExchange() method for each radio button).
|
|
|
|
|
Shog9 wrote: Make sure you're creating control variables
I can create control variables for each button but the radio buttons do not now behave as radio buttons, are you suggesting I add some event handlers to deal with the buttons???
RAL
|
|
|
|
|
Assuming you set up the tab order and grouping as in your first post, they should work just fine. The method you use to retrieve the state of the radio buttons shouldn't affect how they behave.
You can retrieve the state of the radio buttons in several different ways:- Using a control variable for each, call the
GetCheck() method in turn to determine which one is checked. - Using an associated value variable for each, examine each (after calling
UpdateData(TRUE) ) to determine which has the BST_CHECKED state (is checked). - Call
GetCheckedRadioButton() , passing in the IDs of the first and last radio buttons, and recieve the ID of the selected radio button (0 if none are selected).
Notice that there's no DDX_ function for retrieving the ID of the selected radio button, only the checked state of a given radio button.
|
|
|
|
|
ralawrence wrote: I seem to only be able to create a variable for each button by setting all of them to Group=true and then they do not behave as group buttons.
See here for details.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Thanks to everybody for their help. I have got the program working using Control variables with SetCheck and GetCheck. A bit messy but works OK.
RAL
|
|
|
|
|
Hello.
1. How to change in CSplitterWnd actual splitter thickness?
2. Can I put control on the splitter strip (like button or ...)?
Thanks.
|
|
|
|
|
Read through winsplit.cpp (MFC source). You're gonna derive a class from CSplitterWnd , and adjust the width (and handling of mouse clicks or whatever) that way.
You must be careful in the forest
Broken glass and rusty nails
If you're to bring back something for us
I have bullets for sale...
|
|
|
|
|
Thanks.
|
|
|
|
|
Hello guys ,
I am working on a project where I need to implement 'exact' timers , after asking some questions on CP forums and some searching I decided to use multimedia timers.
We know that the main minus of Multimedia timers is that they depend on the 'resolution' of the timer and this 'resolution' is system dependant , so here comes my question : Have you experienced any problems using these timers ? Like there were cases when 'resolution' was too big and the accuracy of the timer was very bad ?.
thanks in advance
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Giorgi Moniava wrote: I am working on a project where I need to implement 'exact' timers...
Which will not be possible unless you are working with a RTOS. You can, however, use the multimedia timers to realize a few ms resolution that is simulated.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Which will not be possible unless you are working with a RTOS
I know that David that is why I had put word exact in '' symbols.
DavidCrow wrote: You can, however, use the multimedia timers to realize a few ms resolution that is simulated.
I know that but I can not for example implement a timer with resolution of
1 Millisecond , because the minimum value of resolution is system dependant.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
I don't know what are you developing/how, but if you in the sepparate !worker thread! you can consider Sleep. Or combiantion Sleep/while/GetCurrentTick
|
|
|
|
|
Hello
I seriously need help on this. Please take time listen to my problem.
We have a SQL 2000 database running for a year. the main table called 'datatable' has grown to 1.8GB. Now we want to change the old database name to a different name without losing all the data in it. We made full backup of the old database and create a new empty database and restore the old database to it.
After I done that the program that populates the "datatable" in the newly restored database always give me error (IDispatch error #3121: [Microsoft][ODBC SQL Server Driver]Timeout expired :Microsoft OLE DB Provider for ODBC Drivers)
when rs->Open("DataTable", _variant_t((IDispatch *)conn,true), adOpenKeyset, adLockOptimistic,adCmdTable); excuted.
I have tried to recreate table index. It still doesn't work.
The datatable has first column "ID" as integer AutoNumber.
If I truncate the table, the program works fine. If I delete most of the data
for example only keep last a few hundred rows, the program also works.
If I don't use rs->open and rs->addNew() method to insert data, instead of using a simple insert SQL query, it works fine.
I believe the problem is that when we do restore something got messed up, but
how? If the datatable is too big and need more time to process when we call rs->open, but why the old database doesn't have this problem. The same program are running on those two databases. Any ideas?
Please help me out.
|
|
|
|
|
Hi,
I would like to ask if someone can help me to resolve the following problem I am experiencing while writing graphical images from an AutoCAD drawing into device context (metafile in a vector format (EMF) ). My C++ code, running on Win32 platforms, is using GDI functionality to create a region, to set the clipping boundary, to draw the (bounding box) border lines and to draw vector duplicates of AutoCAD elements within that bounding box. The resulting EMF file loads into a graphics program (PaintShop Pro 8) for further processing and conversion to a raster image.
The resulting vector images of the elements overlap "dead on" the test images (TIFF) created from screen shots but the viewing window (bounding box) changes its preset size to a smaller one. (Using the "canvas" function, I can resize the windows to its original size without loss of any data or precision.) So far, I could not find where the problem lies that the EMF generated image window is smaller than the preset clipping region.
Here is the skeleton of my code:
HRGN clipReg; // output region
int width; // width of output
int height; // height of output
HDC hdcEMF; // metafile data
HENHMETAFILE hemf; // enhanced metafile
clipReg = CreateRectRgn( 0, 0, width, height ); // int width = 2000, int height = 1500
int ires = SelectClipRgn( hdcEMF, clipReg); // to clip the vectors drawn within the 2000/1500 bounding box
//draw elements
ires = outBoundRect(); // border lines (rectangular bounding box 0/2000/1500)
ires = drawOutput();
// close EMF
SelectObject(hdcEMF, m_oldPen);
SelectObject(hdcEMF, m_oldBrush);
hemf = CloseEnhMetaFile (hdcEMF);
When I open the resulting EMF file, the PhotoShop reports a window size (canvass) of 1924 / 1443 instead of the (to be expected) 2000 by 1500? Can anynone out there help me to resolve this?
Thanks a lot,
Tomas
Tomas
the GDI novice
|
|
|
|