|
I am using VS 2010 Professional.
I am getting the error:
error C2143: syntax error : missing ';' before '*'
From:
Unmanaged *pu;
I assume there is something very simple that I am overlooking. This problem can be easily re-created. I re-created it by creating a Visual C++ CLR Class Librsry project. Then I used the Class Wizard to create an unmanaged class called Unmanaged. Then in the managed Class1 class I added the line shown above. Then I built that without any other changes and got the error. I do not understand why.
|
|
|
|
|
There is obviously something missing in your code such that the term Unmanaged is not being correctly interpreted by the compiler. Perhaps if you post your class definition also, someone can figure out what's wrong.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I am an idiot. I forgot to #include "Unmanaged.h". I definitely know better but for some reason I did not use my brain.
|
|
|
|
|
Sam Hobbs wrote: for some reason I did not use my brain.
You are now a certified developer; it's something we all do from time to time.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I have a simple function to check Totals on any table in my system (and similar ones for deleting and existence)
The parsed SQL is along these
Select Count(*) from AnyTable
Where ColumnA = 1
and ColumnB = 2
Written in C++/CLI as a command String
Select Count * from {0}
Where {1} = {2}
And {3} = {4}
Alternatively
And ({3} = {4} Or {3} is null} - This is controlled by an CallArgument driven switch construct.
~The function executing this statement takes the TableName, Column 1, Value 1, Column 2,Value 2 and CallArgument as parameters.
And this all works very well until I find I need a third Key/Value pair so I have to add to the parameters and recompile, amend my dynamic SQL etc.
I am thinking of passing in a list based on a class the members of which will be Key, Value, and NullAction.
Extending the parameter list and switch every time an extra clause has to be checked is a primitve and ugly looking approach by comparison to passing in the list and using a 'for each' loop to add a clause for what ever number of parameters are present.
This new approach has the added benefit of being low maintenance, in as far as possible, future proof.
But is it just style over substance?
Will there be a performance price to pay for passing in a list of key/values over specifiying each pair explicitly in the parameter list, subistuting in nullptr for the ones not required on any given call?
Note NullAction would controll whether or not a column needs to consider Null / not Null in an and / or capacity similar to the example above.
Ger
|
|
|
|
|
You shouldn't be building an SQL command string, instead use the SqlCommand class.
It has a Parameters property to which you can add whatever you consider relevant; in fact it does behave like a collection of key-value pairs. It also frees you from all the stringifying hassles, including DateTime format issues.
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.
|
|
|
|
|
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
|
|
|
|