|
Hello,
I made a DLL wrapper in managed code which is merely a wrapper function around a native C++ DLL. The DLL works perfectly except I can not see the assembly info in explorer. Using ILDASM, I can see the fields in the manifest. What could be wrong?
Thanks in advance
|
|
|
|
|
The C# and VB compilers will pull the info from assemblyinfo.cs and create the required version resource. Since C++ supports native resources it will not do this automatically. You will have to create a native version resource manually like you would with a native project. There will be some information duplication of course, but it's not a big deal I guess.
|
|
|
|
|
OK, thanks Nishant, I added a resource to VS2010 project which created the info. I needed. So in AssemblyInfo.cpp the only information that I can affect is for signing the assembly and where the key is located. Can I then remove the other fields or are they used?
|
|
|
|
|
alleyes wrote: Can I then remove the other fields or are they used?
Yeah you can remove them if you don't want to have that info in the assembly metadata (which is query-able from .NET).
|
|
|
|
|
Hello,
I am calling LoadTypeLib for loading unmanaged type libraries in C++/CLI. I need to compile some code(some code areas) as managed and some code areas as unmanaged(native) code and form a mixed mode class library as executable.
What i need to mention between the lines of code so that whatever the part i need to be compiled as managed should compiled as managed and what part I need to be unmanaged(native) should be compiled as native?
Regards
Usman
|
|
|
|
|
|
Does anyone have a sample showing how to lookup the URL to use for exchange web services via the autodiscover service.
|
|
|
|
|
Hello,
I am Loading type library from C++/CLI with following lines of code.
[DllImportAttribute("oleaut32.dll", SetLastError = true, CharSet = CharSet::Unicode, PreserveSig=false)]
static void LoadTypeLibEx( String^ strTypeLibName, RegKind regkind,[MarshalAs(UnmanagedType::Interface)] interior_ptr<Object^> typeLib );
Object^ oTypeLib;
LoadTypeLibEx( strSubject,RegKind::RegKind_None, &oTypeLib);
It again and again giving me same exception, all I have registered type library with regsrv32, placed in current directory and given full qualified path but still its giving me same exception.
Regards
Usman
-- Modified Monday, June 7, 2010 12:52 PM
|
|
|
|
|
Hi,
Did you try to find out if if any dependencies are missing or are out-of-date? As you may know, your library may be in place while some of its dependencies not.
Should you consider to try that, you could use depends.exe from sysinternals
SkyWalker
|
|
|
|
|
Hi everybody. I'm tring to save image form webBrowser control. and i have the following code
mshtml::HTMLDocument^ document = dynamic_cast<mshtml::HTMLDocument^>(this->webBrowser1->Document->DomDocument);
mshtml::IHTMLElementCollection^ collImages = document->getElementsByTagName(L"img");
for(int i = 0; i < collImages->length; ++i)
{
mshtml::IHTMLImgElement^ img = safe_cast<mshtml::IHTMLImgElement^>(collImages->item(nullptr, i));
mshtml::IHTMLElementRender^ render = dynamic_cast<mshtml::IHTMLElementRender^>(img);
Bitmap^ bmp = gcnew Bitmap(img->width, img->height);
Graphics^ g = Graphics::FromImage(bmp);
IntPtr hdc = g->GetHdc();
render->DrawToDC(hdc);
g->ReleaseHdc(hdc);
delete g;
g = nullptr;
bmp->Save(L"C:\\Test\\SaveImage.Jpg", System::Drawing::Imaging::ImageFormat::Jpeg);
}
I get the following error message
Error C2664: 'mshtml::IHTMLElementRender::DrawToDC' : cannot convert parameter 1 from 'System::IntPtr' to 'mshtml::_RemotableHandle %'
is there any one who knows how to fix this?
|
|
|
|
|
Yes, find out what type parameter DrawToDC expects.
It should be in the docs for IHTMLElementRender::DrawToDC.
|
|
|
|
|
Hi,
Ik have a form containing a number of comboboxes, called cmb1, cmb2, etc.
I want to loop through these boxes to set their itemlist. I have tried the following code:
for each (Control^ box in this->Controls){
if (box->GetType() == ComboBox::typeid){
box->Items->Clear();
}
}
This works fine, except that I cannot access the combobox's Items property. I can for instance access the Text property, so I think it's strange that the Items property is missing.
Does anyone have an idea how to solve this?
Thanks!
|
|
|
|
|
The reason you can't access the Items property is because you have declared box as a Control and Control doesn't have an Items collection.
You would have to declare a new variable as ComboBox and cast box into it:
for each (Control^ box in this->Controls){
if (box->GetType() == ComboBox::typeid){
ComboBox^ combo = (ComboBox^)box;
combo->Items->Clear();
}
}
modified on Friday, June 4, 2010 11:46 AM
|
|
|
|
|
Have you tried this code
for each(ComboBox^ box in this->Controls)
{
if(box->GetType() == ComboBox::typeid)
{
box->Items->Clear();
}
}
|
|
|
|
|
voo doo12, I've tried this, but when I run the program I get an error that says: "Unable to cast object of type 'System.Windows.Forms.Button' to type 'System.Windows.forms.ComboBox'.
So it seems that if the program encounters a control which is not a ComboBox it cannot deal with it in this way.
|
|
|
|
|
Richard, this makes sense. However, when I compile this code I get:
error C2440: 'type cast' : cannot convert from 'System::Windows::Forms::Control ^' to 'System::Windows::Forms::ComboBox'
Any idea how to solve this?
|
|
|
|
|
Solved!
I made a typo in Richard's code (forgot the ^ symbol in the cast part).
Now it works, thanks a lot for your help!
|
|
|
|
|
Glad to be helpful. 
|
|
|
|
|
Hi everyone !
Please help me , because i have a big trouble !!!
I have login form , and i want to open form1 Form from login form.
I tryed use #include "Form1.h" in "login.h" login form where is.
Unfortunately i had problems and many mistakes such like :
Error 198 error LNK2005: "int SymulacjaObiektuSISO::i1" (?i1@SymulacjaObiektuSISO@@3HA) already defined in Logowanie.obj Symulacja Obiektu SISO.obj Symulacja Obiektu SISO
Error 199 error LNK2005: "int SymulacjaObiektuSISO::i2" (?i2@SymulacjaObiektuSISO@@3HA) already defined in Logowanie.obj Symulacja Obiektu SISO.obj Symulacja Obiektu SISO
Error 214 error LNK2005: "class std::deque<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > SymulacjaObiektuSISO::nazwyGeneratorow" (?nazwyGeneratorow@SymulacjaObiektuSISO@@3V?$deque@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@A) already defined in Logowanie.obj Symulacja Obiektu SISO.obj Symulacja Obiektu SISO
and i think this is because of #include files which are in form1.h
unfortunately i can't open form1 from login form : Form1^ test = gcnew Form1^();
i don't know what to do... please help me because i must do this !!!!
How can i resolve this problem ??
Login form -> open form1 form , and form1.h has the others #include files just like "test1.h" and ect.
Plese help me as fast as You can
|
|
|
|
|
the problem come from this -> "Login form -> open form1 form , and form1.h has the others #include files just like "test1.h" and ect."
the include file must be correct utilized cause they can lead to your problem.
in an ideal world you should include the .h files like in a tree:
super_main.h
/ \
main1.h main2.h
/ \
submain1_1.h submain1_2.h
where each .h have one .cpp with the operational code
-- or --
there are some workaround like
#ifndef
#define
....code....
#endif
to make life easier when implementing .h 
|
|
|
|
|
Thanks for the reply !
Yes of course I usually write #ifndef ect. definition into header files, but it's not a problem with this... main issue of this is in the namespace... because my major project is in C++ CLI how's You know isn't the same what is pure C++ ( unmanaged probably ) so, i'm not able to declare object of pure class ( example : class Test; and in managed class : ref class { ... public : Test object; ) i understand how can i resolve this problem -> i should declare pointer of unmanaged class : Test *object into managed class. But unfortunately my supervisor ( he hasn't seen my project yet ) wants or requires use auto_ptr ( because of memory leak ) , so i use this "intelligent" pointer in namespace area :
namespace TestSpace
{
auto_ptr<test> object;
ref class ClassTest
{
object->...
};
}
and it works,
but main problem is when i compile this code , and i have main order with header files same to You , 'm receiving information about the same or two definitions ( already defined ). I noticed that i haven't this problem if i don't use or i don't declare all of objects , variables in namespace like above... i think it's because of declarations in namespace , Ideal solution would be place declarations into ref class and i think it won't be compile error , but how's i said unfortunately we can't declare auto_ptr in ref class because of unmanaged and managed code error , and this is infinite loop... if i hadn't seen on my supervisior i would have written this with usual pointers ... : Test *object in ref class and no problem for me... but i can't imagine what would be if my teacher see this solution...
Of course if you don't find any more precisely solution , i'll do this with convenient linker option : /FORCE and i don't see this error... but You know... it's just like an strong solution...
Thanks for help
|
|
|
|
|
Hi,
I am stuck on creating this batch file. I need it to delete the oldest file in a given directory.
I got it working except if the filename contains spaces, which is where I'm stuck.
Here's what I have so far
SET DIRTODELOLDESTFILE="C:\Documents and Settings\TEST001\Desktop\test\New Folder\"
FOR /F %%i IN ('DIR /A-D /B /O-D %DIRTODELOLDESTFILE%') DO SET DELETEME=%%i
DEL %DIRTODELOLDESTFILE%\%DELETEME%
When I try to use
DIR /A-D /B /O-D I see the complete filename, but it's not being saved properly..
If you try a directory with a filename "New Text Document.txt", the script would only pick up "New" but not the entire file name. However, DIR /A-D /B /O-D returns the full filename. I tried googling around, but just about every solution is to "use quotations"... this isn't the case if I don't know the filenames in my directory. If anyone ran into this, any help/clues would be nice
Thanks!
PS: I don't know if this is in the right section. If not, sorry in advance >.>
|
|
|
|
|
Hi,
of course this is not the right forum, it is not a language question.
try
FOR /F "delims=!" %%i IN ('DIR /A-D /B /O-D %DIRTODELOLDESTFILE%') DO SET DELETEME= %%i
it replaces the default delimiters (space and tab) by a character that won't appear in a file path.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks Luc!
That worked nicely. I needed to add some extra string manipulation at the end to handle quotes.
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|