|
Saksida Bojan wrote:
So i must create Win32 or MFC Application detect, and if is installed run my app
But of course. MC++ needs the exact same libraries as C#. How else did you think it worked ?
Saksida Bojan wrote:
but how can i use to run other exe with some command line in Win32 syntax, Please.
::ShellExecute.
Saksida Bojan wrote:
ps: I Don't like programing in MFC and Win32.
Sorry, but you're stuck with it for this. The funny thing is, you say that, but as far as I could see, nearly all your code WAS perfectly fine Win32, you were calling Win32 APIs for registry access, that's for sure.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks For the help. I didn't fully write this code. Someone posted on .NET Framework forum and i changed a bit.
|
|
|
|
|
|
Using SetEnvironmentVariable and other related API calls I am able to set only the "Environment Variables" specific to the process. How do I make these settings Global?
Thanks in Advance
|
|
|
|
|
Hi,
I want to monitor the file system operations done by the user,
namely
1. File/Folder Open,
2. File/Folder Copy,
3. File/Folder Rename,
4. File/Folder Delete,
5. File Save and
6. File/Folder Move operations.
I tried ICopyHook interface but it gave the information on folder Delete, Rename and Copy Operations alone.
It was not monitoring folder Open and Move operations. It also did not monitor any file based operations. Please suggest me the way to monitor the file/folder operations.
Thanks in Advance.
|
|
|
|
|
System::String *table;<br />
<br />
switch(table)<br />
{<br />
case 'CD':<br />
strTempSelectCommand = S"SELECT ID FROM CD WHERE ID=";<br />
break;<br />
case 'DVD':<br />
strTempSelectCommand = S"SELECT ID FROM DVD WHERE ID=";<br />
break;<br />
<br />
default:<br />
break;<br />
}
I got
c:\Projecti\CDDvdOrganizer\Core\CDDvdCore.h(155): error C2450: switch expression of type 'System::String __gc *' is illegal
Can anybody help me? Thanks in advance
|
|
|
|
|
you cannot use 'CD' , 'DVD' case statements.
single quotes are for single characters. if you want to use strings, it should be double quotes "" instead
but unfortunaltey, switch dont work with string. you must change it to an if - else if - else statement...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
To bad. I was hopping to use switch statment. Thank you for your reply.
|
|
|
|
|
read again the switch sintax and u will learn that switch will not make a "strcmp" for ya' ... that is you need an ordinal type for switch arg (i.e. numbers) and constants for case "labels". Perhaps u could #define cd 1, ... dvd 2, etc ... and try using switch that way
|
|
|
|
|
My program isn't desing in that way, I need to use String format, but switch doesn't recognize it, because it is managed type. I think strcmp is MFC or win32 type.
|
|
|
|
|
hello all,
1 - is it posiblle to pass ADO Recordset as a parameter from C++ managed code (.Net MC++) to a C++ unmanaged code (the old existing code) function??
how can i do it using the P-Invoce mechanism?
if it's not posibble - how can i call an exisiting C++ unmanaged function that expect me to pass a Recordset parameter???
2- the same question but i need to pass the unmanaged function an
IUnknown* parameter(hold the connection to the DB).
if u can show me an example it will be great
thank's
|
|
|
|
|
Hi, i would like to find out what are the ways to call unmanaged c++ dll's and lib's into c# using visual studio 2005 beta. I have tried many ways like using p-invoke and adding through reference but none of these methods seemed to do it for me. Are there any easier ways to perform this operation using Visual Studio 2005 Beta? I would like to create an application that uses certain dll's and lib's from the ogg vorbis library and implement them into my windows application whereby the GUI would be done using C#. The url for the ogg vorbis codes are as follows. www.vorbis.com. I would really appreciate your kind feedback. Thank you.
|
|
|
|
|
Hi,
I have to use a MFC C++ DLL (unmanaged of course) in a C++ .Net project.
I have problems to do that. I've created a C++ .Net project and includes the MFC DLL.
My problems comes as soon as I call a method (ctor, dtor or method) from the MFC DLL.
I've got this kind of error :
<br />
error LNK2001: unresolved external symbol "public: __thiscall toto::toto(void)" (??0toto@@$$FQAE@XZ)<br />
fatal error LNK1120: 2 unresolved externals<br />
toto is the unmanaged class from the MFC DLL.
I call it in the C++ .Net class like this :
<br />
toto *p;<br />
p = new toto();<br />
(the first line compile but not the second)
Thanks,
Denis (denissohet AT hotmail DOT com
|
|
|
|
|
|
DllImport must be use to import an unmanaged function but I have to import into my C++ .Net code, classes from unmanaged code... And I don't know how to do. I want to do a wrapper but I can't call my unmanaged classes un .Net code. That's my problem in fact.
I've try the DllImport, but I can't call a constructor :s Is it possible to do this ?
Thks
|
|
|
|
|
Sorry for not replying.
I'm not a big fan of MFC, but, I've read that using MFC classes in a .NET CLR project can be problematic. As I recall there is a conflict with a compiler switch that enables runtime type checks in MFC, and this conflicts with the operation of the Common Language Runtime.
Sorry for my previous post, it could just be making things more difficult for you.
There is an article on MSDN Magazine about this problem. I suggest that you search there.
|
|
|
|
|
Hi,
I have to use a MFC C++ DLL (unmanaged of course) in a C++ .Net project.
I have problems to do that. I've created a C++ .Net project and includes the MFC DLL.
My problems comes as soon as I call a method (ctor, dtor or method) from the MFC DLL.
I've got this kind of error :
<br />
error LNK2001: unresolved external symbol "public: __thiscall toto::toto(void)" (??0toto@@$$FQAE@XZ)<br />
fatal error LNK1120: 2 unresolved externals<br />
toto is the unmanaged class from the MFC DLL.
I call it in the C++ .Net class like this :
<br />
toto *p;<br />
p = new toto();<br />
(the first line compile but not the second)
Thanks,
Denis (denissohet AT hotmail DOT com
|
|
|
|
|
Dear friends
I want to add Regional Languages Support in windows XP through code.
The problem is this that what portion (group of files) are needed from winXP CD.
Saifi Hazarvi
Pakistan
|
|
|
|
|
Hi,
i am trying to add a com component in VC (Managed) but the component is not been able to add, i.e. when i try to add, following error is displayed
"Add reference: error adding reference to project"
for additional info, i have a sample sdk that is using the component it is actually developed under VC 6.0 and is using .idl files
Will some body please me how to do this, i will be very thankfull.
Arus.
|
|
|
|
|
You should provide more information along with your inquiry. Anyone responding will have to ask you a number of questions. I assume that you are new to this kind of thing.
If the COM component has a type library, the easiest thing to do is to convert it to a .NET assembly with the utility, TlbImp.exe.
If you don't understand that clearly, then you should read up a little on COM Interop; COM components are unmanaged and you are trying to use it in a managed app.
|
|
|
|
|
(This is a clarification of my prev post - I dont mean to spam but somehow i cannot modify my old post - sorry!)
I have no trouble passing __delegate ptrs to native C functions in DLLs,
however when attempting to pass the __delegate ptr to a native C++ function
in a DLL I get the following runtime exception: An unhandled exception of
type 'System.EntryPointNotFoundException'.
This is confusing b/c if the entry point was not found, I would think I'd
get an unresolved symbol error during linking. Furthermore, I can
successfully pass void, int *, and function pointers, etc to C++ DLL
functions, but this error persists when attempting to pass a __delegate
pointer, which is used for callbacks to managed C++ functions.
Here is the relevant code snippet - the DLL code simply contains stubs of
the functions called here:
using namespace System;
using namespace System::Runtime::InteropServices;
__delegate void testCB();
[DllImport("unmdll.dll")]
void fnunmdll_2(testCB *UpdateProgMeter);
int fnunmdll_0(void);
void fnunmdll_1(int);
__gc class C1
{
public:
static void handleCB()
{
return;
}
};
int _tmain()
{
int k = 9;
//always works (as both C/C++)
fnunmdll_0();
//always works (as both C/C++)
fnunmdll_1(k);
testCB *pCB = new testCB(0, &C1::handleCB);
//if this is a C++ function expecting a function pointer, the
aforementioned error occurs. If this is an extern C function, all is ok!
fnunmdll_2(pCB);
return 0;
}
As crazy as it sounds, I'm beginning to think this is not possible to do this
with native C++ functions.
Thanks in advance, George
|
|
|
|
|
answer: use a .def file in the dll so mangled names are not used. pinvoke doesnt like them i guess.
|
|
|
|
|
I guess you shound use a pin pointer to prevent your delegate from being moving around, and cast the delegate to its native type, void () in this case.
Pin pointer convertion is the only way to cast gc types to native types.
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
I have no trouble using __delegate classes to pass callbacks to native exported C functions, however if I am make the call to an exported function written in C++ and NOT in C, then I get unresolved symbol errors. It’s quite frustrating b/c it seems like it’s just a syntactical thing that shouldn’t be so difficult.
If anyone could point me to a sample where this works, it would be much appreciated! (I don't mind aving to use dllimport to accomplish this).
Thanks in advance, George
//////////Example/////////////
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::Runtime::InteropServices;
typedef long (_stdcall *CallbackProc) (int lfunctionVal, int lVal, const char *msg);
__delegate long testCB(int, int, const char *);
[DllImport("unmdll.dll")]
extern void __stdcall fnunmdll2(testCB *UpdateProgMeter, int x);
__gc class C1
{
public:
static long handleCB(int x, int y, const char * z)
{
return 0;
}
};
int _tmain()
{
testCB *tmp1 = new testCB(0, &C1::handleCB);
fnunmdll2(tmp1, 0); //if written i C, i am ok. If in C++ it is unresolved! Why?
return 0;
}
|
|
|
|
|
i hav some code in vc# . but i need this in MC++. NET
How to Do this ?
main()
{
string dom = Environment.UserDomainName;
System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry("LDAP://" + dom);
System.DirectoryServices.DirectorySearcher mySearcher = new System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=computer)");
mySearcher.Filter = ("(objectClass=computer)");
foreach(System.DirectoryServices.SearchResult resEnt in mySearcher.FindAll())
{
try
{
System.DirectoryServices.DirectoryEntry de = resEnt.GetDirectoryEntry();
Console.WriteLine("User Name : " + de.Properties["SAMAccountName"].Value.ToString());
}
catch(Exception e)
{
}
}
Console.ReadLine();
}
}
i need to convert this code to MC++ .
How can i do thisd to in MC++ Specially foreach() part.
pls i need experts help.........
i am waiting some reply.....
Sukanta banik
|
|
|
|