|
This[^] is my post so with luck any responses will appear below.
It's time for a new signature.
|
|
|
|
|
iam unable to enablemenuitem from dialog system menu..
i worte like this :
CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->EnableMenuItem(SC_CLOSE,MF_DISABLED );
here it is disabling menu item.
after this again, i want to enable the menu item,
CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->EnableMenuItem(SC_CLOSE,MF_ENABLED );
but it is not working. might be some prob in my code.
any body can help me ..
Regards,
Srinivas
|
|
|
|
|
Both MF_DISABLED and MF_ENABLED work perfectly for me.
I tried this in a dialog based application.
|
|
|
|
|
dialog based application. but i have one window class which is derived from CWnd class. this window have only one close button. that button should be enabled/disabled in different situations.
i worte like this for disabling:
CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->EnableMenuItem(SC_CLOSE,MF_DISABLED );
same thing for enabled also,
CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->EnableMenuItem(SC_CLOSE,MF_ENABLED );
this is not working.
Regards,
Srinivas
|
|
|
|
|
Hi,
I am drawing image with gdi+ function as below:
graphics->DrawImage(img, m_destRect, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,UnitPixel,&ImgAttr);
I want to zoom it so I tried ScaleTransform() function to zoom it.
But I have severel issue with this:
1. ScaleTransform takes 2 float parameter how to calculate them so that I can zoom the image from current state.
2. After zooming how to make image at same position (center point)as it was before zooming.
3. I tired the zooming in different way....on a static control and resize only static control that was working fine but I need to crop the image from spaific portion and that portion was internally not zoomed.
4. Is there any method to zoom and crop the image. please suggest?
|
|
|
|
|
|
Hi,
1.
keep both scale factors identical if you want the scaling to be isotropic.
2.
temporarily move the origin to the center of the canvas (assuming that is the point you do not want to move), hence apply the sequence Translate(some_distance), Scale(some_factor), Translate(-some_distance) .
ADDED: normally some_distance corresponds to half the size of your canvas /ADDED
3.
There are some 30 overloads of DrawImage; there must be at least one that does what you want.
Most is explained in MSDN, to some extent. It may take some experiments to grasp it all.
|
|
|
|
|
Hi all,
Im having two character buffers with different size.
for ex,ist buffer is size of 40,and 2nd one is 50.
what im trying to do is,create the new buffer which should contain the data from first buffer(position from 0 to 40)and the data from the 2nd buffer(position from 41 to 91).
I mean the 2nd buffer's data should get append with the first buffer data.
Is any way to do this?could you help me.
Thanx.
|
|
|
|
|
gmallax wrote: Is any way to do this?
yep
gmallax wrote: could you help me.
will try
So, if you know in advance the size of these buffers, or at least the maximum length of possible strings, then e.g. (i assumed your strings are zero-terminated, if not then tell me so):
char buffer40[40];
char buffer50[50];
...initialize your buffers with whatever content you need to...
char buffer90[40 + 50];
strcpy(buffer90, buffer40);
strcap(buffer90, buffer50);
...both of your strings are in buffer90 now...
See strcpy[^] and strcat[^] in MSDN.
If you do not know the sizes of these strings in advance, or you just don't want to waste memory, then e.g.:
char first_buffer[whatever size_1];
char second_buffer[whatever size_2];
...initialize your buffers with whatever content you need to...
char *concatenated_buffer = new char[strlen(first_buffer) + strlen(second_buffer) + 1];
strcpy(concatenated_buffer, first_buffer);
strcat(concatenated_buffer, second_buffer);
...both of your strings are in concatenated_buffer now...
delete []concatenated_buffer;
See strlen[^] in MSDN for info.
I hope this helps, error checks are avoided for simplicity.
[EDIT] I just realized i simply assumed your character buffers contain strings, which you didn't explicitly state so i might be wrong, if i am, then tell me so and we'll think of something else [EDIT]
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I assume you made a typo. The first buffer has only 40 valid items, so the ranges will be [0, 39] and [40, 89]
unsigned char buf1[40];
unsigned char buf2[50];
unsigned char result[90];
memcpy(result, buf1, 40);
memcpy(&result[40], buf2, 50);
|
|
|
|
|
If you're using C then you're going to have to use such abberations as malloc, free and memcpy. If you're using C++ you can get away with using a vector - it can be used just about anywhere a built in array can be used and doesn't involve memory management. If the two buffers are called buffer_1 and buffer_2 (and they're arrays and not some block of memory bunged on the heap):
std::vector<char> appended_buffer( &buffer_1[ 0 ], &buffer_1[ 40 ] );
appended_buffer.resize( appended_buffer.size() + (&buffer_2[ 50 ] - &buffer_2[ 0 ]) );
std::copy( &buffer_2[ 0 ], &buffer_2[ 50 ], &appended_buffer[ 40 ] );
The big problem with this is you have to know the sizes of the buffers you're copying from. You can get around this by never using raw character buffers and using vectors for everything. If buffer_1 and buffer_2 are vectors:
std::vector<char> appended_buffer( buffer_1.size() + buffer_2.size() );
std::copy( buffer_2.begin(), buffer_2.end(),
std::copy( buffer_1.begin(), buffer_1.end(), appended_buffer.begin() ) );
The nested copying takes uses the fact that std::copy returns the place (actually it's an iterator) where the second copy has to start - really handy. All this is a lot easier than messing about with manually managing memory. Well, unless you're a masochist.
Cheers,
Ash
|
|
|
|
|
A future prospective employer mentioned C++ is an excellent language to learn for the field I wish to work in, and especially in their company. "Sounds good" says I. I already taught myself enough Python to have fun with it, C++ seems like a nice language after that. (For precisely the same reasons the languages are different. Strongly typed, compiled, etc.)
Now, after wrestling with Google, and the Eclipse SDK, I gave up, (it was going on about "toolchains", and I was thoroughly confused, and couldn't get anything to compile) and installed Visual C++ 2008 EE.
All's now well and good, and I'm quickly getting used to syntax, non-dynamic variables, etc.
Thing is, I learn to swim faster if I'm in the deep end. Where I left Python, I was trying to implement some sort of primitive 3D rendering with a 2D library, so I figured an acceptable depth for C++ would be some sort of 3D shenanigans.
All this, so far, points to DirectX being a likely candidate. No thanks, I'm in this for open-source, cross-platform, hyphenated-fun.
So, to OpenGL. In Python, as you can imagine, I'm used to just "import PyOpenGL as og" or whatever. From what I gather, the parallel(s) in C++ is/are libraries. And this is where I deadend. I can't seem to find libraries that aren't windows-specific. Every tutorial I've stumbled upon looks extremely windows-specific, too, one of them mixing OpenGL graphics, with DirectX input or sound modules, or something. (Didn't make sense to me; if you're on windows, and windows alone, why not just use full DirectX?)
So, TL;DR version: Cross-platform C++ OpenGL libraries + documentation please.
Added bonus question: How do I get Eclipse to work?
|
|
|
|
|
If you want to develop cross-platform GUI applications, the best way is to use a cross-platform framework: this will give you a coherent set of APIs to do almost everything in a platform independant way.
The best of them, in my opinion, is the Qt framework (see Qt - A cross-platform application and UI framework[^]): it give you a complete set of functionalities and OpenGL is included. It could be used under three licensing scenarios: GPL, LGPL and Commercial. There exists a Python binding too...
Another similar toolkit is the wxWidgets (see http://www.wxwidgets.org/[^]) which is licensed under a modified LGPL license, but I don't know if it supports OpenGL...
modified on Wednesday, July 21, 2010 3:36 AM
|
|
|
|
|
I've heard of both wxWidgedts and Wt, but when using Python, I chose to use GTK+, which lead me to believe that they were... Well, GUI libraries, not 3D libraries. Would using them, instead of pure OpenGL, not add unnecessary overheads?
|
|
|
|
|
Yes, that is true, however consider that OpenGL integrates in the platform-specific windowing system; in other words with ANSI C/C++ and OpenGL only you will be not able to do nothing, you need at least to use the platform-specific API required to access the windowing system. Said that, the little overhead of a cross-platform framework is nothing compared to what it offers you; for instance the Qt give you a class named QWindow that let you create a window in just 2 lines of code (instead of plenty of lines required using the platform-specific API), these 2 lines are always the same on every platform supported, and the window that you obtain is automatically bounded to an OpenGL rendering context, then you can call the standard gl and glu family of functions on it (without the need of writing plenty of lines of code required to create the rendering context, bind it to the window, activate and deactivate it in the right places and so on).
|
|
|
|
|
Sounds good, I'll look into it, thank you very much.
|
|
|
|
|
If you'd like to have a look to the Qt framework, I suggest you to download this: C++ GUI Programming with Qt4[^]
This is the first edition of the official book and is available for download from the Qt website: I remember that there is a chapter specific to the OpenGL...
|
|
|
|
|
Hi,
How could I pass data from MFC application to .Net user control? I have added .Net Chart Control to MFC application. The problem is passing data to that control.
Does anyone have any ideas about this?
Regards
Daniel
|
|
|
|
|
This[^] here looks promising, also this[^] might help.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Thanks Code-o-mat
I'm using Forms::DataVisualization::Chartting control. How could I send X, Y data to chart?
Regards
Daniel
|
|
|
|
|
How could I send X, Y value to Chart control, this control in DataVisualization.Chartting.
Thanks
|
|
|
|
|
I never used any .NET controls in MFC so i'm not sure, but i suspect that if you used this CWinFormsControl class as shown in the example(s), you can get a pointer at the control's managed class thorough CWinFormsControl::GetControl[^] and then use it's methods to "communicate" with the control, try checking out this[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
how to add cur resources to any executable by program?
|
|
|
|
|
Have you looked at UpdateResource(hResource, RT_CURSOR, ...) and related functions?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Yes, I have looked. It's ok for icon resources, but fail for cur resources, who can help me, thanks
|
|
|
|
|