|
I have found that the results are better when you use the biggest possible Write (so buffer first, then write it all out at once). It's slower of course, but for some reason this implementation gives really poor results on small writes.
Such a big expansion seems excessive though. It can only happen due to crappy implementation, since the Deflate spec contains an escape mechanism to store uncompressed data with only tiny overhead, but then this implementation is not known for being good in any way.
|
|
|
|
|
Hi Guys this is my first post on the forum (Despite being a long time browser), i hope you can help me.
I am attempting to create and display a modeless form within some C++ code. It works fine when the form is displayed as a modal form using ShowDialog(). However when i use Show(), the form is displayed but with black spaces where the UI controls (Label and Button) should be. You can see that there should be something there but there isn't?
I'm guessing it may be somekind of threading issue? As in the main thread is attempting to create controls on a different thread?
Has anyone come across this issue before and if so how did they get around it?
Thanks
|
|
|
|
|
Hi,
whatever language you use, you shouldn't use multiple threads accessing controls on a single form; this[^] may be useful for you.
|
|
|
|
|
Hi Luc, thanks for the quick reply...
I'm aware that i shouldn't be using multiple threads to access controls on a single form, and as it stands i'm not intentionally doing this. My question is, is the modeless form being created in a new thread automatically (hence it's ability to return immediately from the call) and if so is this the reason why the controls aren't being displayed properly?
I've spent a fair while researching this and am not having much luck, i'm primarily a C#/.Net developer ans am having a little bit of difficulty with the C++ side of things at the moment.
Regards
|
|
|
|
|
jimi77 wrote: is the modeless form being created in a new thread automatically
A form is created in the thread that executes some kind of Form form=new Form(...) statement, and that is independent of how it will be shown (modally/modelessly) later on. So you look at the code and you'll know.
jimi77 wrote: is this the reason why the controls aren't being displayed properly?
You did not show any code, you did mention threading. How can anyone but you answer that question?
|
|
|
|
|
Well i got installed visual studio 6.0 and with that i can creat a dynamic dll, i have all there librarys and include fails. So i added all the include fails and librarys to visual studio 2008 and that ____ still wont build even standard dll fail correctly gives some linking errors instead....
Note that thous librarys are from windows xp sdk and some others they should work on bouth compailer i belive...
:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(81) : warning C4346: '_It::iterator_category' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(84) : see reference to class template instantiation 'std::iterator_traits<_It>' being compiled
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(81) : error C2146: syntax error : missing ';' before identifier 'iterator_category'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(81) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(82) : warning C4346: '_It::value_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(82) : error C2146: syntax error : missing ';' before identifier 'value_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(82) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(83) : warning C4346: '_It::distance_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(83) : error C2146: syntax error : missing ';' before identifier 'distance_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(83) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(224) : warning C4348: 'std::istreambuf_iterator' : redefinition of default parameter : parameter 2
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : see declaration of 'std::istreambuf_iterator'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : warning C4346: '_Tr::off_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(279) : see reference to class template instantiation 'std::istreambuf_iterator<_E,_Tr>' being compiled
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : error C2923: 'std::iterator' : '_Tr::off_type' is not a valid template type argument for parameter '_D'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : error C2955: 'std::iterator' : use of class template requires template argument list
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(67) : see declaration of 'std::iterator'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(231) : warning C4346: '_Tr::int_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(231) : error C2146: syntax error : missing ';' before identifier 'int_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(231) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(289) : warning C4348: 'std::ostreambuf_iterator' : redefinition of default parameter : parameter 2
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(291) : see declaration of 'std::ostreambuf_iterator'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(25) : warning C4346: '_A::size_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(597) : see reference to class template instantiation 'std::basic_string<_E,_Tr,_A>' being compiled
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(25) : error C2146: syntax error : missing ';' before identifier 'size_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(26) : warning C4346: '_A::difference_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(26) : error C2146: syntax error : missing ';' before identifier 'difference_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(26) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(27) : warning C4346: '_A::pointer' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(27) : error C2146: syntax error : missing ';' before identifier 'pointer'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(28) : warning C4346: '_A::const_pointer' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(28) : error C2146: syntax error : missing ';' before identifier 'const_pointer'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(28) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(29) : warning C4346: '_A::reference' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(29) : error C2146: syntax error : missing ';' before identifier 'reference'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(29) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(30) : warning C4346: '_A::const_reference' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(30) : error C2146: syntax error : missing ';' before identifier 'const_reference'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(30) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(31) : warning C4346: '_A::value_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(31) : error C2146: syntax error : missing ';' before identifier 'value_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(31) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : warning C4346: '_A::pointer' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : error C2144: syntax error : 'std::iterator' should be preceded by ';'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : error C2208: 'std::iterator' : no members defined using this type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : fatal error C1903: unable to recover from previous error(s); stopping compilation
|
|
|
|
|
Hi Everyone,
I want to write a cpp test. recently i hv learnt it but i am not able to write the test cases. so if u have any idea or tips then please share it. i need ur help.
thanking u.
|
|
|
|
|
I have the same question. When I Google I see .NET unit testing, and C++ unit testing, but I don't know if any of those will work for Managed C++. Anybody have success with a particular suite? (Hopefully open source)
|
|
|
|
|
rnsk_for_u wrote: recently i hv learnt it but i am not able to write the test cases.
Learnt what? We are not mind readers here.
What are you trying to test, your own program? If so then only you can decide what needs to be tested.
|
|
|
|
|
Hi,
In the strCommand I am having 2MB of Data and when i am trying to split with the new line it was throwing error.(to loop through all the data)
But it was working for minminum (ie 50 KB of datas like 0's and 1's).
How to over come this error? Very urgent.. Below is the code...
CString strCommand; // Holds 2MB of datas like 0's and 1's...
System::String* strDataReceived = "";
strDataReceived = strCommand;
__wchar_t split __gc[] = new __wchar_t __gc[1];
split [0] = '\n';
String *strSplitCommand[] = strDataReceived->Trim()->Split (split);
Please help..
Reg,
Subbu
|
|
|
|
|
What error on what line?
That code doesn't look like it would even compile...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
IMO you should not try and split a 2MB string, what you should do is avoid you ever need nor obtain such a string in the first place. It doesn't make sense. Tackle the problem at the producer's side, not the consumer's.
|
|
|
|
|
Hi,
I need help in creating a waterfall display of my pixel data stored in a buffer. The stream of data needs to be displayed streaming down the screen as its being acquired from the camera.
I am using visual c++ (windows forms).
Can someone please help me to figure out how to achieve this display?
Thanks in advance
|
|
|
|
|
Hi all,
I m new here.
Actually i am learning cppunit testing. and i just want to know, can we write a test case for a method, without calling it?
or how to write a testcase for a void type method?
plzz reply as soon as possible.
|
|
|
|
|
Runish Kumar wrote: can we write a test case for a method, without calling it?
How can you test a method without even calling it? Do you mean mocking some method calls?
Runish Kumar wrote: or how to write a testcase for a void type method?
What is a void type method? A method takes no arguments or returns void?
Also this forum is for C++/CLI discussions. For standard C++, try the C++/MFC forum instead.
|
|
|
|
|
Hi there,
I have a huge problem with Graphics Object.
My application shows pictures in a picturebox. Now I want to draw
multiple frames (rectangles) onto the shown image (regions of interest).
The most easy and acceptable way is to create a graphics object from the image and
do the drawRectangle function on it.
If the image is scaled or zoomed the rectangle(s) will always grow and shrink in same relations! this is very important!
Problem: My bitmap is format8bppindexed with a monochrome colorPalette added by myself, so I isn't possible to create
a graphics object!
It's very important, that I can refresh the images as fast as possible (best with just changing the scan0 pointer).
Is there a possible way to get a graphics object from such an image?
Or has anyone an idea how I could come up with that rectangle drawing thing?
I would be so happy about a good answer! Thanks and have a nice day...
|
|
|
|
|
I've personally always kept regions of interest separate from the image,
just drawing the ROIs at render time instead of drawing on the actual
image data.
A couple possibilities:
1) Use double buffering. Use a graphics object created for a bitmap with the same
bit depth as the screen. Draw the image to the graphics, draw the ROIs on the
graphics, and render the bitmap to the screen.
2) Use GDI directly via platform invoke.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi everyone, I am working on a project at least a year.
I have two major problems:
1.There is no way I can find out why my computer chrashes when running the program. It runs for a while then all of a sudden coputer restart itself. I am writing in Managed C++/cli using serialport class.
2. When the serial port communication is disconnected the program freez having problem detecting that as well.
FYI: I checked usb-serial converter latest driver, computer recognize it. I can see it through divice manager.( name of the usb-serial converter is Keyspan - USA 19HS).
Thanks in advance.
|
|
|
|
|
1 - Use logging and write the method entry and exits to the log file. By analyzing the log file, you can understand on which method it is failing.
2 - Is your application single threaded? If yes, use another thread to listen to the serial port. If serial port is not responding or disconnected, you should be able to abort the thread which listens to the port.
|
|
|
|
|
Hi Navaneeth, Sorry for delay, I am not sure how to do (1 - Use logging and write the method entry and exits to the log file. By analyzing the log file, you can understand on which method it is failing.) this.
If you be kind enough to tell me how I should do it. That will be very helpful. I am having this problem at least a year. I did everything I could do with my little knowledge nothing is helping. If I know what exacly coused computer to crash I may be able to find solution but I have no clue at all.
thanks;
|
|
|
|
|
Hi,
I haven't discovered a way yet to crash my computer using .NET code only.
One possibility for you is your USB-to-RS232C cable comes with a driver of doubtful quality, e.g. having a memory leak or a bug in its kernel code. So you may want and try it with another serial port, either a real one on a motherboard or expansion board, or a USB-to-RS232C cable from another manufacturer.
Another possibility could be something external to what you are doing, maybe a virus. You might try your USB-to-RS232C cable and your code on another system.
|
|
|
|
|
Hi Luc Pattyn, You probabily right because I am using a different usb-serial adapter altogether and now it did not chrash since then.
thank you.
|
|
|
|
|
Hello everyone, I am trying to get the folder name from openFileDialog box.
Here is what I need to do: when the Filedialog box is open I would select a file from a specific folder, get the folder name and assign to a variable as well, because I need to know from which folder the file came from.
I hope it is clear. if you can pls send me some code or some sort of solution I would greatly appriciate.
my code looks like this for now:
this->openFileDialog1->InitialDirectory = Environment::GetEnvironmentVariable("AppData") + "\\a\\b";
this->openFileDialog1->FileName = String::Empty;
this->openFileDialog1->Filter = "txt Files | *.txt";
this->openFileDialog1->ShowDialog();
Thanks in advance.
|
|
|
|
|
The System.IO.Path class has some handy methods for working
with paths.
Looks like Path.GetDirectoryName[^] could be what you need.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark Salsbery,
Can you Please be little more specific.
Thanks
|
|
|
|