|
Thanks one more time, maybe i m wrong but i create my opengl window with glutCreateWindow and everything was created with glut expresions, it creates an int type window and i can't convert it to HWND, is there any other way to make it topmost or to make an notopmost my vb.net window?...
giotis
|
|
|
|
|
Hello.
I thing the HWND is a LONG INT, but hwnd is used in c++ not in VB. "this" is a pointer used in C++ and in C#.
|
|
|
|
|
|
The code I gave you was MFC, and you need to convert that to the VB.NET equivalent. I don't know VB.NET so you'll have to ask a VB.NET guy to convert it for you.
|
|
|
|
|
In MFC(dll) i want to put that code because i want to call it from the VB.NET. Here is my code where i create my opengl window and all the values was given by the VB.NET. Any idea guys?
I try to find an expression in glut,glu libraries i didn't find anything!!
I want this window being in front of the VB form!!!!
void
create(int _posx,int _posy,int _sizex,int _sizey)
{posx=_posx; posy=_posy;sizex=_sizex;sizey=_sizey;
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_MULTISAMPLE);
glutInitWindowPosition(posx, posy);
glutInitWindowSize(sizex, sizey);
//SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
main_window = glutCreateWindow( "GLUI Example 5" );
CWnd::wndTopMost;
glui2 = GLUI_Master.create_glui_subwindow( main_window,
GLUI_SUBWINDOW_BOTTOM );
glui2->set_main_gfx_window( main_window );
GLUI_Rotation *cubform_rot = glui2->add_rotation( "CubiForm", CubiForm_rotate );
cubform_rot->set_spin( .98 );
glui2->add_column( false );
GLUI_Translation *trans_xy =
glui2->add_translation( "Objects XY", GLUI_TRANSLATION_XY, obj_pos );
trans_xy->set_speed( .005 );
glui2->add_column( false );
GLUI_Translation *trans_z =
glui2->add_translation( "Objects Z", GLUI_TRANSLATION_Z, &obj_pos[2] );
trans_z->set_speed( .05 );
glui2->add_column( false );
GLUI_Rollout *options = glui2->add_rollout( "Ortho", true );
glui2->add_checkbox_to_panel( options, "Draw Ortho", &show_ortho );
glui2->add_checkbox_to_panel( options, "Reset", &reset,0,(GLUI_Update_CB)mouse);
glui2->add_button( "Quit", 0,(GLUI_Update_CB)exit);
init();
}
giotis
|
|
|
|
|
I am writing a small applet which will read/write data in a binary file. BinaryReader/BinaryWriter is not quite compatible. I figured a mixed assembly of C++/CLI and native code would work perfectly and be educational as well. Unfortunately, all my attempts at doing this have failed. (I might add that if MS wants anyone to use C++/CLI, they need to make the IDE much more friendly to it.)
My preferred way of learning is by examining and stepping through working code. So, can anyone guide me to some a sample project doing something comparable that I can look at and step through?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hello Joe
Why are the BinaryReader/BinaryWriter classes not suitable?
Also, why don't you just use CreateFile or one of the C or C++ file functions in your code?
|
|
|
|
|
Due to some low level data manipulation that needs to take place before the high level managed classes take over, indicatios are that I will get a huge performance boost by keeping that low level in unmanaged code.
As for CreateFile, that's what I intended to use in the unmanaged portion of the code. The problem is that for all the talk about C++/CLI, I have had a difficult time finding actual working mixed code I can use to learn this stuff. My only solution is to write straight C/C++ based native DLLs and P/Invoke into them from the .NET assemblies.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Just use your CreateFile calls and compile with /clr. I've done it before without problems.
|
|
|
|
|
You misunderstand. I have simplified the problem just to give some indication of what I was trying to do. It is absolutely essential that the core of the solution run natively. I want an assembly with a mix of managed and native classes. I want to find a working EXAMPLE on how to do this.
Thank you anyway for your help.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I did some googling and it's interesting to see that no one has written a publicly available demo that shows a DLL that exports native classes and ref classes. Interesting!
|
|
|
|
|
Btw, Joe. In your first post, you said "Unfortunately, all my attempts at doing this have failed."
If you could give some examples of how it failed, others might be able to give you suggestions on fixing them.
|
|
|
|
|
hi
i have to connect com2 to send,recive commands from a machine i have.
i success to send commands but not to listen to commands.
it run under linux(with c++).
the Parameters should be:
port :RS232
baud rate : 19200
data bits 8
parity none
stop bits 1
flow control none
the way i did it is :
fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd == -1) //Could not open the port.
return false;
fcntl(fd, F_SETFL, FASYNC);
struct termios options;
//Get the current options for the port...
tcgetattr(fd, &options);
//Set the baud rates to 19200...
cfsetispeed(&options, B19200);
cfsetospeed(&options, B19200);
//Enable the receiver and set local mode...
options.c_cflag |= (CLOCAL | CREAD);
//Set the new options for the port...
options.c_cflag &= ~CSIZE; /* Mask the character size bits */
options.c_cflag |= CS8; /* Select 8 data bits */
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;
options.c_cflag &= ~CRTSCTS;
options.c_lflag |= (ICANON | ECHO | ECHOE);
options.c_iflag &= ~(IXON | IXOFF | IXANY);
tcsetattr(fd, TCSANOW, &options);
and to write something like
write(fd, "abcdefg\r", 8);
and it works
but to read i tried and cant do it
what the problem?
may be i gave wrong flags to the parameters i need ?
how should i read data.
thanks.
|
|
|
|
|
This is the C++/CLI forum. You could try the Visual C++ forum, though since your question may be Linux-specific, even that might not be appropriate. In any case, this is not the right forum.
|
|
|
|
|
Hi,
I am using a vector of BSTR in one of the function
Fn()
{
vector <bstr> vbstrTest;
...
vbstrTest.push_back(bstrSomeBSTR)
}
Does the vector automatically cleans the BSTR string inside it? What is the best way to cleanup the vector, if it holds the custom\user defined types.
Thanks in advance,
Yash
|
|
|
|
|
Yash Purohit wrote: Does the vector automatically cleans the BSTR string inside it?
No. It won't.
Yash Purohit wrote: What is the best way to cleanup the vector, if it holds the custom\user defined types.
Use a CComBSTR instead of a BSTR? CComBSTR does its own cleanup in the destructor.
|
|
|
|
|
Hi, I am trying to perform a BitBlt operation, but I'm getting linking errors. Any help would be greatly appreciated.
I'm currently using Visual C++ 2005 Express, and I have a Windows Forms application. The Express version does not have MFC support. I've also installed the Platform SDK and followed the post-installation instructions as indicated on the page: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
I am trying to BitBlt an image from a device context (located within an unmanaged library) to the device context of a PictureBox control on the Form. Making calls to GetDC() and BitBlt() result in linking errors (the unresolved token/symbol types):
~~~~~~~~~~~~~
Linking...
MainWinMapView.obj : error LNK2028: unresolved token (0A0001E4) "extern "C" int __stdcall BitBlt(struct HDC__ *,int,int,int,int,struct HDC__ *,int,int,unsigned long)" (?BitBlt@@$$J236YGHPAUHDC__@@HHHH0HHK@Z) referenced in function "private: void __clrcall MainWinMapView::UpdateRefresh(void)" (?UpdateRefresh@MainWinMapView@@$$FA$AAMXXZ)
MainWinMapView.obj : error LNK2028: unresolved token (0A0001E5) "extern "C" struct HDC__ * __stdcall GetDC(struct HWND__ *)" (?GetDC@@$$J14YGPAUHDC__@@PAUHWND__@@@Z) referenced in function "private: void __clrcall MainWinMapView::UpdateRefresh(void)" (?UpdateRefresh@MainWinMapView@@$$FA$AAMXXZ)
MainWinMapView.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall BitBlt(struct HDC__ *,int,int,int,int,struct HDC__ *,int,int,unsigned long)" (?BitBlt@@$$J236YGHPAUHDC__@@HHHH0HHK@Z) referenced in function "private: void __clrcall MainWinMapView::UpdateRefresh(void)" (?UpdateRefresh@MainWinMapView@@$$FA$AAMXXZ)
MainWinMapView.obj : error LNK2019: unresolved external symbol "extern "C" struct HDC__ * __stdcall GetDC(struct HWND__ *)" (?GetDC@@$$J14YGPAUHDC__@@PAUHWND__@@@Z) referenced in function "private: void __clrcall MainWinMapView::UpdateRefresh(void)" (?UpdateRefresh@MainWinMapView@@$$FA$AAMXXZ)
D:\snapshot\dev_leeh_snapmmf_i4_RouteComparisonTool\snapmmf\utilityapps\RouteDiffer\Debug\RouteDiffer.exe : fatal error LNK1120: 4 unresolved externals
~~~~~~~~~~~~~
I've copied my code snippet below. The canvasSize and m_pOsCanvas variables have types which are part of my unmanaged library, but I don't that matters in the scope of this problem. m_MapPictureBox is a System::Windows::Forms::PictureBox control.
~~~~~~~~~~~~~
// Get the handle to the MapPictureBox
HWND hScreenWnd = (HWND) m_MapCtrlCollection->m_MapPictureBox->Handle.ToPointer();
// Get the device context of the screen
HDC hScreenDC = GetDC(hScreenWnd);
// BitBlt the image to the device context
BitBlt(hScreenDC, 0, 0, canvasSize.getWidth(), canvasSize.getHeight(), m_pOsCanvas->getDeviceContext(), 0, 0, SRCCOPY);
~~~~~~~~~~~~~
I'm guessing the problem is some sort of setting that I am unaware of. I am assuming that I can make GDI calls in the Express edition.
If you what's going on, please provide help.
Thanx,
Lee H.
-- modified at 17:38 Friday 16th December, 2005
|
|
|
|
|
You need to input the required lib files to the linker - such as Gdi32.lib, user32.lib etc.
|
|
|
|
|
Thanx, that helped solved the problem.
The "Inherit from parent or project defaults" option was unchecked; once I checked that, it worked.
Thanx,
Lee H.
|
|
|
|
|
Is there available NET dll's for capturing video from usb device to some memory location, which is not to much complicated to use?
9ine
|
|
|
|
|
I made an application in opengl with glui libraries and i call it from a VB.NET form,well my problem is how can i redisplay my shape in opengl window without creating a new window and change his values at a run time mode!!!is there any statement in opengl i can do that with?I think that i must reset my buffers and reaload it!Any ideas?
Thanks....
giotis
|
|
|
|
|
Hi
Can anyone tell me the mathimatical explanation of converting a floating point to a hexadecimal?
Thanks..
|
|
|
|
|
It depends on the range of the number you want to represent. I put some basic macros at the end of this message, but the concept that you need to understand is the range of the floating point number and the number of bits in your integer representation (HEX or DECIMAL is really not relevant, they are just ways of viewing the integer). So for example if you are trying to represent PI as a integer number using a 16 bit word, you need at two integer bits for the 3 and the rest could be fractional bits. Assuming an signed 16-bit word, gives you 1 sign bit, 2 integer bits and 13 fractional bits. So multiply PI * 2^13 = 25735.9270. Since this is an integer, your loss of precision is the .9270.... So you are left with 25735 (0x6487).
My original PI was 3.1415926535897932384626433832795
If I convert my integer PI back to a floating point number (by dividing by 2^13) we get 3.1414794921875.
The important thing to remember when using these converted numbers is to keep track of the decimal location in all of your mathematical operations using that number.
If you send me an email address I can send you a couple articles that describe fixed point math operations can concepts.
typedef long fixed; // Our new fixed point type.
#define itofx(x) ((x) << 8) // Integer to fixed point
#define ftofx(x) ((x) * 256) // Float to fixed point
#define dtofx(x) ((x) * 256) // Double to fixed point
#define fxtoi(x) ((x) >> 8) // Fixed point to integer
#define fxtof(x) ((float) (x) / 256) // Fixed point to float
#define fxtod(x) ((double)(x) / 256) // Fixed point to double
#define Mulfx(x,y) (((y) * (x)) >> 8) // Multiply a fixed by a fixed
#define Divfx(x,y) ((y << 8) / (x)) // Divide a fixed by a fixed
#define Printfx(x) printf("%ld.%ld", x >> 8, 100 * (unsigned long) ((x) & 0x00ff) >> 8)
// Print fixed point.
#define NDPrintfx(x) printf("%ld", x >> 8)
// Print fixed point without a decimal point.
|
|
|
|
|
if you can get the binary array of the float, you can easily get its hexadecimal representation...
group the bits by groups of 4 bits. then use the following :
binary <--> hexa
------------------------
0000 0x0
0001 0x1
...
1010 0xA
...
1111 0xF
then, you have it.
see this example :
0b 0010 0101 1101 0110
0x 2 5 D 6
so, the hexadecimal representation of the bits shown is 0x25d6 ...
understand ?
[edit]
ok, i'm quite sure it won't be that ease for you to get the bit array, so here is a sample for that :
<font color=blue>float</font> floatToAnalyse = 3.45; <font color=green>
<font color=blue>char</font> floatBits[32] = <font color=gray>""</font>;
<font color=green>
<font color=blue>unsigned int</font> uiBitsArray = *((<font color=blue>char</font>*)(<font color=blue>void</font>*)floatToAnalyse);
<font color=blue>for</font> (<font color=blue>int</font> i = 0; i < 32; i++) {
floatBits[0] = (((uiBitsArray >> (31-i)) & 0x00000001) == 1)
? <font color=gray>'1'</font>
: <font color=gray>'0'</font>;
} [/edit]
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 8:54 Friday 16th December, 2005
|
|
|
|
|
Dear Members,
I need to color a button using ATL, WTL or WIN 32 API..
I can easily do it using MFC but because of the Application requirement
I have to do it by using the above mentioned technologies only.
Kindly help me out by sending tips and useful codes.
Regards,
Mayank Srivastava
|
|
|
|
|