|
|
John, my code works fine, but when I open the image with Windows Picture appears the message: "Drawing failed". I don't know why. it's strange, cause the code is right(I think);
The Image when it's saved has the size of 4kb. The BITMAPINFOHEADER's biXPelsPerMeter and biYPelsPerMeter properties I set to 0, cause when I saw the horizontal and vertical resolution values, they was absolutely crazy.
Can you help?
Thanks again
Alex Cutovoi
|
|
|
|
|
I hope someone could tell me a efficient way to find some strings in another string.Thanks!
|
|
|
|
|
You can use strstr function.
See more information in MSDN.
-- modified at 5:05 Monday 10th October, 2005
|
|
|
|
|
Are there any wanys even more efficient? Thanks!
|
|
|
|
|
Jacky Chee wrote:
Are there any wanys even more efficient?
Ask yourself this: "Does it need to be more efficient?"
If "yes", then: "Have I profiled the code so that I know this for a fact?"
If "no", then accept the offered strstr for a char* buffer (or std::string::find for a std::string object).
--
The Blog: Bits and Pieces
|
|
|
|
|
I'm new to network programming, and I would apperciate if I could get some links to tutorials/samples of UDP client/server programming in c++.
Thanks
|
|
|
|
|
i need a program, the program should take as input 2 intgers and the operation to be performed.It should then output the numbers,the operator and the result.
|
|
|
|
|
You're joking, right ? This would be what, your first homework task ? Maybe try showing up for a class or two.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am a beginner in GDI+, and am trying to apply effects like "blur" and "sharpen" to a Bitmap object.
My program can sucessfully import the bitmap, and save it to a different format. This program compiles and runs perfectly well.
However, when I type in one of the effects classes, the program will not even compile. For example,
typing in "BlurParams myBlurParams;" to create a BlurParams object, causes the error "error C2065 'BlurParams':undeclared identifier."
I'm not sure if I need to include some other file to enable effects, but most other GDI+ stuff seems to work fine.
To make sure it wasn't just my code that was causing the problem, I copied and pasted the following code from the MSDN
------------------------------
Bitmap myBitmap(L"Picture.bmp");
UINT srcWidth = myBitmap.GetWidth();
UINT srcHeight = myBitmap.GetHeight();
BrightnessContrastParams briConParams;
briConParams.brightnessLevel = 50;
briConParams.contrastLevel = 0;
BrightnessContrast briCon;
briCon.SetParameters(&briConParams);
RECT rectOfInterest = {20, 15, 80, 50};
// Draw the original image.
graphics.DrawImage(&myBitmap, 20, 20, srcWidth, srcHeight);
// Increase the brightness in a portion of the image.
myBitmap.ApplyEffect(&briCon, &rectOfInterest);
// Draw the image again.
graphics.DrawImage(&myBitmap, 200, 20, srcWidth, srcHeight);
----------------------------
Trying to compile this, I get several errors, the first being
"error C2065: 'briConParams': undeclared identifier"
There must be some way to set up these effects. Could someone please help me? GDI+ hasn't given me troubles before now.
|
|
|
|
|
ben09090 wrote:
BlurParams
Say what ? I've never heard of this. According to MSDN :
Minimum availability GDI+ 1.1
I guess that's why I've not heard of it, and perhaps why you can't use it. Try to update your GDI+ version. Alternatively, read my image processing articles ( they are in C#, but easy to port ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
ben09090 wrote:
Is GDI+1.1 not out yet,and is that why these effects are not defined?
If you have the absolute latest SDK and it still does not work, then probably.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
As far as I can tell, GDI+ 1.1 is not out yet. Maybe Microsoft should make it more clear in the MSDN which classes do not exist yet. I wonder when it will be available?
Your image effect code is really helpful! I have looked at your code, and that should be sufficient for the project I'm working on.
Thanks for the help.
-Ben
|
|
|
|
|
I'm glad I helped. Yeah, it's not always totally clear, but I'd say a lot of the docs are for .NET 2.0, and that GDI+ 1.1 probably will come out with Vista.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm now trying to transplant a C++ program written in Linux to make it run in DOS, but there are quite a lot of header files that are not support in VC 6.0( I am now using it ),like<unistd.h>,<sys socket.h="">,etc.What can I do?
Thanks for help.
|
|
|
|
|
Sorry , like "sys/socket.h", "unistd.h", etc.
|
|
|
|
|
I hope by DOS you mean Windows command line, since with VC6 you can't make DOS programs.
Is there an option to install Cygwin on the machines where you want your Linux software to run?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Yes, I hope to rewrite the code with VC6 and run it in Windows command line.
Thanks!
|
|
|
|
|
1. comment out the offending headers.
2. when you get compiler errors due to unknown symbol, look in the help for that symbol and what header it is in. (click on symbol and press F1)
3. #include that file
4. repeat from step 1 or 2 until all is well.
-- modified at 17:40 Wednesday 19th October, 2005
|
|
|
|
|
Hi fellows
I have a struct like this
struct infoGame
{
time_h theTime;
bool bAcumVariavel;
float fValCred;
};
I would like to know how can I cast these values to a char to put in a message. I'm using dev C++ 4.9.9.2.
Thanks for help
|
|
|
|
|
None of these values can be converted to a char *, at least, not safely. If you were to cast to a char *, and then create a new string there, the value would become invalid for what it's meant to hold.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You have to be a little more specific.
In case what you need to do is to convert the structure to a "seequence of char-type variables" which is called serialization of data-types (there's a ton of documentation about it out there) than your best bet is to simply use the C-style casting such as:
<code>
struct infoGame
{
time_h theTime;
bool bAcumVariavel;
float fValCred;
};
char *serializeStructure(struct infoGame inputStruct)
{
return (char*)inputStruct;
}
void UnSerializeStructure(char* inputBuffer, struct infoGame* outputStruct)
{
outputStruct* = (infoGame)inputBuffer;
}
</code>
Then you could use these functions to save the structure to a file for example and then to retrieve it from a file etc.
In case you were trying to display the members of the strucutre i.e. to a string to then use TextOut or printf than what you're looking for is sprintf. You can use it to print (and format) other data-types into a string which can later be printed on the screen or to a printer.
e.g
<code>
struct infoGame
{
time_h theTime;
bool bAcumVariavel;
float fValCred;
};
struct infoGame sIG;
char* myText;
myText = (char*)malloc(1024);
sprintf(myText, "Long Variable is = %d, Boolean Variable = %d, Float Variable = %f", sIG.theTime, sIG.bAcumVariavel, sIG.fValCred);
free(myText);
</code>
mikk
-- modified at 19:20 Wednesday 12th October, 2005
|
|
|
|
|
Hi friends,
I want to know how to configure windows update. If you know please give me reply.
Regards
kedar
|
|
|
|
|
Right Click on "My Commputer" and chose properties. Chose "Windows Update" there you have it
|
|
|
|