|
I presume there is a MySQL equivalent...
It would be just what I need!
Ger
|
|
|
|
|
I don't know which data provider you are using, however even OdbcCommand has a Parameters property.
It is time for you to hit the documentation...
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Raided the hotpress last night and dug it out from its hiding place on the top shelf...
Ger
|
|
|
|
|
If you don't need the data, simple filering should always be done on the server side particulary if a lot of items will be rejected.
Philippe Mori
|
|
|
|
|
Hi,
When i try to register my DLL on my Windows XP machine, i get the following error.
Load Library (..) failed. The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem.
Any hints on how to fix this?
|
|
|
|
|
arc.dream wrote: Any hints on how to fix this?
Open the dll with Depends and see what dependency is missing.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
As told be wes there might be dependecies attached to your dll,try to find out them or you might using any old dll in your master dll which has not be renewed on that machine. Let me know if problem still persists.
One more thing, did you migrate this dll?
|
|
|
|
|
It seems that some of the dependent DLL or runtime is not present in the machine. You have to use dependency walker for solving this issue. This link[^] can help you.
|
|
|
|
|
Hi,
I have a COM dll with a class in it. This class alters the registry at HKLM\Software\Policies\MyPolicy
The DLL has a UAC execution level of Highest Available (I think I had it still happen with asInvoker as well).
The executable that cals this dll has an execution level of invoker.
If I run this as administrator, I get the UAC prompt when my class gets invoked, and I see all my debug messages in dbgview and any debug message boxes show up.
If I log in as standard user, and right click runas administrator, everything works fine.
However, If I simply double-click, I see the UAC elevation prompt when my class gets invoked. I enter in the correct password, and the COM object creation passes, but the Registry is never changed, AND I do not see any debug messages or message boxes. If I turn off "Run all administrators in admin approval mode", I see the messages, but the program fails to set the registry keys.
Anybody have any clues? Also, do you know of any great debuggers that I may use to solve this?
More Info:
I modified the DllRegisterServer function to add the following keys to the registry:
HKLM\Software\Classes\AppID\My AppGuid(found in dllMain.h)>\ROTFlags(a string set to "1")
HKLM\Software\Classes\AppID\My AppGuid\DllSurrogate(a string set to empty)
HKLM\Software\Classes\CLSID\My ClassID (found in ClassName.rgs)\AppID (a string set to My AppGuid)
HKLM\Software\Classes\CLSID\My ClassID\LocalizedString (an expanding string set to @dllPath.dll,-100(where 100 is a string
in the string table)).
HKLM\Software\Classes\CLSID\My ClassID\Elevation\Enabled (a DWORD set to 1)
HKLM\Software\Classes\CLSID\My ClassID\Elevation\IconReference (An expanding string set to 'applicationIcon')
Also, my calling code uses the standard old
HRESULT CallingClass::CoCreateInstanceAsAdmin(HWND hwnd,REFCLSID rClsid, REFIID rIid, void** ppv)
{
try
{
HRESULT hr;
BIND_OPTS3 bo;
WCHAR wszCLSID[255];
WCHAR wszMonikerName[300];
StringFromGUID2(rClsid,wszCLSID,sizeof(wszCLSID)/sizeof(wszCLSID[0]));
hr = StringCchPrintf(
wszMonikerName,sizeof
(wszMonikerName)/
sizeof(wszMonikerName[0]),
L"Elevation:Administrator!new:%s",
wszCLSID);
if(FAILED(hr))
{
. . .ShowMyDebugMessage
return hr;
}
memset(&bo, 0, sizeof(bo));
bo.cbStruct = sizeof(bo);
bo.hwnd = hwnd;
bo.dwClassContext = CLSCTX_LOCAL_SERVER;
return CoGetObject(wszMonikerName,
&bo, rIid, ppv );
}
catch(...)
{
. . .Show my debug message
return E_FAIL;
}
return S_OK;
}
Christine Murphy
C# developer
modified 25-Jan-12 15:40pm.
|
|
|
|
|
Dear Friends
I have a mfc application. When I compile with option of /clr support it gives errors as below.
How can I make the code managed. Please give me some hints.
[code]
1>------ Build started: Project: RevolutionProj, Configuration: Debug Win32 ------
1>Build started 1/24/2012 5:25:52 PM.
1>InitializeBuildStatus:
1> Touching "Debug\RevolutionProj.unsuccessfulbuild".
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>cl : Command line error D8016: '/ZI' and '/clr' command-line options are incompatible
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.09
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
[/code]
|
|
|
|
|
sujandasmahapatra wrote: Command line error D8016: '/ZI' and '/clr' command-line options are
incompatible
remove the /ZI option
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
how can I remove the /zi options ?? please give me some guide lines. I just enabled /clr option and not /zi...It has come itself.
|
|
|
|
|
A simple google search says:
Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
Click the C/C++ folder.
Click the General property page.
Modify the Debug Information Format property.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
I disbaled /ZI option and enabled /Zi option. Now its giving errors for /Gm option. /clr error is already there. Please tell me how can I handle this. Thanks Sujan
|
|
|
|
|
sujandasmahapatra wrote: errors for /Gm option
And that error would be?
sujandasmahapatra wrote: /clr error is already there
What /clr error is that?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
How To: Migrate to /clr
http://msdn.microsoft.com/en-us/library/ms173265.aspx[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Just adding the /clr option will not do it; you will need to look at much of your code and make changes to use the features of managed code. Also I am not sure that you can do this with MFC based projects. The first questions you need to address are, what exactly are your requirements, and why do you think that managed C++ will solve them?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
What all I need to do to make my mfc code managed. My client want it managed I dont whats the requirement of this. Please give me some code snippet or some examples to support /clr option. Thanks Sujan
|
|
|
|
|
sujandasmahapatra wrote: What all I need to do to make my mfc code managed.
As I said before I do not think that MFC mixes well with managed code. You cannot convert ordinary code to managed just by re-compiling with the /clr option.
sujandasmahapatra wrote: My client want it managed
I suggest you talk to your client and determine exactly what they do want, for example what benefits do they think they will get from managed code?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Richard MacCutchan wrote: talk to your client
People really do such things?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
what to talk , he needs managed code thats it. I must make it to work. What all I need to do if anyone knows please tell me to make the code managed. ??
|
|
|
|
|
sujandasmahapatra wrote: he needs managed code thats it.
This is ridiculous. Ask your client what exactly he is looking for. If he says "I want managed code" then ask again: for what reason. You are never going to be able to solve this problem until you know what problem you are trying to solve. Managed code in itself is not an answer to anything, in some cases it is even a bad answer.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
sujandasmahapatra wrote: what to talk
Because you need to know exactly what he wants to get accomplished. Is he going to pay you to rewrite your unmanaged code to managed code? Why does he think he needs managed code? Does he think that managed code is going to give him some benefit that doesn't exist? Or does he want managed code just because he heard a buzzword?
sujandasmahapatra wrote: he needs managed code thats it
That is not it. You have unmanaged code already and you seem to think that adding the /clr switch is going to magically transform the unmanaged code to managed code. It is not.
sujandasmahapatra wrote: make the code managed
If you want managed code you have to write is as managed code. You cannot add a switch and make your MFC code suddenly managed. the /clr switch allows you to mix the two not transform one to another. Your unmanaged code will still be unmanaged.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
We have successfully used MFC and C++/CLI Managed code in the same project/executable so it's certainly possible.
We are creating WPF windows just fine from C++/CLI code and can also use much of the legacy MFC code alongside. We stopped using Doc/View architecture in favor of WPF so that will be much of the work to-do if you want to use WPF.
Here's some of my advice from what I recall of the early days:
1. Separate which files need to have managed code and which are native-only. For the managed files, only mark them as /clr. Do this on a .cpp file-by-file basis.
2. In your MFC applications' InitInstance, create an instance of a .NET application object (ex. gcnew MyNetApp(); ) and keep that in an accessible singleton.
3. In your MFC application class Run() function, call the .NET application's Run.
ex. return MyNetApp::Instance->Run();
4. Change project settings for Code Generation to Enable C++ Exceptions with /EHa on the managed files (may be fine to use that for all files).
John
|
|
|
|
|
Yoa are better to throw the MFC code to garbage if you really need managed code. You won't be able to use MFC in a fully managed application thus you would have to uses mixed mode. But if you use mixed mode, then you can just have some part managed and some not managed.
If you really want a managed application, the best thing to do would be to start a new application using WinForms or WPF, and then redo all the UI and then port your code.
You have to understand that MFC and .NET are two worlds. While you can host managed controls in a MFC dialog (or an ActiveX control in a .NET application), you won't be able to cretae a fully managed application.
In a word, without using mixed mode (that is keep MFC not managed and eventually uses some managed .NET controls), the effort to port the code to be managed will probably be higher than completly rewrote the application. It simply does not make any sense. Show to your client our answers and tell him you would have to rewrote the application. If the application is large, it can take months or even years to do so.
If you try anyway, you will probably loose months trying to make things works and still have a lot of problems.
By the way, if you use MFC DLL, then you application have to be compiled with options that are compatioble with MFC. If you use .NET, then your application need to be compiled with options that are compatible with .NET.
If you try to uses both, you will have a lot of incompatible options and you will have to select proper options on a file by file basis. You will probably also need to have 2 set of precompiled header. One for unmanaged stuff and one for managed stuff.
I have done so code where I want to have some managed code and some unmanaged code, and I have to uses some custom options. I have a lot of warning for header files that are sometime included as managed and sometime as unmanaged as some definitions are differents. The more you application is complex, the more it will be hard to fully understand all the implications and the more, you will have hard to debug problem caused by things like incompatible macros definitions, incompatible alignments that will cause your application to crash at run-time. You will have to fully understand the implication of any compiler and linker options. In my case, it was something relatively simple so I was able to manage incompatibilities. By the way, I think I also need some tricks to get DLLs proberly loaded in my case.
If your client want managed code because the code run in a secure environment like SQL, then I think the only option is to rewrote the application.
In the end, you either have to tell your client it is not possible or that you have to rewrote your application. And rewroting the application, even if it is easier in .NET might take probably at least half the time it take to make the original application depending on how the application was done.
If you uses some advanced C++ stuff like template, boost, STL and you want a fully managed application (not mixed mode) it can even be harder to port the application. You can always uses STL/CLR to replace STL but even there you have a lot of changes to do.
In a fully managed application, you won't be able to uses pointers... And if you use mixed mode, then why not have some DLL managed (mixed mode) and some not managed (existing MFC code). That solution will be much more simpler.
Philippe Mori
|
|
|
|