|
When i use this whole coding in Mainframe OnTimer() it works fine.
But i have to get lot of live values..So i have to put this in Thread.
So when i do that,it shows error of
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in FOPStation.exe
Additional information: Retrieving the COM class factory for component with CLSID {52762B50-F702-11D2-9EB1-00C04F888C49} failed due to the following error: 8001010d.
Anu
|
|
|
|
|
void main()
{
float a=0.7;
if(a<0.7)
printf("A");
else
printf("B");
getch();
}
If i m putting 0.7 and 0.9 in the question answer is coming "A".else for every option as 0.3,0.5,0.6,0.8 it is coming "B".Why is it so??/...I know the float and double concept...dont tell that...but why is difference in answers ..please focus on that.
|
|
|
|
|
mstanwar wrote: I know the float and double concept
do you really?
0.7 is a real number; it cannot be represented exactly as it is not equal to an integer times some power of 2.
therefore, it has an inherent inaccuracy.
furthermore, it is a double (real constants are double by default in C-like languages); assigning it to a float enlarges the inaccuracy, as there are fewer mantissa bits in a float than there are in a double.
a<0.7 is an expression that gets evaluated as doubles (see the language specification); so you are basically comparing the float representation and the double representation of the number 0.7, and those are both approximations, and unequal, and either one may be the larger one.
If you really knew about floats and doubles, you wouldn't carelessly mix them like that.
|
|
|
|
|
Hi,
I dont know whether this is the right forum to ask this question.
If any 1 can help me about telling what is the basic idea of an intellisense type listbox which doesnt loose focus when we type in the editor. I will use this listbox inside regular MS notepad. I have created hooking application which will show dialog at the caret position but the notepad is loosing focus when the list is appearing.
Thanks in advance.
Regards,
John.
|
|
|
|
|
Do you want a .NET answer? If you want an answer from a native code perspective, you may want to post this in the C++ forum (this is the C++/CLI forum).
|
|
|
|
|
Well i looked a solution to call function from a process that is complitly different from another process so i readed about Interprocess Communication. Now i have only seen some data moving data copying and some text show up tutorials but there is nothing about how to call a function from another process can anyone point me somewhere...?
|
|
|
|
|
Are you sure you want a .NET answer? If you want an answer from a native code perspective, you should post this in the C++ forum (this is the C++/CLI forum).
|
|
|
|
|
hi, i am looking for Open Source QRCode Library, do you where i can find one?
i managed to find an article here but it is for C#, but i am looking for C++ .Net or MFC Library, tried google but still no luck,.
if you know an article here in code project then better, love this forum.. or am i in the wrong forum site the ask this question?
thanks ahead,
|
|
|
|
|
If you are open to using C++/CLI it should be fairly easy to wrap the C# library for use from native code. A C++/CLI version of the library will not offer you any additional advantages over the C# version.
|
|
|
|
|
i reviewed the article posted by twit88, and i would say the syntax looks like C++, well except for the minor difference, i think i can manage to wrap it to C++ to fit my needs,.
but still if you could post something C++ for me to read on it would be better,. but right now i gues i have t stick with C# for awhile to learn the flow of the code..
thanks Nish,
|
|
|
|
|
did you fnd a c++ sample already?...we have the same problem..
i can't search for a c++ qrcode encode sample..even a dll..if you found
one please share it...thanks
|
|
|
|
|
Hi Folks,
I am planning to show a dialog (which will act as a drop down list) on any text editor where the user presses a key combination. I would like to know how I can make the dialog work as if it is part of the application on which it is invoked.
I need to achieve the following things.
1. I want to close dialog when the main application shuts down.
2. I don’t want to take the focus away from the editor when the dialog is active.
3. I want to get the focus on the dialog only when user presses arrow buttons.
4. I want to insert the text selected from the dialog onto the editor
The dialog will help the user to auto complete words. I have done the hooking part.
Please advice.
Thanks in advance,
John.
|
|
|
|
|
Unless you specifically want a managed solution, and you are also working in C++/CLI, you may have better luck posting this in the Native C++ forum.
|
|
|
|
|
C++ CLI .NET 3.5 with VS 2008
When I click into a datagrid cell, I have it coded so that the background changes to yellow.
However when I double click to change the cell content, I loose the yellow effect.
How can I retain it?
Ger
|
|
|
|
|
|
I've got a C++ app that makes calls into a C# library.
One of the calls in the C# lib is:
void myFunc ( bool Flag )
I've done some marshalling for strings in other functions, but the bool has me scratching my head.
How do I convert my C++ BOOL to a .NET bool for my C# call?
What am I overlooking? Any help you could send would be appreciated.
Cheers.
Mike.
|
|
|
|
|
Mike Doner wrote: How do I convert my C++ BOOL to a .NET bool for my C# call?
The C++ BOOL translates to the C# int. In C++, a BOOL evaluates to FALSE if it's 0,and to TRUE if it's non-zero (though typically TRUE evaluates to 1). To convert a BOOL value to the C# bool, compare with 0. Example:
BOOL cpp = TRUE;
bool cs = (bool)(cpp != 0);
C++/CLI correctly treats bool as the .NET bool type.
[Edit]when I said evaluate above, it practically means a #define since there is no actual evaluation there[/Edit]
|
|
|
|
|
Thanks Nish,
That did it... I knew it had to be simple.
Cheers.
M.
|
|
|
|
|
I'm using the HookManager class provided here:
Processing Global Mouse and Keyboard Hooks in C#[^]
I've reduced the included demo app to do nothing but trap mouse movement and print a message each time. The code looks like this:
using System;
using System.Windows.Forms;
using UserActivityMonitor;
namespace UserActivityMonitorDemo
{
public partial class TestFormStatic : Form
{
public TestFormStatic()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
HookManager.MouseMove += HookManager_MouseMove;
}
private void HookManager_MouseMove(object sender, MouseEventArgs e)
{
textBoxLog.Text += "Mouse was moved!" + System.Environment.NewLine;
}
}
}
I want to be able to use this in C++, but I'm not really sure how to handle events in managed C++, and searching through Google/MSDN is giving me mixed messages. This is more or less what I tried first:
#include "stdafx.h"
#include <iostream>
using namespace System;
using namespace System::Windows::Forms;
using namespace UserActivityMonitor;
using namespace std;
void HookManager_MouseMove(Object^ sender, MouseEventArgs^ e)
{
cout << "Mouse was moved!\n";
}
int _tmain(int argc, _TCHAR* argv[])
{
HookManager::MouseMove += HookManager_MouseMove;
while (true)
{
::System::Threading::Thread::Sleep(100);
}
return 0;
}
It won't compile. The part where I'm trying to add the HookManager_MouseMove function gives this error:
error C2664: 'UserActivityMonitor::HookManager::MouseMove::add' : cannot convert parameter 1 from 'void (__clrcall *)(System::Object ^,System::Windows::Forms::MouseEventArgs ^)' to 'System::Windows::Forms::MouseEventHandler ^'
I've tried changing the function from void to MouseEventHandler, but then I have to make it return a value, and I have no idea what to do about that, so I suspect that's barking up the wrong tree. What do I do?
Thanks.
|
|
|
|
|
Move the HookManager_MouseMove function to a ref class as a static method. That should work.
|
|
|
|
|
HookManager::MouseMove += gcnew fooDelegate(this, &TestFormStatic::HookManager_MouseMove);
(replace 'fooDelegate' with the appropriate delegate.
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Thanks, but I think there's something I don't get about using delegates. I've been reading up on it, and I've been following the example here:
http://www.java2s.com/Code/Cpp.net/Delegate/Fireeventsandeventhandlers.htm[^]
Now my code looks like this:
#include "stdafx.h"
#include <iostream>
using namespace System;
using namespace System::Windows::Forms;
using namespace UserActivityMonitor;
using namespace std;
ref class MyEventArgs : MouseEventArgs
{
public:
property String^ Info;
MyEventArgs(String^ info, MouseButtons button, int clicks, int x, int y, int delta) : MouseEventArgs(button, clicks, x, y, delta)
{
Info = info;
}
};
delegate void MyEventHandler(Object^ sender, MouseEventArgs^ args);
int _tmain(int argc, _TCHAR* argv[])
{
Events^ events = gcnew Events();
HookManager::MouseMove += gcnew MouseEventHandler(events, &Events::HookManager_MouseMove);
while (true)
{
::System::Threading::Thread::Sleep(100);
}
return 0;
}
It compiles, but when it runs, nothing happens. And I'm not sure what the line starting with delegate void MyEventHandler is supposed to accomplish - my code compiles fine without it, and the example code makes no reference to it. Attempts to read up on managed C++ delegates are making me very confused.
|
|
|
|
|
I'm working on a large MFC application in VS2005, where a complete rewrite is not an option as it would take years.
Instead I'm trying to enable support for .NET plugins, so expert users of the MFC application can write their own .NET classes, which can be loaded dynamically into the MFC application.
I'm using the following example as inspiration:
Hosting a WinForms User Control in an MFC Application[^]
I'm curious if anyone is having any experience in this scenario. I have found that starting a .NET WinForm as a modal CDialog is very easy as one just can call ShowModal. But integrating a .NET WinForm as a CFormView requires that it is a .NET usercontrol within a MFC window.
Not sure if I should require that any .NET WinForm should by implemented as a usercontrol, independent of it should work as a CDialog or CFormView ?
|
|
|
|
|
|
The example you have posted puts a text box control on a MFC Dialog using the CWinFormsControl. Pretty sure that CWinFormsControl cannot host anything but .NET controls.
I don't see anywhere that they take WinForm and hosts it in a MFC CFormView. I have tried to use CWinFormsView and it fails when given the typeid of a .NET Winform, but succeeds when given the typeid of a .NET Control.
I'm looking for people with experience in this area, that might show some light in this tunnel where I'm walking.
I'm curious of how one would solve the issue with getting the .NET control to close the MFC CFormView, change icon/title of the MFC CFormView. The .NET control doesn't get a parent window-object, but only a win32 window handle (integer). My current solution is to have an explicit SetParent on the user-control and make my CWinFormsView-object also inherit from a parent-interface. I don't want my .NET user-control to know anything about the awful world of CLI/Interop.
modified on Thursday, September 23, 2010 3:11 AM
|
|
|
|