|
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!!!
|
|
|
|
|
One solution is to design an algorithm and update the controls manually.
Kuphryn
|
|
|
|
|
Is it i should use a event called OnselendokTypeDetail?? in this event i will retrieve the data from the database and assign it to combobox2 when the user have selected the data from combobox1 such as:
m_TypeDetail.Execute(0,1, T_("Select TypeDetailId, Description From tbl_TypeDetail where TypeId = %dcb",) &m_Type);
combox1 member variable = m_Type, combobox2 member variable = m_TypeDetail
|
|
|
|
|
How do I embed and use a font resource in application?
Please send a sample.
Thanks.
|
|
|
|
|
You can create binary resources that are basically the contents of a LOGFONT structure. When you need to create the font, you will need to load the resource and call CreateFontIndirect, passing the logfont pointer.
onwards and upwards...
|
|
|
|
|
Did you ever get this working?
Cheers
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
hi, i try to play around with ON_UPDATE_COMMAND_UI but i didn't get wat i want
i put the following macro in my message map:
===
ON_COMMAND(ID_FACEREDETECTION_DISABLE, OnFaceredetectionDisable)
ON_UPDATE_COMMAND_UI(ID_FACEREDETECTION_DISABLE, OnUpdateFaceredetectionDisable)
===
void CXFaceRecognitionDlg::OnUpdateFaceredetectionDisable(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
MessageBox("OnUpdateFaceredetectionDisable", "OnUpdateFaceredetectionDisable", MB_OK);
pCmdUI->SetText ("New Text");
}
when i click on that menu, i get the message box. however, the text of the menu won't change ??
can anyone tell me why this happen??
thank you.
regards
yccheok
p/s ya. i am developing dialog based application and i just add the menu by manually editing the resource file.
====
IDD_XFACERECOGNITION_DIALOG DIALOGEX 0, 0, 299, 263
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "FaceRecognition .NET"
MENU IDR_MENU1
===
|
|
|
|