|
Yes, I have looked at them briefly and they seem reasonable.
The only thing I did not complete liked was the fact that for a lot of the wrapper classes the HRESULT still has to be checked after method invocation and this opened up the possibility of missing some error checking and having the error go undetected.
The thing that I liked about the .NET Framework classes is that all errors are reported through exceptions.
Not a huge deal though.
Thanks for the response.
Martin
|
|
|
|
|
I've been looking for the way to get system BIOS information similar to the manner in which msinfo32 works so that I can store the value in a variable for a BIOS Update Utility that I'm writing.
So far I haven't been able to find much on the subject. Can anyone help?
|
|
|
|
|
|
Can you tell me how to read/write the BIOS
I have taken up a project about cmos
Thank you in advance
|
|
|
|
|
|
Hi Dears
I want to develop a MS Word Addin. The main functionality of this addin is:
--> I have to convert a MS Word file (.doc) into (.pdf) file format.
What should I take as first step to implement this functionality.
Kindly guide/help me in the form of some code/link.
I'll be grateful to you.
Kind Regards
Atif
Watch Your Thoughts for they will become your actions.
Watch Your Actions for they will become your habits.
Watch Your Habits for they will become your beliefs.
Watch Your Beliefs for they will determine your destiny.
|
|
|
|
|
How do I invoke a thread that will be able to update Form components? In managed c++ it seems that the thread function needs to be declared as a static function. Then inside my funtion I do not seem to have access to the form.
Help.
I'm looking for a code snipit that show the thread invocation and the code inside the thread function that accesses a form component.
Thanks in advance
Jonathan Beck
|
|
|
|
|
You can just add a thread function to your form class:
public __gc class T3DConfiguration : public System::Windows::Forms::Form {
...
void ThreadProc ();
...
};
And then start the thread like this:
System::Thread *t = new System::Thread (new System.ThreadStart (this, YourForm::ThreadProc));
t->Start ();
Inside the thread procedure you can acces your form as you like. It does not have to be static.
|
|
|
|
|
I'm reading a binary column from an ADO.NET dataset into a byte array with no problem. I can then write that buffer out to disk. I've opened my images with other products and the data is being written correctly.
Now the problem. How can I display the image? I put a static control on a dialog and tried the following but to no avail:
Bitmap* image = new Bitmap(S"c:\\sample.jpg");
CPaintDC dc(&m_wndPhoto);
Graphics* g = Graphics::FromHdc(dc.m_hDC);
g->DrawImage(image, 0, 0);
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Tom, just my 2 cents:
1. You are using CPaintDC: are you doing this inside processing WM_PAINT?
2. Your m_wndPhoto window may have empty invalidated region;
3. Shouldn't you be using CDC?
Cheers,
I
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Yep. There was that problem and a couple of others. Here's the corrected code for anyone reading this thread in the future:
<br />
void CBLOBDataDlg::DisplayImageFile(Byte pictureData __gc[])<br />
{<br />
#pragma push_macro("new")<br />
#undef new<br />
System::IO::MemoryStream* dataStream = NULL;<br />
Bitmap* image = NULL;<br />
Graphics* graphics = NULL;<br />
CClientDC dc(&m_wndPhoto);<br />
<br />
try<br />
{<br />
CWaitCursor wc;<br />
<br />
if (NULL != pictureData)<br />
{<br />
dataStream = new System::IO::MemoryStream(pictureData);<br />
<br />
image = new Bitmap(dataStream);<br />
graphics = Graphics::FromHdc(dc.GetSafeHdc());<br />
<br />
RECT clientRect;<br />
m_wndPhoto.GetClientRect(&clientRect);<br />
<br />
graphics->FillRectangle(SystemBrushes::Control, <br />
clientRect.left, clientRect.top,<br />
clientRect.right - clientRect.left,<br />
clientRect.bottom - clientRect.top);<br />
<br />
graphics->DrawImage(image, 0, 0, image->Width, image->Height);<br />
}<br />
else<br />
{<br />
graphics = Graphics::FromHdc(dc.GetSafeHdc());<br />
<br />
RECT clientRect;<br />
m_wndPhoto.GetClientRect(&clientRect);<br />
<br />
graphics->FillRectangle(SystemBrushes::Control, <br />
clientRect.left, clientRect.top,<br />
clientRect.right - clientRect.left,<br />
clientRect.bottom - clientRect.top);<br />
}<br />
}<br />
catch(Exception* e)<br />
{<br />
MessageBox::Show(e->Message, S".NET Exception Thrown", MessageBoxButtons::OK, MessageBoxIcon::Error);<br />
}<br />
__finally<br />
{<br />
if (graphics) graphics->Dispose();<br />
if (image) image->Dispose();<br />
if (dataStream) dataStream->Dispose();<br />
}<br />
#pragma pop_macro("new")<br />
}<br />
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Is there anyway to convert a .Net String class or a __wchar_t __gc[] array to an unsigned char __gc[] array?
thanks
|
|
|
|
|
Sample Code taken from the MSDN:
<br />
#include < stdio.h ><br />
#include < stdlib.h ><br />
#include < vcclr.h ><br />
#using < mscorlib.dll ><br />
using namespace System;<br />
<br />
int main()<br />
{<br />
String __gc* str = S"Hello";<br />
<br />
const wchar_t __pin* p = PtrToStringChars(str);<br />
printf("%S\n", p);<br />
<br />
char* ch = (char *)malloc((str -> Length + 1) * 2);<br />
wcstombs(ch, p, (str -> Length + 1) * 2);<br />
printf("%s\n", ch);<br />
}<br />
|
|
|
|
|
I have a program which reads from an audio hardware device some raw image data. I am doing the reading in unmanaged C++, so I have in my managed C++ method a pointer to an unmanaged unsigned char array. I would like to load a bitmap object with this data so I can display the data by calling the DrawImage method on a Graphics object.
How can I transfer an unmnaged 512x1024 unsigned char array into a managed Bitmap object for display? If I dump this memory into a "raw" binary file, I can load the file into Photoshop as an interleaved raw format file.
thanks
Bryan
|
|
|
|
|
Could you create a MemoryStream* and use it's Read method to fill the stream, then load an Image* object with it's FromStream method.
-Nick Parker
|
|
|
|
|
But it looks like the Read method reads FROM the stream, and writes TO the buffer. It seems I should use the Write method to Write from the buffer into the Stream. But the problem is still that I need to Write unmanaged data into the Stream, and the Write method takes a managed array.
So I guess one question would be how can I convert my unmanaged array into a managed array so I can than use the Write method. My declaration of my array is as follows:
unsigned char __nogc *buffer = new unsigned char[1024*512];
but when I pass this into the Write method, I get a complier error saying the method expects a unsigned char __gc[], and not an unsigned char __gc*.
Thanks for any additional insight you can add.
Bryan
|
|
|
|
|
When I use the debugger to step through my code, is there any way I can examine the memory pointed to by a String object? When I look at it in the watch window I cannot get the pointer value, likewise when I assign it to a wchar_t __pin * variable, the watch window will not let me access the value of the pointer (it will only show me the value pointed to). So I cannot bring it up in the memory window. Is there any work-around?
Thanks,
Jeremy
READIN writin rhythmetic
|
|
|
|
|
I prepared a program that enumerate processes in the system in vc6.
now I'd like to show process start time by using Process.StartTime() in VC 7. For using Process.StartTime() function What must I do? Please define
me as you are describing to a new user of VC.
|
|
|
|
|
Here is a *fun* problem:
How do you prototype a derived class?
To add some code to the situation:
This is what I want to do:
namespace ManagedConsoleXPControls
{
public __gc __abstract class ConsoleControlBase : public CollectionBase;
}
However, good 'ol VS 2003 gives me a nasty error:
c:\Projects\Windows Forms\Managed Console\MC - Console XP\MCXP-Prototypes.h(20): error C2143: syntax error : missing ',' before ';'
I'm quite certain that this error pertains to this single line in the code.
Does anyone have any bright ideas?
|
|
|
|
|
Anonymous wrote:
namespace ManagedConsoleXPControls
{
public __gc __abstract class ConsoleControlBase : public CollectionBase;
}
namespace ManagedConsoleXPControls
{
public __gc __abstract class ConsoleControlBase : public CollectionBase{};
}
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
Let me try it, but I have the feeling it will cause a "Symbol redefinition" type error.
Even if it doesn't work, thank you dearly for replying
|
|
|
|
|
Yep, it causes a "'class' type redefinition error" due to the fact that declaring it that way is basically saying ConsoleControlBase is an empty class. Humbug.
Thanks anyway.
Anyone else know how to do this? There has to be some way....
|
|
|
|
|
Why do you insist on including the inheritance in the prototype? In C++ you don't do that.
--
You know me. I sure know you.. Everyone of you!
|
|
|
|
|
is there any chance to writ apps for win98 with C++.NET and win2000pro?
thanks.
|
|
|
|
|
Yes, there is. As long as you don't use external technologies that need OS's higher than Windows 98, you'll be alright. The .NET Framework works with Windows 98 and up.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|