|
Hi ,
I have given CLR Support to a VC8 MFC Application and am trying to use a .Net Windows in MFC Form. When i try to use
CWinFormsControl m_ctrl1;
i get the following error
error C2143: syntax error : missing ';' before '<'
Can any one help
|
|
|
|
|
CWinFormsControl is a template class and you need to specify the template type parameter.
|
|
|
|
|
hi
any body help me in ANSI C. Basically i want to made classes in C to create/generate pdf file with out third party API If u hava any ref site or books plz send me url.
thanks
|
|
|
|
|
ANSI C does not support the .NET framework, therefore, you're in the wrong forum The Visual C++ forum is the closest we have to a forum for C.
Christian Graus - C++ MVP
|
|
|
|
|
Hi All,
I wrote a C++ program which will create a service in windows. By starting that service I want to run a particular .exe The issue here is that, after starting that service, that .exe is running in the task manager but the application window is not visible.
I am giving the .exe path as a command line argument while executing the C++ exe.
rgds.,
Surendran
|
|
|
|
|
If the service is running under a system account (SYSTEM, LocalService, etc.) then its child processes do too and they aren't visible by default on the interactive desktop. I believe the recommended way to run an app interactive is CreateProcessAsUser() . You shouldn't run the EXE as interactive and running in the service's account because that a) won't work in Vista and b) opens you up to elevation of priv attacks in pre-Vista.
|
|
|
|
|
Mike,
Thanks for the info. In the CreateProcessAsUser(
hToken,
NULL,
"cmd.exe" or cmdline args,
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi
)
This I got from one site, I want to know, apart from calling this function, anyotherfunction needs to be called?And for the "htoken" parameter any objects or assignments needs to be done? and FYI is now I am using CreateProcess method in the program
Thanks
N.Surendran
|
|
|
|
|
I ran across this blog post[^] yesterday, which has some info about using CreateProcessAsUser()
|
|
|
|
|
Hi ,
Thanks for the info. I wrote the code like below.
In that ArgPBU is command line args (exe name to run)
cwd is current working directory path
BOOL b;
HANDLE hToken;
HANDLE hNewToken;
b = OpenProcessToken(GetCurrentProcess(), TOKEN_ASSIGN_PRIMARY|TOKEN_DUPLICATE, &hToken);
b = DuplicateTokenEx(hToken, TOKEN_ASSIGN_PRIMARY|TOKEN_ALL_ACCESS, NULL, SecurityImpersonation, TokenPrimary, &hNewToken);
b = CreateProcessAsUser(hNewToken, NULL,ArgPBU,NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE, NULL, Cwd, &si, &m_piPBU);
CloseHandle(hNewToken);
-------------
After executing this I am getting same result. Can you help me in this regards?
Surendran N
|
|
|
|
|
yjhliublhurf;u;u;u'/o'o'imhpoifr.u.;h;ojho;
|
|
|
|
|
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Hello,
I have a C++/CLI application in which I would like to use several unmanaged DLLs that export C++ classes via __declspec(dllexport) .
When I directly instantiate these exported classes, I cannot compile the application with /clr:pure or /clr:safe . The only CLR switch I am able to use is a simple /clr .
However, I found that I can use /clr:pure in the main application if I create a managed wrapper DLL using /clr , which in turn calls the unmanaged DLL.
Question: is the possibility of using /clr:pure in the main application worth the additional work needed to create the wrapper? What advantages will I have from /clr:pure in practice?
|
|
|
|
|
|
Thank you! That cleared up things a bit. I decided to use a simple /clr for UI components, and regular C++ DLLs for logic.
|
|
|
|
|
I found it here. And, I'm having small problem with the code. I understand it simple not. Can somebody explain me simple through the code
thanks
|
|
|
|
|
code is here:
http://www.codeproject.com/cpp/Magic_Square.asp
|
|
|
|
|
Ask the author of the article about what questions you have
|
|
|
|
|
why need we doubly and simply?
and?
Logic is based on one algorithm or?
why are we checking also
if (n%4==0)
DoublyMagicSquare
else
SimplyMagicSquare
??
|
|
|
|
|
You found an article, have questions about it, and you couldn't find the forum that is under the article ( for discussing it ), or the right forum for C++ questions ?
Christian Graus - C++ MVP
|
|
|
|
|
You forgot... "Good luck"
led mike
|
|
|
|
|
I have a fairly big memory leak involving inherited classes.
The base class is a generic visual component which has data members used to create a basic window. The next class up is a generic Edit Window with no data members (it justs set values from the base class). The 3rd class in the heirachy is an simple Edit Window which contains data members for a simple edit (similar to the "Edit" class supplied by windows.
I noticed the leak whilst writing a program for work. So I decided to test it out a bit more thoroughly. I ended up with a loop which created and deleted 1000 of these Edit windows. To my horror I had a leak of over 600 bytes! I then tried making the destructors virtual, but this made no difference.
The classes look roughly like this:
AGenericWindow:
{
AGenericWindow();
virtual ~AGenericWindow();
HINSTANCE _hInstance;
HWND _hWnd;
WNDCLASSEX _wndClassEx;
AComponent* _pParent;
char _className[25];
int _resourceId;
};
AGenericEdit
{
AGenericEdit();
virtual ~AGenericEdit();
};
ASimpleEdit
{
ASimpleEdit();
virtual ~ASimpleEdit();
BOOL Disabled;
BOOL Number;
char* Text;
int TextAlign;
int TextLen;
};
I then tried making a fake heirachy which contained data at each level - using the same 1000x loop seems to deallocate all the memory fine!
I'm compliling with Visual C++ 6.0 on Windows XP. If anyone has any suggestions I would be very gratefull indeed!
Barney G Rubble
|
|
|
|
|
BarneyGRubble wrote:
I'm compliling with Visual C++ 6.0 on Windows XP.
Which means you're not using Managed C++, or C++/CLI, and so you are in the wrong forum...
BarneyGRubble wrote: char* Text;
BarneyGRubble wrote: AComponent* _pParent;
These pointers should be initialised to NULL. I'd guess if you did this, the 'leak' would go away.
Christian Graus - C++ MVP
|
|
|
|
|
Christian Graus wrote: These pointers should be initialised to NULL. I'd guess if you did this, the 'leak' would go away.
|
|
|
|
|
guys, i'm stuck on a wierd problem.
i've a class (say, Derived) which inherits from a 3rd prty class (Base). there are a set of virtual methods in the 'Base' that i override in my specialization. i built it as an application, and my 'Derived' objects ARE working fine.
the catch is when i build my app as a service. (i derived managed 'ServiceBase' before, but now i derives from CNTService, so that everything is unmanaged). now, this 'Derived' objects' virtual method invocations trigger the 'Base's implementations! it took me sometime to figure this out. these derived objects are even statically typed (i mean it is a Derived& which actually is a Derived&). the class lib i mentioned have their class (Base's) header shipped along with their libs. I've seen the declaration of the members as virtual. another point is that these methods are all callbacks. (events like CSocket::OnAccept() Onsend() etc, in fact, the 'Base' is a socket implementation). i never have to make any explicit calls to these methods. they are all triggered by the framework(Base's vendors') i'm using. may be (i'm almost sure) the internal callback implementation is done via c-style fptrs on some other tricks. but what i'm confused is the SAME 'Derived' do work perfectly in the application (but, NOT in the service). this is where i'm burning my head.
pls help me out with a fix for this.
any help / comments would really be appreciated.
thanks!!
snexxxxt
|
|
|
|
|
I have developed many services and never seen this occur. Is the library you are using a "managed" library or native?
led mike
|
|
|
|