|
HI~
Is there any function in eVC++ which can pass some parameters to a running C# program?
"CreateProcess" can pass some parameters as a argument when a process start. However, how about the process is running?
Thanks~
|
|
|
|
|
If you look for IPC and/or Interprocess Communication this should help you out.
Sorry forgot to say: If you look in the eVC++ help that is!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I don`t know if this is THE way to pass data, but in my case I`
use shared memory... And protect access by a global mutex
Check out the funcs
CreateFileMapping to create the shared mem portion and
MapViewOfFile to get access to the mem portion, and use a named
mutex to prevent read-write errors between apps.
`Hope this helps,
Davy
|
|
|
|
|
Hi. I try to connect to a Microsoft SQL database using Ole Db - IRowSet interface. This works, but I can't bind it to a grid control (I use Microsoft Datagrid control).
I have:
IRowset* pRowset;
DDX_Control(pDX, IDC_DATAGRID1, m_grid);
........................................
I try to bind by
m_grid.SetRefDataSource((LPUNKNOWN)pRowset);
but it raises an exception : Type mismatch.
Well, I tried - I suppose . Could someone help me?
Gabi
|
|
|
|
|
hi all,
i have converted a Form view based application to cview now im facing an error when i run the application the error is "failed to create empty document". please do reply . thanks in advance
Haseeb Ahmed
|
|
|
|
|
It could be one of many things. The only way to succesfully solve these problems is to put a breakpoint at the beginning on the InitInstance method and step through the code until the error is thrown.
Michael
CP Blog [^]
|
|
|
|
|
i have a log file which is a MS-access database. i have the following problem:-
1. wat is the name of the MS-access driver so that i can package it with my application and it can run on any machine irrespective of whether that machine has MS-access installed or not?
2. my log size increases very quickly. i want to rotate the log(i.e, something like syslog in Linux which rotates log weekely)
wat should i do?
|
|
|
|
|
Anonymous wrote:
wat is the name of the MS-access driver...
Look at the Drivers tab on the ODBC Data Source Administrator dialog. It shows:
Microsoft Access Driver (*.mdb)
Anonymous wrote:
2. my log size increases very quickly. i want to rotate the log...
Add a date/time field to the table, and index it. Periodically run through the rows, deleting those that have "expired."
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I dont know much but... "Ms Access uses JET DATABASE DRIVER". You use ODBC which acts as an interface between your application and JET
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
I have developed activex control in MFC. It is text control with additional features.
I am testing it in VB.
Design time properties are getting set.
When I try to set the properties at run time and execute the application I am getting the following error.
If I try to access text property
error is as follows
Method text of object '_DoleEdit' failed
|
|
|
|
|
i have a function IsAdministrator() which tells me whether i the administrator or not(i.e, i have administrative rights). Now i want to include this code in my dialog based application so that only the administrator can run the application. I tried to include it in the InitDialog() but it did not work. Should i put it in the constructor?
|
|
|
|
|
|
put it in InitInstance method of your CWinApp derived class
InitInstance()
{
...
if(IsAdministrator())
{
CMyDialog dlg;
dlg.DoModal();
}
else
{
AfxMessageBox("Your not an admin");
}
return FALSE;
}
|
|
|
|
|
Anonymous wrote:
...but it did not work.
Which tells us nothing. Do you get a compiler, linker, or run-time error? Does an assertion fire? Is an exception thrown? Does the function not produce the desired result? Have you single-stepped through the code to see what specific line fails? Be just a tad more specific.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I am converting some of our projects from Visual Studio 6 to Visual Studio 2003
I have found that the following code gives different results from these compilers
In VS6 "Josh" is printed. in VS2003 nothing is printed.
If I trace into c_str() I can see that the correct pointer is returned to s. However between the call to TestFn() and printf the destructor of stl::string is called. This is for the temp object created when returning from TestFn(). In VS2003 a '\0' is inserted at the fist element in the buffer by this destructor. In VS6 this does not happen.
In VS2003 If I use the memory viewer I can see that s points to a \'0' followed by 'o' 's' 'h' '\0';
In VS6 the same things points to 'J' 'o' 's' 'h' '\0'
Can anyone explain why this is happening?
#include "stdafx.h"
#include <string>
using namespace std;
string globalString = "Josh";
string TestFn()
{
return globalString;
}
int main(int argc, char* argv[])
{
const char * s = TestFn().c_str();
printf(s);
return 0;
}
|
|
|
|
|
Your code is buggy.
TestFn is returning a string object. In your main routine you are getting the const char * of the returned string. Then the string is going out of scope and the memory is being deleted. Finally you do a printf on a pointer that now points to trash.
It worked on VC6 out of luck.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I agree the code is not the best.
Tim Smith wrote:
Then the string is going out of scope and the memory is being deleted.
it seems like in VS6 the temp object created when TestFn() returns goes out of scope at the end of main(), and in VS2003 it goes out of scope after the call to TestFn() but before the return statement
|
|
|
|
|
Josh Gray wrote:
I agree the code is not the best.
I don't think that is the point. The code accesses a memory location of a temporary and then, later, it uses that memory in an instruction. That violates the principles of temporary objects. If you have some compiler or circumstance that causes it to not fail that is pure coincidence and does not change the fact that it is just wrong.
Hate is not a family value.
-pete
|
|
|
|
|
Maybe some scope semantics changed between compiler versions? Dunno
What happens if you try this though:
int main(int argc, char* argv[])
{
//const char * s = TestFn().c_str();
string s = TestFn();
printf(s.c_str());
return 0;
}
|
|
|
|
|
that works and so does this
int main(int argc, char* argv[])
{
//const char * s = TestFn().c_str();
CString s = TestFn();
printf(s);
return 0;
}
this is because the constructor of string and CString copyies the data before the destructor of the temp string object deletes its copy
|
|
|
|
|
This is the correct syntax. You must make a copy of any temp object you receive from a function call if you want to use it in this way (after the return value is evaluated). The original code worked on VC6 because VC6 was not following the standard.
John
|
|
|
|
|
Thanks to everyone who replied.
That explanation sounds reasonable. I plan to change all these methods in our code to return a string reference and see what happens. Fortunatly the 100's of methods that return a string are generated at build time so I can just change the template, rebuild and see what happens.
|
|
|
|
|
Just don't return a reference to a local stack variable. That will cause the same type of bugs.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yeah I know. The actual problem I am attempting to resolve is 'getter' functions that return a member variable. If i change it to a reference I should be able to use the string while the object remains in scope
|
|
|
|
|
Hi i am trying to set up a tab control in an mfc dialog based application however i have been unable to find just any sort of article or anything on how to just set one up and use it can someone either point me to a good article thatll show me how to set up the panels and move through them or at least give me a brief run down of the functions that are needed in setting it up
Thanks
Tyrus
|
|
|
|