|
If you have VC++2005 Express Edition, MFC is not an option, and really .NET is the only option you have.
Christian Graus - C++ MVP
|
|
|
|
|
i don't have VC2005 but i have vc2003
|
|
|
|
|
OK - the 'managed C++' syntax in 2003, Microsoft has abandoned. You certainly have MFC tho, which is a dying technology, but there's heaps of resources to support it. I'd still do C++ development in MFC, not in C++/CLI.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
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
|
|
|
|