|
ShellExecute(handle, "notepad", filename, NULL, NULL, SW_SHOWNORMAL);
ShellExecute(handle, "excel", filename, NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
|
Do you want insert datas to editbox on Notepad?
|
|
|
|
|
I am thoroughly stumped by an
error C2064: term does not evaluate to a function taking 1 arguments
The comments preceding the code should make it pretty clear what algorithm I want to make. I've commented the line of code where VC.NET 2003 says the error occurs.
Thanks for any assistance rendered!
-alex
The following can be directly cut and paste as a .h or .cpp file and run.
-----------------------------------------------------------------
#include <functional>
#include <numeric>
#include <vector>
/// A stream processes a vector of unary_functions in order. The return value
/// of the first unary_function becomes the argument to the second.
///
/// Functionally equivalent to:
/// return functor_n(functor_n-1(...(functor_0(initial_value))));
///
/// Procedurally equivalent to:
/// arg_type result = initial_value;
/// for each functor func {
/// result = func(result);
/// }
/// return result;
template <typename arg_type>
class FunctorStream : public std::unary_function<arg_type, arg_type>
{
public:
FunctorStream() { }
FunctorStream(const
std::vector<std::unary_function<arg_type, arg_type>*>&
functors)
: mFunctors(functors)
{ }
/// Runs the argument through each functor in the stream and returns the
/// last return value.
arg_type operator() (const arg_type& initArg)
{// Technically this method should be const since we are using accumulate.
return std::accumulate(mFunctors.begin(), mFunctors.end(), initArg,
MonoidAccumulator<arg_type>());
}
private:
const std::vector<std::unary_function<arg_type, arg_type>*> mFunctors;
};
template <typename arg_type>
struct MonoidAccumulator :
public std::binary_function<arg_type,
std::unary_function<arg_type, arg_type>*,
arg_type>
{
arg_type operator() (arg_type lastResult,
std::unary_function<arg_type, arg_type>* functor)
{
return (*functor)(lastResult); // COMPILER ERROR POINTS HERE
}
};
struct TestFunctor :
public std::unary_function<int, int>
{
int operator() (int arg) {
return arg + 1;
}
};
int main( int argc, char *argv[] )
{
std::vector<std::unary_function<int, int>*> functors;
TestFunctor func0;
TestFunctor func1;
functors.push_back(&func0);
functors.push_back(&func1);
FunctorStream<int> stream(functors);
int foo = stream(2);
return 0;
}
|
|
|
|
|
The definition of std::unary_function only contains some typedef s and does ***NOT*** contain an operator () . It looks something like this:
template<class _A, class _R>
struct unary_function
{
typedef _A argument_type;
typedef _R result_type;
};
In your code you have a pointer to one of these but act as if it has got an operator () .
Steve
|
|
|
|
|
Naive programmer question time...
I'm reviewing some old code (not mine) for my employer and have found that some member functions are being called statically. Is this good practice? Is there any benefit to calling member functions statically? Example code structure as below.
<br />
class MyClass {<br />
public:<br />
void fn2() {
void fn1() {MyClass::fn2();}
};<br />
Is there a reason/benefit why fn2() gets called statically? Both fn1 and fn2 alter the calling object. Neither fn affects any static class data. MyClass is not invloved in any inheritance.
Matt
|
|
|
|
|
It isn't a static member function, so it isn't being called statically.
Instead, it is being called explicitly. If it were a virtual function, then you would be guaranteeing to call the given class implementation (or the one it inherits, but there isn't any inheritance in this case.
There's no real advantage/disadvantage in this case, except that the compiler is being explicity told to use MyClass::fn2() rather than this->fn2().
Steve S
Developer for hire
|
|
|
|
|
Thanks for the explanation.
Matt
|
|
|
|
|
How can i set more then 25 rows in -> dwNewRowsetSize = 25;
---- fetching records in bulk------
pMyDatabase->SetRowsetSize(25);
Bravoone
|
|
|
|
|
|
maybe... who knows
|
|
|
|
|
Its a secret
|
|
|
|
|
Flaviu_2006 wrote: How can i set more then 25 rows in -> dwNewRowsetSize = 25;
is this is of any help :
dwNewRowsetSize = 30;
|
|
|
|
|
CDatabase db;
db.Open("MyDataSource", FALSE, FALSE, "ODBC;", FALSE);
CRecordset rs( &db );
rs.Open(...);
then call rs.SetRowSetSize(30);
if the recordset is not opened, then you are unable to set the more than 25 rows.
|
|
|
|
|
Hello,
I am working with CDataGrid and I can not found how to change size of each colunm ! From resource I can change the size but it will be aplicated on all colunm but I need that each colunm have a other size!
Thank you to give me some tip !
AutreChien
|
|
|
|
|
Datagrid control, Subclass the datagrid header control. In that subclass, the header structure having column width properties. Here you can change for each and every column width.
|
|
|
|
|
I have check the header and the only fonction that I have founded is :
void put_DefColWidth(float newValue)
{
static BYTE parms[] = VTS_R4 ;
InvokeHelper(0x10, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
but there no other fonction to change each colunm !
header files name is DataGrid1.h !
AutreChien
|
|
|
|
|
Hi, this is a low priority bug of my application, i have an Edit control (READ-ONLY property is TRUE, TABSTOP property is FALSE) which is used to display some Message. The problem is that the "Message" of the edit control is getting selected when i am pressing the UP arrow key from the OK and CANCEL buttons of the dialog box, the "Message" should not get selected, how??
one thing i have written this code in OnInitDialog() to show the message in BOLD/BIGGER font
CFont myFont;
myFont.CreatePointFont(120, _T("Arial"), NULL);
CEdit* pBoxOne;
pBoxOne = (CEdit*)GetDlgItem(IDC_STATUS_EDIT);
pBoxOne->SetFont(&myFont, TRUE);
i have tried checking and unchecking all the styles, extented styles in edit properties, but of no use, may be this problem is arising because of the code i have written for the FONT, do i need to add anything extra in the code?? Pls Help!!!
thanx in advance
kumar
|
|
|
|
|
kumar_windows wrote: may be this problem is arising because of the code i have written for the FONT
Why didn't you try to comment out this code and try?
Actually what you got is the basic behaviour.
I would like to handle this problem in PreTranslateMessage of the dialog...
- NS -
|
|
|
|
|
Pls make the "Disabled" property of Edit control TRUE. Then it will not get selected.
Praveen
Akkott
|
|
|
|
|
thank you very much
thanx in advance
kumar_windows
|
|
|
|
|
Hi,
I have the below code in my app for showing a menu on right click on a systray icon.
CMenu SystrayMenu;
CPoint pt;
GetCursorPos(&pt);
SystrayMenu.CreatePopupMenu();
SystrayMenu.LoadMenuW(IDR_MENUSYSTRAY);
SystrayMenu.TrackPopupMenu(TPM_BOTTOMALIGN|TPM_LEFTBUTTON,pt.x,pt.y,this,0);
The menu appears on right click, but I only get a narrow bar.
In the menu resource I have one item "Exit", but nothing is shown.
What could be the problem ?
- KK
|
|
|
|
|
there is small problem in ur code. Modify it as below
CMenu SystrayMenu;
CPoint pt;
GetCursorPos(&pt);
SystrayMenu.CreatePopupMenu();
SystrayMenu.LoadMenuW(IDR_MENUSYSTRAY);
SystrayMenu.GetSubMenu(0)->TrackPopupMenu(TPM_BOTTOMALIGN|TPM_LEFTBUTTON,pt.x,pt.y,this,0);
nave
|
|
|
|
|
I get an access violation error when I do that.
- KK
|
|
|
|
|
plz ensure that the menu have submenus.
make a menuu of below structure( similar to a file menu in notepad ) and try
File
Open
Close
nave
|
|
|
|
|
I got it working. Thank you.
What I wanted is just one "EXIT" to be present in the right click menu.
So I just had EXIT in top most menu.
Then I added another item Exit in it's submenu and it works, shows only the submenu.
thanks again.
- KK
|
|
|
|