|
hi
I've started R&D work on a USB-232 converter cable (comply with FCC standards).
My application (C++ driver on Linux OS) tries to connect with a device & communicates via this cable.(the device is connected to the rs232 port & PC is connected to the USB port)
I'd tested with the RS232 cable & now I want to use this USB-232 converter cable.
Are there any libraries or sample source codes to do that.
Thanks
|
|
|
|
|
It's a bit misleading IMO, but C++/CLI is the managed C++ forum. Either way, I suspect this is the wrong place to ask how Linux provides USB libraries. By all means, ask in the C++ forum, but I'd be looking at also asking where more people use Linux.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi
I need to convert a char a[8000] to a String* (in .NET)
how do I do it?
<br />
String * b = (String *) a;
will crash at a certain point.
thanks alot
|
|
|
|
|
A String does not contain a char *, it's a Unicode string. At a minimum, you'd need to turn your pointer into a BSTR, I would think. Either way, you can't cast a char * to a string type, you need to pass the byte array into a constructor. That memory address contains an array of bytes representing character data, it does NOT contain an instance of hte String class, which encapsulates a Unicode string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
char a[8000] = "hello";<br />
String * b = new String(a);
|
|
|
|
|
It works well for me.
you can try also this:
char a[8000] = "hello";
String * b = new String(S"");
b = Convert::ToString(a);
|
|
|
|
|
I've got an unmanaged varargs function:
print(char*, ...);
And I've got an exception:
catch (System::Exception *ex)
And I try to print it:
print("%s", ex->Message);
And I get 5 weird symbol characters in the output. What's going on? Am I doing something wrong here? I check Message in managed code and it's fine. Print works fine too, for everything else.
|
|
|
|
|
Just a guess, maybe it's because ex->Message is in Unicode? And your print function only works on ANSI NULL terminated strings?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
ur char* is probably pointing to sumthing in the memory thats not a string
so when u print it it shows u the ascii values of the numbers in the memory
give me the complete code and ill tell u wut ur doin wrong
|
|
|
|
|
Hey,
When migrating VC6 projects to VC7 I often get this warning when compiling the source files that were original VC6 project files that did not emit this warning:
[Warning C4005: 'UNICODE' macro redefinition] with the warning level set to 3
Is there an option or switch I have set wrong?
Best regards,
Bill
|
|
|
|
|
I have added reference of COM: "Microsoft DAO 3.6 Object Library"
Object *pLang = S"dbLangGeneral";<br />
Object *pSrc = S".\\Data\\Database.mdb";<br />
Object *pDes = S".\\Data\\Database.com";<br />
dao::DBEngine::ompactDatabase(pSrc->ToString(), pDes->ToString() , pLang, 0, NULL);
I Got "error C2352: 'dao::_DBEngine::CompactDatabase' : illegal call of non-static member function"
How can i correct it.
|
|
|
|
|
Saksida Bojan wrote:
dao::DBEngine::ompactDatabase
Should that read CompactDatabase ?
Saksida Bojan wrote:
I Got "error C2352: 'dao::_DBEngine::CompactDatabase' : illegal call of non-static member function"
The function you're trying to call is not static, and so needs an instance of the class to call it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't know how to do it. Can you please give an example.
Thanks in advance.
PS: Yes, It Shoud be CompactDatabase.
|
|
|
|
|
You need to create an instance of the DBEngine class before calling the CompactDatabase function.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks That Worked.
I have found DBEngine And DBEngineClass also exist
|
|
|
|
|
Hi all,
I have a form where I want to set some regions. When the mouse moves over these regions I want the cursor image to change.
My idea is to set up some rectangles and use the mousemove event (somehow) to check against the current position of the cursor.
I just want to know what properties do I need to use for this and is there a better way.
I suppose I'm basically asking how I can check if the mouse is over a certain area of a form.
Thanks in advance
Rich
|
|
|
|
|
Try override event MouseMove to get mouse position.
Or use MouseEnter, MouseHover or MouseLeave event to evulate if mouse is in or on certian controls.
|
|
|
|
|
So I've got a rectangle that defines an area. How do I then check whether the mouse position is in that area. I've tried using,
<br />
myRec.Contains ( this->MousePosition );<br />
but it doesn't seem to use the whole area. It only seems to work at a certain spot.
I'm obviously misunderstanding something.
|
|
|
|
|
I have found the problem. MousePosition gets you position, point 0,0 top left of the creen, not the form.
There is work around this problem.
#include <windows.h>
RECT *rect = new RECT();
HWND hWnd = GetActiveWindow();
GetWindowRect(hWnd, rect);
int x = this->MousePosition.X - rect->left - 4;
int y = this->MousePosition.Y - rect->top - 30;
if (myRec->Contains(x, y) == true)
label1->Text = S"True";
else
label1->Text = S"False";
ps: Overridng Those event like MouseEnter, and other i have posted will work only if it is a control. I have reread and now i anderstand what you have ment.
|
|
|
|
|
Thanks for the help.
I'm having trouble firstly with the drawing or placement of the rectangle. It's not in the correct place - for instance, if I draw a picturebox with the same coordinates they are in different positions on the screen. Very confused as to why this is - so I assume from your previous post they are being drawn with different relative positions.
So I've tried to use the work around you posted but if I include the windows header I have a lot of problems with my message boxes and some other components that I need. Is there no way of doing the same thing without the need for the win32 api.
|
|
|
|
|
Sorry, I can't get that error. Try to make another unmanaget class with old syntax:
#ifndef _MPOINT_H_
#define _MPOINT_H_
#include <Windows.h>
struct pointMData
{
int x;
int y;
};
class MPoint
{
public:
MPoint(void){}
~MPoint(void){}
void GetPoint(pointMData *pData)
{
RECT *rect = new RECT();
HWND hWnd = GetActiveWindow();
GetWindowRect(hWnd, rect);
pData->x = rect->left;
pData->y = rect->top;
return;
}
};
#endif
This is unmanaged class, so i have created pointMData for retreaving, because i have a problem using Rectangle in umanaged class. If this doesn't work, then try Creating Win32 DLL.
quote:
Is there no way of doing the same thing without the need for the win32 api.
I couldn't find in framework for this workaround, so i used Win32 api. I don't know if exist.
ps: i hope this works
|
|
|
|
|
Hello,
I'am new to c++ and i want to convert 3 bytes unsigned character to 4 bytes long.
unsigned char UniqueID[3];
long converted;
converted=??;
How can I convert this?
Thanks.
|
|
|
|
|
What do you expect to do ? What do the three bytes contain ? There's no obvious conversion here, that I can see. If it's a number, then you need to know what significance each byte has. If it's just left to right, this should do it
long converted = UniqueID[0] + (UniqueID[1] << 8) + (UniqueID[2] << 16);
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks, it does what i need.
More Power to you.
|
|
|
|
|
Dudes...
I want a code in either c or c++ that enables SERVER to multiple client communication. I also want the libraries required to do so.
GAURAV ZIBBU
|
|
|
|