|
|
According to this, using AFX_MANAGE_STATE isn't the answer...
http://msdn2.microsoft.com/en-us/library/30c674tx.aspx[^]
It says in there:
"The AFX_MANAGE_STATE macro should not be used in regular DLLs that statically link to MFC or in extension DLLs. "
My unmanaged dll is an extension DLL, and when I attempt to use AFX_MANAGE_STATE, I get dllmain linker errors...
Does anyone else have any other ideas? I'm really stuck here and would appreciate any advise. Thank you so much,
Doreen
|
|
|
|
|
see if this article[^] will provide the details you are missing.
led mike
|
|
|
|
|
I'd like to open 500 files with OpenFileDialog with enabled multiselect. But it failes to do it throwing exception? What property to modify to open a lot of files?
9ine
|
|
|
|
|
i want to connect sql server 2000 & mysql 5.0 through c++ on wndows plateform.
can any one help me in this regards?
|
|
|
|
|
Google knows.
BTW, this is the MANAGED C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
I am currently working on Serial Interface between a control box and PC and want to send/receive double values from Pc to the box as 8 uint8 values since the box only accepts in uint8 form.
For that i thought as follows : to get that double value (64 bits) in binary form and get the last 8 bits with &(and) operator and shifting bits to right till all bits are finished,namely :
double var;
char var2send[8]; % in array
var2send[0]= var & 0x00000000000000ff % last 8 bits with & operator
var>>8; %shifting bits
var2send[1]= var & 0x00000000000000ff
var>>8;
.
. % and sending this array as output
.
But in this code, i received an error that says i cant use double with & operators so that must be converted 64 bit long form!! How can i manage to do this?? or anyone has better way or suggestion?
I hope i could clearly explain my problem.
I would be very pleased if you could help me!
Thanks a lot!
Cahit
|
|
|
|
|
Yes, binary operations only work with integers. Multiply by whatever number of decimals you want, then cast to int. BTW, this is the wrong forum, this is not a managed C++ question
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
oh sorry, i deliver my message in visual c++ forum then!
|
|
|
|
|
Hello!
I'm trying to use double buffering to display some graphics faster on a pictureBox. I tried to use the setStyle property of the PictureBox the following way
pictureBoxMap->SetStyle(ControlStyles::UserPaint, true);
pictureBoxMap->SetStyle(ControlStyles::AllPaintingInWmPaint, true);
pictureBoxMap->SetStyle(ControlStyles::DoubleBuffer, true);
pictureBoxMap->UpdateStyles();
But no success...
Then i tried using the GDI+ method by drawing the graphics in a bitmap image first and then displaying the image on screen as follows
private: System::Void pictureBoxMap_Paint(System::Object *sender,System::Windows::Forms::PaintEventArgs *e)
{
Graphics *grOnPaint = e->Graphics;
Bitmap *bmpBuf = new Bitmap(ClientRectangle.Width,ClientRectangle.Height);
Graphics *bmpgr = Graphics::FromImage(bmpBuf);
Pen *BluPen = new Pen(Color::FromArgb(0, 0, 0, 255),50);
bmpgr->DrawLine(BluPen,10,10,100,100);
grOnPaint->DrawImage( bmpBufr,100,100);
bmpBuf->Dispose();
bmpgr->Dispose();
My question relates to the later method. It seems that "bmpgr" does not get created properly through Graphics::FromImage with the result "bmpBuf" to be empty and nothing to be drawn on my PictureBox.
Does anyone how i can do this properly? Or may what i am doing wrong with the pictureBoxMap->SetStyle() method.
Any comments would me most appreciated.
Thanks
george
george
|
|
|
|
|
yiwpyos wrote: nothing to be drawn on my PictureBox.
Why do you need a picture box if you're going to paint it yourself ? Just draw it onto your form.
That is how you use Graphics::FromImage, but you don't need it. Just draw your blue line onto grOnPaint instead.
DrawImageUnscaled is faster, if you're not scaling it anyhow.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
Thanks for your reply. The truth is that my drawing function is a lot more complicated than the example i showed in my message. I am going through three "for" loops to display 3D dispersions on a map.
I chose to use a pictureBox because i thought it would be easier to handle the map displaying (zooming in/out, panning etc) by specifying it as the pictureBox->image, and then drawing the rest on top and following the same zooming, panning etc. Not sure it is the best way to go about it, just chose it.
To cut a long story short, apart from removing the flickering from my drawing i wanted to use double buffering to also improve the speed of my displays because these are displayed in real time (would like to anyway every 10 seconds). I did manage to implement the GDI+ double buffering i was straggling with (amazingly enough i was drawing in "bmpBuf" and was displaying "bmpBufr" >:E). However, although the flickering went away the displaying speed did not improve enough.
Do you think the .NET way of handling double buffering would do better (i read that the .NET way is more optimized http://www.windowsforms.net/articles/windowsformspainting.aspx). Any help how do make this work? This is what i tried
pictureBoxMap->SetStyle(ControlStyles::UserPaint, true);
pictureBoxMap->SetStyle(ControlStyles::AllPaintingInWmPaint, true);
pictureBoxMap->SetStyle(ControlStyles::DoubleBuffer, true);
pictureBoxMap->UpdateStyles();
Or any other suggestion how to improve the displaying speed would be much appreciated.
Thanks
george
george
|
|
|
|
|
Yes, you need to draw it yourself and turn on double buffering. Always use provided code first, assume a library author has been paid to take the time to provide the best possible implimentation.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello All!
I have been unable to receive a Byte[] in MC++. Whats the right syntax
this is the C# dll method.
public byte[] GetPictureBytes(Image _Pic)
{
byte[] _rtval = null;
MemoryStream mstr = new MemoryStream();
_Pic.Save(mstr, ImageFormat.Jpeg);
_rtval = mstr.GetBuffer();
return _rtval;
}
Now i have to call this C# dll method in VC++.NET 2005
the syntax that i m using to call and receive this byte array is as follows but its creating some error.
"
array<byte^>^ myImage = gcnew array<byte^>^(1);
myImage = dllobj->GetPictureBytes(_myImage);
"
OR
"array<byte^>^ myImage = gcnew array<byte^>^(1);
myImage = dllobj->GetPictureBytes(_myImage);"
// dllobj is of C# dll Class type that contains metod GetPictureBytes(Image _Pic);
// _myImage is Image type
i have used some other combinations also to receive the Byte array but cant having some errors. Plz guide me writing correct syntax to receive this Byte array in VC++.Net
THNX in Advance
-- modified at 5:55 Wednesday 16th August, 2006
|
|
|
|
|
hello friends;
I am currently trying to write a program that would detect if the colour red.
Basically i need to be able to set it up to monitor a certain portion of my screen (ie, bottom left, box shape) and when it detect a certian chape of red, it will return 1 or 0, or any type of return.
If this is to complicated to explain or to logn to quickly write a short code for it, i understand and thank you for your time in reading this post.
Thank you.
- Droz -
___ ___
/\/\ /\ | |
|
|
|
|
|
To read/set the color of a pixel, there are two Win32/GDI calls, GetPixel() and SetPixel(). Try to find counterparts in managed GDI+. Otherwise, you may have to platform invoke Win32.
Best,
Jun
|
|
|
|
|
Thank you Jun,
i'll look into those functions, thank you.
- Droz -
___ ___
/\/\ /\ | |
|
|
|
|
|
I want to register a sample fax routing dll on Windows XP,
I have found this sample DLL from Windows SDK.
I can not register it, while on Windows 2000 it can be registerered.
On Windows XP the error message is:
"The modem did not accept the command sent to it. verify the configured modem
matches the attached modem."
Anyone could help me plase?
|
|
|
|
|
|
I have DirectX.Capture .dll file and i want to use function in dll but i don't know how to use .dll function in c++.net .
dll function from article 's DirectX.Capture .
|
|
|
|
|
simply #include the header file and
put the .lib file in the linker section.
if u do not have the header file but you know the signature
then use [DllImport] to call the methods from the dll.
first one is the easiest way.
^-^
@|@
- redCat
|
|
|
|
|
Each time when I plug in USB memory stick to the pc, there is a window pops out. I have application to indicate whether a USB memory stick presents.I don't want this auto window to pop out. How shall I resolve it??
|
|
|
|
|
Well, you could buy a Mac...
Seriously, how does this have anything to do with programming, let alone C++/CLI ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Uhm..
This is the problem encountered during programming.
I thought there would be some script can be used to solve it.
Anyway, I fund the solution.
|
|
|
|
|
I'm writing VC++ .net framework code.
I need to retrieve the windows WM_DEVCHANGE message
Shall I use virtual void WndProc( Message* m ) override function or LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) function??
How shall I add either of them to my Form class???
May you write down the format?
|
|
|
|