|
|
Hello everyone,
so I'm using VC++ 2008 and I've got a large solution made up of several different interconnected projects, some of which are DLL's (no CLR). In one of these DLL's I'm trying to import an EXTERNAL Visual Basic dll using the command #import "C:\path\to\my\DLL\file.dll" . If I use this command in one of my .cpp files, it works. If on the other hand, I use it in one of my .h files, I then get the following compile errors in the files ocidl.h and comdefsp.h. I noticed that the .tlh and .tli files generated by the #import command include the file comdef.h. There are other files in my project that include the file comdef.h. Could this be the reason for the conflict?
Error 1236 "solution_name" error C2872:
Error 1237 "solution_name" error C2872:
Error 1238 "solution_name" error C2872:
Error 1239 "solution_name" error C2872:
Error 1240 "solution_name" error C2872:
Error 1242 "solution_name" error C2872:
Error 1243 "solution_name" error C2872:
Error 1244 "solution_name" error C2872:
Error 1245 "solution_name" error C2872:
|
|
|
|
|
since IDropTarget is a type, and it is referenced in ocidl.h, 'ambiguous' implies two definitions for the same, one must not disclude that the two definitions ARE the same and this would point to the common error of an include file, including itself.
An include file should never include itself! But include files are notorious for including themselves vis-à-vis other include files. While it is of poor craftsmanship, it IS promoted in K&R C manual itself when they proscribe something akin to:
#IFNDEF THISFILENOTALREADYREAD
#define THISFILENOTALREADYREAD
....
your h file: 'thisfile'
...
#ENDIF
If this is not the case, kindly submit the result of this search complete solution
'IDropTarget'
Also, there is a switch you can throw that will indicate the include files as they are included. That would be helpful.
Daniel Kilsdonk
|
|
|
|
|
I have project which I am compiling with /clr. I have a class like below..
ref class A
{
public:
void CheckValue(void * test);
typedef ref struct val
{
std::string *x;
}val_t;
};
in my implementation I ahve to use something like below..
void A::CheckValue(void *test)
{
a::val_t^ allVal = (a::val_t^)test;
}
in my main I have used like..
int main()
{
A^ obj = gcnew A();
a::val_t valObj = new std::string("Test");
obj->CheckValue((void*)valObj);
}
I am getting type cast error and two places - obj->CheckValue((void*)valObj); and at obj->CheckValue((void*)valObj); error C2440: 'type cast' : cannot convert from 'void*' to 'A::val_t ^'
This snippet is just to show behavior at my end and I ahve to use it this way only. Earlier I was running it using non /clr so it compiled fine.
Now question I have how can I make this type casting work in C++/CLI type project?
|
|
|
|
|
|
As we know C++ disdains poor typing. Some day it will achieve Pascal or Ada greatness!
Try:
desired_ptrtype newone=static_cast<desired_ptrtype>(voidstarptr)
Daniel Kilsdonk
|
|
|
|
|
Getting Access Violation Exception when trying to convert unmanaged array of structures into managed in Vb.Net(VS2010,4.0 framework) in Windows 7 -64 bit mode.
Sample Source Code
<structlayout(layoutkind.sequential, charset:="CharSet.Ansi)"> _
Public Class vb_menu_dotnet
Public level As Short
Public menu_id As String
Public short_desc As String
Public parent_id As String
Public access As Short
Public flag As Short
Public menu_desc As String
End Class
Dim current As IntPtr
Dim outArray As IntPtr
Dim manArray(100) As vb_menu_dotnet
vb_dotnet_get_menu_hierarchy(p_menu_handle, p_apl_id, outArray) //C API call
current = outArray
Dim j As Integer
For j = 1 To 100
manArray(j) = New vb_menu_dotnet()
Marshal.PtrToStructure(current, manArray(j)) //Access Violation Exception
Vijay
|
|
|
|
|
You may need to try a VB.NET forum. This is for C++/CLI code.
|
|
|
|
|
Dim current As IntPtr
Dim outArray As IntPtr
Dim manArray(100) As vb_menu_dotnet
vb_dotnet_get_menu_hierarchy(p_menu_handle, p_apl_id, outArray) //C API call
You have not initialised any of the pointers that you are sending to the C-language library. Take a look at this P/Invoke tutorial[^] for more information.
Use the best guess
|
|
|
|
|
Hi ,
whatever database u r acessing or data retrieval policy u might be using for e.g INI file,must be in Read Mode,Try to make it Write protected
|
|
|
|
|
Did you actually read the OP's question?
Use the best guess
|
|
|
|
|
Hi ,
whatever database u r acessing or data retrieval policy u might be using for e.g INI file,must be in Read Mode,Try to make it Write protected
|
|
|
|
|
can anyone help me finding the source code or the simulation of the Dual Busy Tone Multiple Access (DBTMA) protocol ????
regards...
|
|
|
|
|
|
Thanks alot, but i need a simulation for any BTMA, DBTMA or DUCHA .
i've a similar project based on multi-channel and busy tones.
regards
|
|
|
|
|
Well you could always refine the Google search that I created, which was based on the exact content of your question.
Use the best guess
|
|
|
|
|
All these search results are papers, but i need a written code
|
|
|
|
|
3bood.ghzawi wrote: i need a written code Well if you cannot find it by searching the internet then you will have to write it yourself.
Use the best guess
|
|
|
|
|
You have the patience of Job on this forum.
|
|
|
|
|
Not always.
Use the best guess
|
|
|
|
|
Hey.
I am trying to get my program to display only 2 decimals of the result og an calculation.
Code:
dansk = System::Convert::ToDouble(textBox2->Text);
kurs = System::Convert::ToDouble(numericUpDown1->Text);
tysk = dansk / kurs;
ti = tysk * 0.90;
femten = tysk * 0.85;
tyve = tysk * 0.82;
bdansk = tysk * kurs * 1.25;
bti = tysk * 0.90 * 1.25;
bfemten = tysk * 0.85 * 1.25;
btyve = tysk * 0.82 * 1.25;
btysk = tysk * 1.18;
label7->Text = System::Convert::ToString(dansk) + " Kr";
label8->Text = System::Convert::ToString(ti) + " Kr";
label9->Text = System::Convert::ToString(femten) + " Kr";
label10->Text = System::Convert::ToString(tyve) + " Kr";
label14->Text = System::Convert::ToString(bdansk) + " Kr";
label15->Text = System::Convert::ToString(bti) + " Kr";
label16->Text = System::Convert::ToString(bfemten) + " Kr";
label17->Text = System::Convert::ToString(btyve) + " Kr";
label20->Text = System::Convert::ToString(tysk) + " Eur";
label21->Text = System::Convert::ToString(btysk) + " Eur";
My ints are defined another place in my prpgram.
Right now my result will be something like 54.867563547, and not 54.86, as my wish is.
Can you help ?
|
|
|
|
|
|
I need a bit more then that... its my second C++ program..
|
|
|
|
|
There are lots of samples in the two links I gave you, that show how you can get your output formatted correctly. This may only be your second program but you need to get familiar with the documentation as soon as possible.
For the record you would show the Danish kroner sample as:
label7->Text = String.Format("{0:N} Kr", dansk);
However, if you look at the second link it explains how to get a number shown in different currencies automatically, by selecting the appropriate locale.
Use the best guess
|
|
|
|
|
I am sorry... But I aint getting anything out of what is explained in the links.
I tried to use the: label7->Text = String.Format("{0:N} Kr", dansk); as you said.
I just get a lot of errors:
warning C4832: token '.' is illegal after UDT 'System::String'
error C2275:'System::String' : illegal use of this type as an expression
error C2228: left of '.Format' must have class/struct/union
I guess its when I remove the Convert part of the line the problem comes ?
|
|
|
|