|
Hello, I'm curious on how to make the item selection in ComboBoxEx control the way that Michael Dunn's Custom Draw does int the ListView control (without selecting the icon - the last part). Any ideas?
Thanks,
Deian
PS: No custom draw available for ComboBoxEx, according to my MSDN documenation
|
|
|
|
|
I've never used ComboboxEx controls much, but I think they work like the regular combobox - set either the CBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWFIXED style, then handle WM_MEASUREITEM and WM_DRAWITEM .
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Ok, I have an application where many bitmaps are displayed on the screen. The user has to be able to click on the bitmaps and move them around and delete them and other things like that. What I was originally doing was handling WM_LBUTTONDOWN and finding the bitmap that was closest to the cursor position. What I would like to do, and I don't know if this is possible, is have each bitmap in its own little invisible window that could recieve its own messages, like WM_LBUTTONDOWN. I don't know how to do this or even if it's possible, so any help would be greatly appreciated. Is there a better way to go about doing this?
Thanks,
Steve
|
|
|
|
|
It's hard to say what's the "best" way w/o knowing how your app is structured. What I personally would do is keep an array/list of RECT s that hold the coordinates of each bitmap. Then when you get a WM_LBUTTONDOWN message, use PtInRect to find which RECT the cursor was in. Then you'll know which bitmap was clicked.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Hi
I have a SDI application (made by AppWizard). MRU list is handled in standard way (just like in applications made by AppWizard).
Here is my problem: when recent file list is empty (for example program is launched on some system for the first time or someone has cleaned proper registry key) there is an empty menu item in File menu. Is there an easy way to hide such empty MRU item? I don't want to handle MRU by myself (that will surely solve my problem). Thanks in advance for any help.
Mariusz Popiolek
|
|
|
|
|
You can't just hide menu items - you have to remove them from the menu,
I wouldn't recommend attempting removing this item though. MFC uses the this menu item as a basis for adding the new ones. If you remove the "no files" (or whatever it is) menu entry, then it won't know where to insert any subsequent files in the MRU list.
You're better off just leaving it the way it is, unless you do want to handle the MRU yourself.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I've subclessed a few classes like CEdit, CListBox,...
If I bind these classes to resources created with the resource edit all works fine. But if I use Create(..) then the controls assume System to be their default font and Edit boxes are drawn without a border and not even adding WS_EX_CLIENTDGE does the job.
Does anyone have any idea why this is happening?
Thank you
Artur Jales Moreira
|
|
|
|
|
jales wrote:
if I use Create(..) then the controls assume System to be their default font
'System' is the default font. In order to set the font to the currently selected user font for dialogs, try this: control.SetFont(::GetStockObject(DEFAULT_GUI_FONT)) .
jales wrote:
Edit boxes are drawn without a border
Add the WS_BORDER style to the dwStyle parameter specified in your Create call.
Software Zen: delete this;
|
|
|
|
|
First of all, thank you! SetFont(..) did the job.
As for the border, I didn't explained correctly what happens, the problem is that the border is a single black line instead of a 3D looking border.
Thank you
Artur Jales Moreira
|
|
|
|
|
The 3D border styles are extended styles. To use those, you should call CreateEx, which lets you specify an extended style argument in addition to the normal style argument.
Software Zen: delete this;
|
|
|
|
|
You're the man. That did the job.
At first I did check CWnd::Create() and saw that it called CreateEx but I forgot that the extended styles were a different parameter.
Thank you
Artur Jales Moreira
|
|
|
|
|
Greetings,
I have a visual C++ 6 problem:
I have a Class CBitmapLoader that is defined in BitmapLoaderClass.h
I have a MainShell.cpp file that creates an instance of CBitmapLoader called Background and uses it's functions.
I have a DrawingPhase.cpp file that also wants to access the Background functions.
I have included BitmapLoaderClass.h in MainShell.cpp but including it in DrawingPhase.cpp causes an "already defined" error (despite BitmapLoaderClass.h being "bracketed" by #ifndef, define and #endif.
I have tried to extern the CBitmapLoader Background and its functions.
Would a Namespace allow me to access functions as if it was the same source file ?
Much appreciated.
|
|
|
|
|
It sounds like your bracket symbol (the #ifdef... #define... #endif stuff) may be misspelled someplace.
Software Zen: delete this;
|
|
|
|
|
does anyone know if static libs (non MFC) built with VS.Net 2003 can be used in VS.Net '02 ?
-c
To vote with no response is to follow the way of the coward.
|
|
|
|
|
How to get a random number of BYTE type
|
|
|
|
|
BYTE b = (BYTE)( rand () % 256);
Iain.
|
|
|
|
|
It's so easy!
Thank you.
|
|
|
|
|
How can I make a function to do rand() work?
<marquee>Hosam Aly Mahmoud
|
|
|
|
|
Maybe a random number can be generated as following ways:
1.serial numbers;
2.A mathimatial way, which requires:
(1)Irrelevant;
(2)Diffusing;
(3)Shifting;
(4)Inter-Action;
and so on.
Herein I just have a free think, however, I don't know the how-to-do details.
|
|
|
|
|
This could be one of two questions:
1) How can I use the rand () function?
or
2) How can I write my own pseudo random number generator?
In answer to (1), it's quite simple. Just look up the rand function in MSDN to get the right
header file to include (stdlib.h as I remember). Then use the function which returns a pseudo
random integer. Use that as you wish...
In answer to (2), don't! There's been a LOT of brainy people doing a large amount
of work over the last several decades coming up with algorithms which return a close-to-
random number. Just use their work. For those rare examples which require a truly random
number generator (high level cryptography, weather prediction) they use a real world random
phenomenon (e.g. Cosmic ray incidence etc) and measure that.
If you can write a better random number generator than is alreay in use, you'll need more
knowledge that I can give, but you'd earn a professorship...
Iain.
|
|
|
|
|
It depends on how random you want it. As the poster above suggests, using rand() is fine.
However, the Crypto API has a random data functions called CPGenRandom() and CryptGenRandom() - I've never used them, but I would suspect they would generate "better" random data, going by the documentation in MSDN
--
Ian Darling
|
|
|
|
|
Hi, it's hard for me to describe exactly what i'm looking for but i'll give it a shot.
I've been learning assembly lately and looked at some code that used an interrupt to print some text to the screen. The assembly program could then be written to a disk in the bootsector and the program could be run on boot, like a small operating system (of course its not really an operating system since it only prints text). But now i was wondering, since C is translated in assembly and since its just sort of a mean to keep your code structured and readable, if you could write pure C code that can be executed on boot without needing any libraries or any of that, so it would basically have the same result as the assembly code i mentioned earlier. Would this code just be assembly code in a C syntaxis (like you can still use functions and preprocessors like in C) or would it be possible in in just.. well C. I don't know much about low level C. If anyone could show me an example of what a C program looks like that can be run on boot, without anything else running/installed on the PC, that would be great (if it exists of course but i figured it does since a lot of operating systems are written in C).
Perhaps you would need a special C compiler?
Thanks for your help
Kuniva
--------------------------------------------
|
|
|
|
|
It's not easy, but possible. You need a compiler that can compile to a raw binary image (not an .EXE file), and it must be able to start the code at the first location in the file. If you use multiple files, then you'll need a linker that supports raw binary output files. A good place to start is http://my.execpc.com/~geezer/johnfine/[^], which give a few links, some sample source code, and some utilities, including a linker specially written for doing this (jloc).
The DJGPP[^] development environment is excellent for low-level work like this.
It is possible, but you will need to use a special compiler/linker. I have used the DJGPP/jloc system and it works well (a few years ago, though...).
BTW, using the C libraries are not a problem, as long as they don't call any OS functions, such as memory management. The DJGPP system includes a series of C libraries that meet this requirement.
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Yea, this helps a lot, thanks, i already worked with the DJGPP environment before so shouldn't be a problem
Kuniva
--------------------------------------------
|
|
|
|
|
Hi fren,
i am not sure how to link the related comboBox in the C++. Actually i would like the comboBox related in this way, such as the 1st combobox may consist the data called Food, Beverage. Then i wan the 2nd combo box will consist the data which is link to the selection of the 1st combobox. that's mean if user select Food, my 2nd combobox will onli list out- sandwiches, pasta, etc. wherelese if user select beverage will list out - coffee, coke,etc.
Hope u get what i mean. Thanks for your help!!!
|
|
|
|