|
error LNK2001: Nichtaufgelöstes externes Symbol "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z)
and
error LNK2001: Nichtaufgelöstes externes Symbol "void __cdecl operator delete(void *)" (??3@$$FYAXPAX@Z)
here the source.
using namespace System;
namespace CTest
{
class CppClass
{
public:
CppClass() {}
~CppClass() {}
void native_f() {}
};
__gc class MClass
{
public:
MClass() { m_pC = new CppClass(); }
~MClass() { delete m_pC; }
void managed_f() { m_pC->native_f(); }
private:
CppClass * m_pC;
};
}
|
|
|
|
|
How can I move a window from one desktop to another?
In my program I use two desktops created by me. SetThreadDesktop(...) don't work.
Thank you.
- NS -
|
|
|
|
|
Hi All,
I wanna get the width and height of a character with font "Arial" or any fonts, do you have any solution for this case ?
Thanks
|
|
|
|
|
Try GetTextExtent - this will give you the width/height of a string (make sure the corrent font is selected into the DC). There is more than one way to do this - maybe others will respond...
The Rob Blog Google Talk: robert.caldecott
|
|
|
|
|
kendao wrote: I wanna get the width and height of a character with font "Arial" or any fonts, do you have any solution for this case ?
Is GetCharWidth() api of any help
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i have an ADC device. the manufacturer provided a dll .lib and .h to operate the device. But he hasnt mentioned if the dll is release or debug. I used the dll in release and debug mode programs and found it to work in both. Can a dll work in both release and debug mode programs?
The manufacturer doesnt have any idea of release and debug dlls?
|
|
|
|
|
It's most likely a release version. It will work in debug and release builds of your code, as long as you use the same kind of runtime library (Multithreaded (DLL) vs Single-Threaded)
If you try to single-step into a function (during a debug session) and the debugger jumps to the next line in your code, then the dll is definately a release version.
|
|
|
|
|
Hello,
I need to do programming on serial port. (sending & receiving data from serial port)
Which is the best method: using MSComm or Win32 programming(CreateFile)?
And where I can get good material to understand the concept?
Thanking you,
Regards,
mysticlol
|
|
|
|
|
Hello.
There are several articles and helper classes here on CodeProject.
IMO, it's worth considdering using a ready-made class, since serial IO must use overlapped IO.
|
|
|
|
|
I tried to use the MSComm but could not find
sufficient material to code by using MScomm
(if u get some small app then email me )
Have use the Win32 prog that works fine with
my application now.
If u need will send u the files
thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
hello vikas,
Thank you very much for your helping hand.
I was also trying my hand using CreateFile(), WriteFile(), ReadFile() & FlashFileBuffers() in Win32, but these boolean functions were giving me "false" outpuit.
I was going through tutorials of codeproject, and I got "http://www.codeproject.com/system/serial.asp" by Ramon De Klein.
This washed out all my problems.
Now I have to sit & understand, where I was doing mistakes.
Any way Vikas,
Thank you,
Regards,
mysticlol
|
|
|
|
|
Hello,
I need to do programming on serial port.
Which is the best method: using MSComm or Win32 programming(CreateFile)?
And where I can get good material to understand the concept?
Thanking you,
Regards,
mysticlol
|
|
|
|
|
Hi everybody. I've been working at an article about Inter-Process communication that I also intend to post here when finished ::- ). However, I do have one last issue to solve. A quite difficult issue. I want to pass an array from VC++ to VB. From VB to VC++ I made it work quite easy, but I am having trouble doing it the other way around.
As I learned, Visual Basic works with array using SAFEARRAYs. Now. For example, to call a VB function from a VC++ DLL you gotta do this:
void CallVBFunctionForNumber (long lSomeValueToSend)<br />
{<br />
typedef void (__stdcall *OutsideFunction)(long AValue);
OutsideFunction FunctionCall;
FunctionCall = (OutsideFunction)extNumberProc;
FunctionCall(lSomeValueToSend);
}
extNumberProc is an address which was previously received from VB. To call that function all you gotta do in VC++ is this:
CallVBFunctionForNumber(20);
And now here's the function for calling a function from Visual Basic which should accept an array. First, here's the VB function.
'FUNCTION CALLED FROM THE VC++ DLL.<br />
Public Sub ArrayDemoFunction(ByRef Something As Variant)<br />
MsgBox Something(2)<br />
End Sub
and the VC++ function
void CallVBFunctionForArray ()<br />
{<br />
typedef void (__stdcall *OutsideFunction)(VARIANT *AValue);
OutsideFunction FunctionCall;
FunctionCall = (OutsideFunction)extArrayProc;
<br />
VARIANT *pVariant = NULL;
SAFEARRAY *sarrVC;
SAFEARRAYBOUND sabBound = { 10, 0 };
<br />
VariantInit (pVariant);
pVariant->vt = VT_ARRAY | VT_I4;
sarrVC = SafeArrayCreate(VT_I4, 1, &sabBound);
for (long iCounter = 0; iCounter < 10; iCounter++)
SafeArrayPutElement(sarrVC, &iCounter, &iCounter);<br />
pVariant->parray = sarrVC;
FunctionCall(pVariant);
}
Executing the above VC++ function works, until calling the VB function. When that happens, everything comes crashing down with an "Unhandled exception in Testapp.exe (OLEAUT32.DLL): 0xC00000005: Access Violation.".
For your reference, here's an article which I used to create the code:
http://www.microsoft.com/msj/0599/wicked/wicked0599.aspx[^]
So... ideas anybody? ::- )
-= E C H Y S T T A S =-
The Greater Mind Balance
-- modified at 1:44 Friday 4th November, 2005
|
|
|
|
|
Try adding VT_BYREF to the vt for your variant
pVariant->vt= VT_ARRAY | VT_I4 | VT_BYREF
Just a thought.
|
|
|
|
|
Hello, everyone!
Who can tell me , what's the meaning of "USES_CONVERSION"?
Thanks a lot!
|
|
|
|
|
|
You are so kind.
Thank you and best regards.
|
|
|
|
|
I want to close the dialog, when i clicked outside.
|
|
|
|
|
Response this message WM_NCMBUTTONDOWN ;
d
|
|
|
|
|
I've tried both WM_NCMBUTTONDOWN and WM_NCLBUTTONDOWN, but neither works.
|
|
|
|
|
Hi
You need to lock the mouse cursor to your windows.
During this lock all messages will be parsed by you.
In the close function you can relase the mouse
If you use MFC you can call CWnd::SetCapture like this
<br />
BOOL CMyDlg::OnInitDialog()<br />
{<br />
...<br />
this->SetCapture();<br />
...<br />
}<br />
You then need to capture the WM_LBUTTONUP message since the whole desktop is now client arrea you will get this message then simply check whether the point is your window rectangle or not.
<br />
void CdlgcloseDlg::OnLButtonUp(UINT nFlags, CPoint point)<br />
{<br />
CRect rtWnd;<br />
GetWindowRect(&rtWnd);<br />
ScreenToClient(&rtWnd);<br />
<br />
if(!rtWnd.PtInRect(point))<br />
{<br />
ReleaseCapture();<br />
PostQuitMessage(0); <br />
} <br />
<br />
CDialog::OnLButtonUp(nFlags, point);<br />
}<br />
If you use the win32 API the funtions are:
<br />
SetCapture(HWND hWnd);<br />
ReleaseCapture();<br />
Hope that this is what you needed
codito ergo sum
|
|
|
|
|
I do it this way, but the controls in the dialog doesn't receive messages.
-- modified at 7:30 Friday 4th November, 2005
|
|
|
|
|
hi,
where do you capture the WM_LBUTTONUP (or DOWN) messages, in the messageloop of the dialog or in one of the child controls.
If you capture/process it in the messageloop of the dialog it should, work
I tried it with a small sample app and didn't get any problems
codito ergo sum
|
|
|
|
|
Could you send me your app source? I'm cofused.
|
|
|
|
|
There is no SetCapture?
Could you send me the whole project in an attachment? I want to try it. Thanks.
|
|
|
|